From: Elena Zannoni <ezannoni@redhat.com>
To: Roul Oldenburger <oldenburger.roul@rheinmetall-de.com>
Cc: gdb@sources.redhat.com
Subject: Re: gdb-internal: determining the type of a variable
Date: Thu, 02 Oct 2003 15:35:00 -0000 [thread overview]
Message-ID: <16252.18444.746262.239761@localhost.redhat.com> (raw)
In-Reply-To: <3F7C1F5F.5030102@rheinmetall-de.com>
Roul Oldenburger writes:
> 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??
I see that Ian answered your questions on the binutils list. As far
as how gdb does it, look at stabsread.c, there is a big switch
statement that handles the cases.
elena
>
> 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
next prev parent reply other threads:[~2003-10-02 15:35 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-10-02 12:48 Roul Oldenburger
2003-10-02 15:35 ` Elena Zannoni [this message]
2003-10-02 15:40 ` Jim Blandy
2003-10-06 14:42 ` Roul Oldenburger
2003-10-06 14:54 ` Daniel Jacobowitz
2003-10-06 21:09 ` Jim Blandy
2003-10-07 7:16 ` Roul Oldenburger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=16252.18444.746262.239761@localhost.redhat.com \
--to=ezannoni@redhat.com \
--cc=gdb@sources.redhat.com \
--cc=oldenburger.roul@rheinmetall-de.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox