c - GDB bit position bit-values -


i'm trying determine address values , sizes using arm .elf output in gdb. usual p& , print functions can determine of addresses , and variable sizes, can't figure out if variable bitvalue or not.

to give example:

typedef struct {   bool_t start;   bool_t running :1;   bool_t objectpoolusable :1;   bool_t ready :1;   bool_t test :1;   bool_t stop :1;   uint8_t defaultmachine; }bitfieldtest;  bitfieldtest bitvalues; 

when asking gdb address of "bitvalues.ready" or "bitvalues.running" return same address (since uses same address), doesn't give me bit position. neither know if bitvalue or boolean taking space of uint8_t.

to clarify need do: give gdb single name, might bitvalue, , return me right address , type. if type bitvalue, need find bit position. non-bitvalues works fine, bitvalues causing trouble now.

is gdb able give kind of output solve problem?

there's no way information directly using gdb expression api. there's no deep reason -- gdb knows bit position -- consequence of fact gdb expressions mimic language being debugged, plus nobody ever bothered expose it. since i've never heard of wanting before, think it's safe rare request.

the information available via gdb's python api. in particular, if iterate on fields of type, field object have bitpos member has bit offset of data. note offset start of enclosing struct.

it relatively simple matter write new command in python prints information.


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -