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: Reading a static variable in Python


On 11/03/2010 4:05 AM, Tom Tromey wrote:
"Chris" == Chris Johns<chris@contemporary.net.au> writes:

Chris> I am adding pretty printers for RTEMS to gdb. In the RTEMS operating Chris> system elements such as a semaphore are given an id. I would like to Chris> print the actual semaphore data given a semaphore id. To do this I Chris> need to read a kernel structure from a table indexed via a bit field Chris> in the id. As an example the semaphore's table is declared in RTEMS Chris> as:

Chris> RTEMS_SEM_EXTERN Objects_Information _Semaphore_Information;

This isn't really enough information for us to help you.
What does Objects_Information look like?


Yes sorry about that. It is a C struct [1].


Chris> I am stuck on how to create a new gdb.Value variable in Python.

Use gdb.parse_and_eval.

Nice. This is an excellent solution. I suppose being an expression it can do the pointer maths as well. I was looking at ways to construct a gdb.Value with a gdb.Symbol as an argument.


This wasn't added until after 7.0.

I am using a 7.1 snapshot as it has the 'source' command to load a Python file. This is also an excellent addition.


Chris

[1] http://www.rtems.org/onlinedocs/doxygen/cpukit/html/structObjects__Information.html


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