This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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] |
Hello, While trying to debug a program built with dwarf-2, we noticed the following problem when trying to print the value of a variable whose type is derived from an enumeration type. On x86-linux for instance, build the following small program: Procedure A is type Enum is (First, Second, Last); type Sized_Enum is new Enum; X : Sized_Enum := First; Begin X := Second; End A; With the following command: % gnatmake -gdwarf-2 a The problem can be demonstrated as follow: % gdb a (gdb) begin (gdb) ptype sized_enum type = range 0 .. 2 The expected output is (as obtained when built with -gstabs+): (gdb) ptype sized_enum type = range first .. last We believe that the problem is in the dwarf2 data generated by GCC. Here is what is currently generated by GCC (from CVS head): .uleb128 0x3 # (DIE (0x152) DW_TAG_base_type) .ascii "a__sized_enum___XDLU_0__2\0" # DW_AT_name .byte 0x1 # DW_AT_byte_size .byte 0x7 # DW_AT_encoding I believe that sized_enum should instead be defined as a subrange type. With the attached patch, here is what is now generated: .uleb128 0x6 # (DIE (0x119) DW_TAG_subrange_type) .ascii "a__sized_enum___XDLU_0__2\0" # DW_AT_name .byte 0x0 # DW_AT_lower_bound .byte 0x2 # DW_AT_upper_bound .long 0x173 # DW_AT_type and type DIE 0x173 is: .uleb128 0xa # (DIE (0x173) DW_TAG_enumeration_type) .long 0x1be # DW_AT_sibling .ascii "a__sized_enumB\0" # DW_AT_name .byte 0x1 # DW_AT_byte_size [...] 2004-01-07 J. Brobecker <brobecker@gnat.com> * dwarf2out.c (gen_enumeration_type_die): Return the DIE that we just created. (is_ada_subrange_type): DIEs for enumeration subtypes should be emitted as subrange types too. (subrange_type_die): Add handling of enumeration subtypes. tested on x86-linux, by bootstrapping GCC and against the testsuite. OK to apply? Thanks, -- Joel
Attachment:
dwarf2out.c.diff
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |