This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: using python to print inferior values


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]