objdump --debugging: problems with interpretation of dump

Ian Lance Taylor ian@wasabisystems.com
Thu Oct 16 21:15:00 GMT 2003


Roul Oldenburger <oldenburger.roul@rheinmetall-de.com> writes:

> What I want to do is parse/extract structure descriptions from the
> debugging information.

You may want to also consider looking at the debugging information
directly, rather than via objdump --debugging.  That would be more
difficult but possibly more precise.

> The problem is in certain cases there is no usual description of the
> top structure.
> 
> As an example this is a description of a top structure used for a
> shared memory I can use to build the tree and calculate the offsets:
> ----
> struct gen_siso_shared_memory_vme_env__vme_env_sm_description { /*
> size 208 id 1746 */
>    struct gen_siso_shared_memory_vme_env__vme_env_sm_basic_description
> /* id 1688 */ _parent; /* bitsize 256, bitpos 0 */
>    struct gen_siso_shared_memory_vme_env__version_description /* id
> 1691 */ version; /* bitsize 128, bitpos 256 */
>    struct
> gen_siso_shared_memory_vme_env__static_vme_env_sm_description /* id
> 1734 */ static; /* bitsize 544, bitpos 384 */
>    struct
> gen_siso_shared_memory_vme_env__dynamic_vme_env_sm_description /* id
> 1737 */ dynamic; /* bitsize 736, bitpos 928 */
> };
> ----
> 
> This is the description of another top structure ... but it's empty
> and says it is /* id 0 */
> ----
>   struct awu_siso_shared_memory__shared_memory_description { /* id 0 */
> };
> ----

The debugging information in an executable is roughly the
concatenation of the debugging information for all the objects which
comprise the executable.  For some types of debugging information some
duplicate information is eliminated; this duplication is typically
caused when different objects include the same header file in separate
compilations.

An empty struct definition like the above might mean that the struct
was referenced in the source, but was not defined (e.g., in C, a
simple ``struct foo;'' statement, which permits the declaration of
pointers to the struct without actually defining the struct).  Or it
might mean that the struct definition was eliminated in one or more
object files, in which case you will probably find the struct
definition elsewhere in the debugging output.

> What also can be found is the following which almost look like it should
> ----
> struct awu_siso_shared_memory__shared_memory_description___XVE { /*
> size 4 id 2712 */
>    struct awu_siso_shared_memory__shared_memory_basic_description /*
> id 2189 */ _parent; /* bitsize 256, bitpos 0 */
>    struct awu_siso_shared_memory__version_description /* id 2192 */
> version; /* bitsize 128, bitpos 0 */
>    struct awu_siso_shared_memory__static_shared_memory_description /*
> id 0 */ *static___XVL; /* bitsize 32, bitpos 0 */
>    struct awu_siso_shared_memory__dynamic_shared_memory_table /* id
> 2706 */ dynamic___XVA4; /* bitsize 207264, bitpos 0 */
>    struct awu_siso_shared_memory__future_description /* id 2709 */
> future; /* bitsize 43904, bitpos 0 */
>    struct awu_siso_shared_memory__data_field_description /* id 2620 */
> data_field; /* bitsize 8647040, bitpos 0 */
>    struct awu_siso_shared_memory__environment_description /* id 2694
> */ environment; /* bitsize 28061216, bitpos 0 */
> };
> ----
> 
> 
> Unfortunately I don't know what the meaning of
> -an id 0 description is

The id number can be used to handle different structs which happen to
have the same name (presumably the same struct name was used in
different object files).  All references to the same struct will have
the same ID.

> -the ___XVE name extension is

That comes straight from the debugging information.  I don't know what
it means either.

> -the extensions (___XVL, ___XVA4) in the components names are or why
> they are presented as pointer type

Likewise.  Your compiler is adding that information for some reason,
but I don't know why.

> Also all bitpos are 0 ...

Yes, that's rather odd, and also the bitsizes look improbably large.
This looks like a bug.  What type of object file, and what type of
debugging information, are you looking at?  Which compiler and
assembler did you use to generate the objects?

Ian



More information about the Binutils mailing list