This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: Provision for array as debugger variable
On Mon, Sep 12, 2011 at 7:12 PM, Pedro Alves <pedro@codesourcery.com> wrote:
> On Monday 12 September 2011 13:44:15, Abhijit Halder wrote:
>
>> in GDB we can do this to define a debugger variable:
>> (gdb) set $var
>>
>> The $var is a scalar variable. Can we define similarly an array?
>
> (gdb) set $var1 = {0, 1}
> (gdb) ptype $var1
> type = int [2]
> (gdb) p $var1
> $1 = {0, 1}
>
> (gdb) set $var2 = (char[2]) {0, 1}
> (gdb) ptype $var2
> type = char [2]
> (gdb) p $var2
> $2 = "\000\001"
>
> --
> Pedro Alves
>
Okay I got it. I'm just curious about whether we can have similarly
dynamic array and associative array along with it, and at the same
time some functionality on top of this, like push etc. function as in
perl. This will be an approach towards making gdb in itself as a
mature scripting language. Just a thought!