public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* using python to print inferior values
@ 2010-08-10  1:52 Mathew Yeates
  2010-08-10  8:27 ` Joachim Protze
  0 siblings, 1 reply; 2+ messages in thread
From: Mathew Yeates @ 2010-08-10  1:52 UTC (permalink / raw)
  To: gdb

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: using python to print inferior values
  2010-08-10  1:52 using python to print inferior values Mathew Yeates
@ 2010-08-10  8:27 ` Joachim Protze
  0 siblings, 0 replies; 2+ messages in thread
From: Joachim Protze @ 2010-08-10  8:27 UTC (permalink / raw)
  To: gdb

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-08-10  8:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-10  1:52 using python to print inferior values Mathew Yeates
2010-08-10  8:27 ` Joachim Protze

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).