From: Pedro Alves <pedro@codesourcery.com>
To: Abhijit Halder <abhijit.k.halder@gmail.com>
Cc: gdb-patches@sourceware.org
Subject: Re: Provision for array as debugger variable
Date: Mon, 12 Sep 2011 15:11:00 -0000 [thread overview]
Message-ID: <201109121607.37489.pedro@codesourcery.com> (raw)
In-Reply-To: <CAOhZP9yRPkW-d6FCxUwA=jf0mmNWQ0Du3-54uj1MhKzyAALh0w@mail.gmail.com>
On Monday 12 September 2011 15:14:52, Abhijit Halder wrote:
> 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!
This array syntax I've shown is meant to create artificial arrays that
can be passed to the inferior in function calls, and do manipulations
on them as if they came from the inferior in the first place.
If you want better handling of arrays for use in scripts,
a better approach that should work now, would be to use python
instead of the CLI.
--
Pedro Alves
prev parent reply other threads:[~2011-09-12 15:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-12 13:42 Abhijit Halder
2011-09-12 14:15 ` Pedro Alves
2011-09-12 14:36 ` Abhijit Halder
2011-09-12 15:11 ` Pedro Alves [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201109121607.37489.pedro@codesourcery.com \
--to=pedro@codesourcery.com \
--cc=abhijit.k.halder@gmail.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox