public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Evan Driscoll <driscoll@cs.wisc.edu>
To: Keith Seitz <keiths@redhat.com>
Cc: gdb@sourceware.org
Subject: Re: Pythons scripting API question
Date: Wed, 30 May 2012 22:42:00 -0000	[thread overview]
Message-ID: <4FC6A251.3080806@cs.wisc.edu> (raw)
In-Reply-To: <4FC68FD0.4060809@redhat.com>

On 05/30/2012 04:23 PM, Keith Seitz wrote:
> Frames contain blocks, blocks contain variables. Blocks in python can be
> iterated

Great, it's that information that I was missing.

However, if I do this:

> $ ./gdb -nx -q gdb -ex "break main" -ex "run"
> (gdb) python import gdb
> (gdb) python for n in gdb.selected_frame().block(): print n,
> argc argv args
> (gdb) python print n.type
> struct captured_main_args
> (gdb) python print n.name
> args
> (gdb) python print n.is_argument
> False
> (gdb) python print n.value(gdb.selected_frame())
> {argc = 0, argv = 0x488f80 <_start>, use_windows = -8032, interpreter_p
> = 0x0}

then on the last step I get this instead:

(gdb) python print n.value(gdb.selected_frame())
Traceback (most recent call last):
   File "<string>", line 1, in <module>
AttributeError: 'gdb.Symbol' object has no attribute 'value'
Error while executing Python code.

Instead, I have to use

(gdb) python print gdb.selected_frame().read_var(n)
{argc = 6742752, argv = 0x0, use_windows = -7696, interpreter_p = 0x0}


Is this just a version difference?

Evan

  reply	other threads:[~2012-05-30 22:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-30 18:10 Evan Driscoll
2012-05-30 21:23 ` Keith Seitz
2012-05-30 22:42   ` Evan Driscoll [this message]
2012-05-30 23:12     ` Keith Seitz
2012-06-06 15:46   ` Joachim Protze
2012-06-06 17:58     ` Tom Tromey

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=4FC6A251.3080806@cs.wisc.edu \
    --to=driscoll@cs.wisc.edu \
    --cc=gdb@sourceware.org \
    --cc=keiths@redhat.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).