[OBJDUMP debugging] inlined enum

Giovanni Visciano giovanni_visciano@yahoo.it
Mon Jan 7 11:25:00 GMT 2008


On Jan 4, 2008, at 4:15 PM, Nick Clifton wrote:

> Hi Giovanni,
>
>> I'm looking at --debugging* options of objdump.
>
> Which version are you using ?

binutils-2.18

>> For some object I'm debugging, I can see a strange debugging type  
>> report: Example:
>> typedef enum { E_A, E_B, E_C } ENUM_E;
>> typedef struct { ENUM_E e; } STRUCT_S;
>> debugging report:
>> typedef struct { enum { E_A, E_B, E_C } e; } STRUCT_S;
>
> For which target is this ?
>

GCC: (GNU) 3.4.5 20051201 (Red Hat 3.4.5-2)
On 32bit Intel machine.

>
> I tried the above test with an i686-pc-cygwin toolchain built from  
> today's mainline GCC sources and mainline binutils sources and I see  
> this output:
>
>  typedef enum { E_A, E_B, E_C } ENUM_E;
>  typedef struct %anon1 { /* size 4 */
>    ENUM_E e; /* bitsize 32, bitpos 0 */
>  } STRUCT_S;
>
Sorry, my fault.
The reported code it's an intentionally simple example.
This happens on a more nested an complex data structure.

I have attached to you the object file (stub.o) with the problem.

For example, looking into the ".stabs" section we can see the "typedef  
enum { .. } Q931_PROTDISC;" definition:

../inc/Q931_def.h
  :T(2,1)=eQ931_PROTDISC_USERSPEC:0,Q931_PROTDISC_OSIHLAY: 
1,Q931_PROTDISC_X244:2,
Q931_PROTDISC_SYSMAN:3,Q931_PROTDISC_IA5CHAR: 
4,Q931_PROTDISC_CCITTV120:7,Q931_PR
OTDISC_Q931:8,;
Q931_PROTDISC:t(2,2)=(2,1)

and then when used for the type of a struct field (protDisc), the  
right reference (2,2):

Q931_UNPACK:t(1,9)=(1,10)=s2296protDisc:(2,2),0,32;callRef:(1,1), 
32,32;msgType:(
2,4),64,32;ieMSet:(1,6),96,18272;;

But the "--debugging" option reports an inlined enum expansion:

typedef struct { %anon120 /* size 2296 */
   enum { /* bitsize 32, bitpos 0 */
     Q931_PROTDISC_USERSPEC,
     ...
   } protDisc;
   ...
};


Thank you,
	Giovanni

-------------- next part --------------
A non-text attachment was scrubbed...
Name: stub.o
Type: application/octet-stream
Size: 47440 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20080107/7696cae2/attachment.o>
-------------- next part --------------



More information about the Binutils mailing list