Reputation: 3235
I am wondering if this is feasible at all - I define 2 convenient variables and like to construct the 3rd one based on the two, I just tried the following:
(gdb) set $a=12
(gdb) set $b=34
(gdb) set $c=$a$b
(gdb) p $c
$1 = void
(gdb) show convenience
$a$b = void
$c = void
$b = 34
$a = 12
$_siginfo = void
My goal is to create variable c whose value is "1234", can this be done at all in GDB?
A related question, can I dynamically define source file search path based on the current directory? "Dynamic" in the sense I can define a GDB user command which calls "dir" command and give its arguments some directories based on the current directory. Based on my current investigation, I cannot use build-in gdb mechanism, I have write a shell script and call gdb shell command to do that.
Upvotes: 2
Views: 1391
Reputation: 213526
My goal is to create variable c whose value is "1234", can this be done at all in GDB?
(gdb) set $c = 1234
(gdb) set $d = 100*$a + $b
Presumably you wanted to concatenate $a
and $b
, but these are integer variables, and concatenating them makes (almost) no sense.
Upvotes: 1