I would like to declare an array convenience variable, such as
set $list[10]
but I get a syntax error.
Is it possible to create a vector using convenience variables?
I could use pointers, if I can find an absolute area memory GDB can use that the target program won't use.
Oh, BTW, I don't have a symbol table for the target program I am debugging, using a compiler not compatible with GDB.
The cross-target version of GDB I have does not support python.
I think it is only possible if you allocate memory in the inferior. That is, try something like:
set $list = (int *) malloc (10 * sizeof (int))
Change the types to suit.
Another similar option is to use the {...} feature. I am not sure offhand, but I think this may allocate memory in the inferior in some cases. Anyway, try:
print {1,2,3,4}[2]
I get
$1 = 3
Yes, you can.
For example,
(gdb) set $a = (int [3]) {0}
(gdb) p $a
$14 = {0, 0, 0}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With