This is the mail archive of the gdb@sources.redhat.com 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]

gdb-internal: determining the type of a variable


Hello everybody,

I hope to find advice here although this might be a gcc or 'stabs debuginformation format' related question.

gdb can show lots of information for a variable or instance of a structure type but I need to know where and how it gets it from.

Our executables are compiled with at least stabs debuginformation and I use 'objdump --stabs my_exe' to make use of it.
The aim is to reconstruct arbitrarily nested structure type descriptions down to their final components. I try doing this by parsing objdump's output.


Given the full name of a structure type inlcuding the name of the package where it is defined I will get the description of it.
If the components are from other structure types I can determine them quit easily through the given typenumber/-identifier, but if the components are from a traditional basic type or a self-defined basic type I am not able to determine its type clearly.


As an example I have the description of a structure 'sonar_description' given in the package 'awu_siso_shared_memory':

73884 LSYM 0 0 00000000 1565985 awu_siso_shared_memory__sonar_description:T(0,426)=s2500status:(0,123),0,8;\
73885 LSYM 0 0 00000000 1566062 ref_count:(0,5),32,32;id:(0,7),64,32;transmit_method:(0,139),96,8;\
73886 LSYM 0 0 00000000 1566130 transmit_power_level:(0,397),128,32;measuring_range:(0,382),160,384;\
73887 LSYM 0 0 00000000 1566200 search_sector:(0,400),544,32;search_rotation:(0,148),576,8;\
73888 LSYM 0 0 00000000 1566261 cw_pulse:(0,425),608,32;multi_number_of:(0,7),640,32;\
73889 LSYM 0 0 00000000 1566316 multi_duration_of:(0,33),672,64;;


The given information decribes the structure, but if I want to determine of what type the component 'multi_duration_of' is (grep ':t(0,33)=[r|@]'), I will get multiple possibilities - here are some:

210 LSYM 0 71 00000000 8722 awu_common__debug_mode_range___XDLU_1__1:t(0,33)=@s8;r(0,27);1;1;
371 LSYM 0 84 00000000 12939 awu_common__types__nlink_t:t(0,33)=r(0,29);0;-1;
441 LSYM 0 44 00000000 15165 awu_common__stdio__TTstringS2bP1___XDLU_1__71:t(0,33)=r(0,1);1;71;
6592 LSYM 0 120 00000000 184371 system__address:t(0,33)=r(0,33);0;-1;
19690 LSYM 0 109 00000000 425771 duration___XF_1_1000000000:t(0,33)=@s64;r(0,33);01000000000000000000000;0777777777777777777777;
180473 LSYM 0 120 00000000 184371
122185 LSYM 0 100 00000000 2948958 system__secondary_stack__Tmark_idB:t(0,33)=r(0,33);0;-1;
6835 LSYM 0 81 00000000 75724 awu_common__ipc__Tipc_permissionB:t(0,33)=r(0,33);-2147483648;2147483647;



In fact the type is duration, but my problem is to distinguish between the different possibilities ... so looking for the typenumber alone is not enough.


How does gdb does it??

What am I doing wrong?

Probably looking at stabs does not give the right information to do this; or do i misinterpret stabs format?

Thanks for any comments and help!

Roul Oldenburger


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