Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Joachim Protze <joachim.protze@wh2.tu-dresden.de>
To: gdb@sourceware.org
Subject: Re: using python to print inferior values
Date: Tue, 10 Aug 2010 08:27:00 -0000	[thread overview]
Message-ID: <4C610D7A.3080303@wh2.tu-dresden.de> (raw)
In-Reply-To: <AANLkTinJC55HD6v+E1VQ4TuM30Pi89YfzoU7veNrcot+@mail.gmail.com>

Am 10.08.2010 03:51, schrieb Mathew Yeates:
> Okay. I'm stumped. I have an integer named foo. How do I print it's value?
> 
> This is gdb-weekly-CVS-7.2.50.20100713
> 
> -Mathew

(gdb) python print gdb.selected_frame().read_var("foo")


If you want to typecast it in c-space first:

(gdb) python print gdb.parse_and_eval("(unsigned int)foo")

-Joachim


      reply	other threads:[~2010-08-10  8:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-10  1:52 Mathew Yeates
2010-08-10  8:27 ` Joachim Protze [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=4C610D7A.3080303@wh2.tu-dresden.de \
    --to=joachim.protze@wh2.tu-dresden.de \
    --cc=gdb@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