code-debug
code-debug copied to clipboard
Rust variables cut off
An example of a rust variable in gdb is x = core::option::Option<i32>::Some(7).
The regex const variableRegex = /^[a-zA-Z_\-][a-zA-Z0-9_\-]*/; cuts this variable to core.
For it to work correctly you would have to add :<>() to the second group in the regex.
I don't know if this would mess things up somewhere else, but in this example it works once you add these chars to the regex.
fn main() {
let x: Option<i32> = Some(7);
println!("{:?}", x);
}
gdb version 8.2
do you mean the variable name is cut off?
No the value is cut off.
It says:
x: <unkown>
<value>: core
Instead of:
x: <unkown>
<value>: core::option::Option<i32>::Some(7)
Or:
x: <unkown>
<value>: Some(7)
If you hover the variable name it works fine and says core::option::Option<i32>.