public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/56805] New: DW_AT_typedef missing when -fdebug-types-section is used (and -fno-eliminate-unused-debug-types)
@ 2013-04-01 23:25 jan.smets@alcatel-lucent.com
  2013-04-01 23:33 ` [Bug debug/56805] " jan.smets@alcatel-lucent.com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: jan.smets@alcatel-lucent.com @ 2013-04-01 23:25 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56805

             Bug #: 56805
           Summary: DW_AT_typedef missing when -fdebug-types-section is
                    used (and -fno-eliminate-unused-debug-types)
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: jan.smets@alcatel-lucent.com


typedef struct
{
    char  b[4];
} some_typedef_name;

typedef some_typedef_name joske;

int main()
{
    return 0;
}

Compiled with :
-gdwarf-4 -fno-var-tracking-assignments -fno-eliminate-unused-debug-types
-fdebug-types-section


Contents of the .debug_types section:

  Compilation Unit @ offset 0x0:
   Length:        0x4f (32-bit)
   Version:       4
   Abbrev Offset: 0
   Pointer Size:  4
   Signature:     86cb53f6d82bc2c9
   Type Offset:   0x1d
 <0><17>: Abbrev Number: 1 (DW_TAG_type_unit)
    <18>   DW_AT_language    : 4    (C++)
    <19>   DW_AT_stmt_list   : 0x0
 <1><1d>: Abbrev Number: 2 (DW_TAG_structure_type)
    <1e>   DW_AT_byte_size   : 4
    <1f>   DW_AT_decl_file   : 1
    <20>   DW_AT_decl_line   : 2
    <21>   DW_AT_linkage_name: (indirect string, offset: 0x0):
17some_typedef_name
    <25>   DW_AT_sibling     : <0x34>
 <2><29>: Abbrev Number: 3 (DW_TAG_member)
    <2a>   DW_AT_name        : b
    <2c>   DW_AT_decl_file   : 1
    <2d>   DW_AT_decl_line   : 3
    <2e>   DW_AT_type        : <0x34>
    <32>   DW_AT_data_member_location: 0
 <1><34>: Abbrev Number: 4 (DW_TAG_array_type)
    <35>   DW_AT_type        : <0x44>
    <39>   DW_AT_sibling     : <0x44>
 <2><3d>: Abbrev Number: 5 (DW_TAG_subrange_type)
    <3e>   DW_AT_type        : <0x4b>
    <42>   DW_AT_upper_bound : 3
 <1><44>: Abbrev Number: 6 (DW_TAG_base_type)
    <45>   DW_AT_byte_size   : 1
    <46>   DW_AT_encoding    : 6    (signed char)
    <47>   DW_AT_name        : (indirect string, offset: 0x14): char
 <1><4b>: Abbrev Number: 6 (DW_TAG_base_type)
    <4c>   DW_AT_byte_size   : 4
    <4d>   DW_AT_encoding    : 7    (unsigned)
    <4e>   DW_AT_name        : (indirect string, offset: 0x19): sizetype

Contents of the .debug_info section:

  Compilation Unit @ offset 0x0:
   Length:        0x48 (32-bit)
   Version:       4
   Abbrev Offset: 0
   Pointer Size:  4
 <0><b>: Abbrev Number: 7 (DW_TAG_compile_unit)
    <c>   DW_AT_producer    : (indirect string, offset: 0x27): GNU C++ 4.8.0
    <10>   DW_AT_language    : 4    (C++)
    <11>   DW_AT_name        : (indirect string, offset: 0x103): /tmp/dwarf.c
    <15>   DW_AT_low_pc      : 0x0
    <19>   DW_AT_high_pc     : 0x24
    <1d>   DW_AT_stmt_list   : 0x0
 <1><21>: Abbrev Number: 6 (DW_TAG_base_type)
    <22>   DW_AT_byte_size   : 4
    <23>   DW_AT_encoding    : 7    (unsigned)
    <24>   DW_AT_name        : (indirect string, offset: 0x19): sizetype
 <1><28>: Abbrev Number: 6 (DW_TAG_base_type)
    <29>   DW_AT_byte_size   : 1
    <2a>   DW_AT_encoding    : 6    (signed char)
    <2b>   DW_AT_name        : (indirect string, offset: 0x14): char
 <1><2f>: Abbrev Number: 8 (DW_TAG_subprogram)
    <30>   DW_AT_external    : 1
    <30>   DW_AT_name        : (indirect string, offset: 0x22): main
    <34>   DW_AT_decl_file   : 1
    <35>   DW_AT_decl_line   : 7
    <36>   DW_AT_type        : <0x44>
    <3a>   DW_AT_low_pc      : 0x0
    <3e>   DW_AT_high_pc     : 0x24
    <42>   DW_AT_frame_base  : 1 byte block: 9c     (DW_OP_call_frame_cfa)
    <44>   DW_AT_GNU_all_call_sites: 1
 <1><44>: Abbrev Number: 9 (DW_TAG_base_type)
    <45>   DW_AT_byte_size   : 4
    <46>   DW_AT_encoding    : 5    (signed)
    <47>   DW_AT_name        : int


without  -fdebug-types-section (note the DW_AT_typedef for 'some_typedef_name'
and 'joske')

Contents of the .debug_info section:

  Compilation Unit @ offset 0x0:
   Length:        0x85 (32-bit)
   Version:       4
   Abbrev Offset: 0
   Pointer Size:  4
 <0><b>: Abbrev Number: 1 (DW_TAG_compile_unit)
    <c>   DW_AT_producer    : (indirect string, offset: 0x2c): GNU C++ 4.8.0
   <10>   DW_AT_language    : 4    (C++)
    <11>   DW_AT_name        : (indirect string, offset: 0x105): /tmp/dwarf.c
    <15>   DW_AT_low_pc      : 0x0
    <19>   DW_AT_high_pc     : 0x24
    <1d>   DW_AT_stmt_list   : 0x0
 <1><21>: Abbrev Number: 2 (DW_TAG_structure_type)
    <22>   DW_AT_byte_size   : 4
    <23>   DW_AT_decl_file   : 1
    <24>   DW_AT_decl_line   : 2
    <25>   DW_AT_linkage_name: (indirect string, offset: 0x18):
17some_typedef_name
    <29>   DW_AT_sibling     : <0x38>
 <2><2d>: Abbrev Number: 3 (DW_TAG_member)
    <2e>   DW_AT_name        : b
    <30>   DW_AT_decl_file   : 1
    <31>   DW_AT_decl_line   : 3
    <32>   DW_AT_type        : <0x38>
    <36>   DW_AT_data_member_location: 0
 <1><38>: Abbrev Number: 4 (DW_TAG_array_type)
    <39>   DW_AT_type        : <0x4f>
    <3d>   DW_AT_sibling     : <0x48>
 <2><41>: Abbrev Number: 5 (DW_TAG_subrange_type)
    <42>   DW_AT_type        : <0x48>
    <46>   DW_AT_upper_bound : 3
 <1><48>: Abbrev Number: 6 (DW_TAG_base_type)
    <49>   DW_AT_byte_size   : 4
    <4a>   DW_AT_encoding    : 7    (unsigned)
    <4b>   DW_AT_name        : (indirect string, offset: 0xf2): sizetype
 <1><4f>: Abbrev Number: 6 (DW_TAG_base_type)
    <50>   DW_AT_byte_size   : 1
    <51>   DW_AT_encoding    : 6    (signed char)
    <52>   DW_AT_name        : (indirect string, offset: 0x100): char
 <1><56>: Abbrev Number: 7 (DW_TAG_typedef)
    <57>   DW_AT_name        : (indirect string, offset: 0x0):
some_typedef_name
    <5b>   DW_AT_decl_file   : 1
    <5c>   DW_AT_decl_line   : 4
    <5d>   DW_AT_type        : <0x21>
 <1><61>: Abbrev Number: 7 (DW_TAG_typedef)
    <62>   DW_AT_name        : (indirect string, offset: 0x12): joske
    <66>   DW_AT_decl_file   : 1
    <67>   DW_AT_decl_line   : 6
    <68>   DW_AT_type        : <0x56>
 <1><6c>: Abbrev Number: 8 (DW_TAG_subprogram)
    <6d>   DW_AT_external    : 1
    <6d>   DW_AT_name        : (indirect string, offset: 0xfb): main
    <71>   DW_AT_decl_file   : 1
    <72>   DW_AT_decl_line   : 7
    <73>   DW_AT_type        : <0x81>
    <77>   DW_AT_low_pc      : 0x0
    <7b>   DW_AT_high_pc     : 0x24
    <7f>   DW_AT_frame_base  : 1 byte block: 9c     (DW_OP_call_frame_cfa)
    <81>   DW_AT_GNU_all_call_sites: 1
 <1><81>: Abbrev Number: 9 (DW_TAG_base_type)
    <82>   DW_AT_byte_size   : 4
    <83>   DW_AT_encoding    : 5    (signed)
    <84>   DW_AT_name        : int


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug debug/56805] DW_AT_typedef missing when -fdebug-types-section is used (and -fno-eliminate-unused-debug-types)
  2013-04-01 23:25 [Bug debug/56805] New: DW_AT_typedef missing when -fdebug-types-section is used (and -fno-eliminate-unused-debug-types) jan.smets@alcatel-lucent.com
@ 2013-04-01 23:33 ` jan.smets@alcatel-lucent.com
  2013-04-02 17:40 ` [Bug debug/56805] DW_TAG_typedef " ccoutant at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jan.smets@alcatel-lucent.com @ 2013-04-01 23:33 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56805

--- Comment #1 from Jan Smets <jan.smets@alcatel-lucent.com> 2013-04-01 23:33:18 UTC ---
And the typedef names should have an entry , regardless of
-fdebug-types-section because -fno-eliminate-unused-debug-types is used.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug debug/56805] DW_TAG_typedef missing when -fdebug-types-section is used (and -fno-eliminate-unused-debug-types)
  2013-04-01 23:25 [Bug debug/56805] New: DW_AT_typedef missing when -fdebug-types-section is used (and -fno-eliminate-unused-debug-types) jan.smets@alcatel-lucent.com
  2013-04-01 23:33 ` [Bug debug/56805] " jan.smets@alcatel-lucent.com
@ 2013-04-02 17:40 ` ccoutant at gcc dot gnu.org
  2013-04-02 18:11 ` jan.smets@alcatel-lucent.com
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: ccoutant at gcc dot gnu.org @ 2013-04-02 17:40 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56805

Cary Coutant <ccoutant at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ccoutant at gcc dot gnu.org

--- Comment #2 from Cary Coutant <ccoutant at gcc dot gnu.org> 2013-04-02 17:40:09 UTC ---
When generating separate type units with -fdebug-types-section, we always prune
unused types after splitting the types out. As implemented, I think
-fdebug-types-section is incompatible with -fno-eliminate-unused-debug-types,
and a diagnostic should be printed.

How important is it that these two options work together?


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug debug/56805] DW_TAG_typedef missing when -fdebug-types-section is used (and -fno-eliminate-unused-debug-types)
  2013-04-01 23:25 [Bug debug/56805] New: DW_AT_typedef missing when -fdebug-types-section is used (and -fno-eliminate-unused-debug-types) jan.smets@alcatel-lucent.com
  2013-04-01 23:33 ` [Bug debug/56805] " jan.smets@alcatel-lucent.com
  2013-04-02 17:40 ` [Bug debug/56805] DW_TAG_typedef " ccoutant at gcc dot gnu.org
@ 2013-04-02 18:11 ` jan.smets@alcatel-lucent.com
  2013-04-02 20:35 ` ccoutant at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jan.smets@alcatel-lucent.com @ 2013-04-02 18:11 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56805

--- Comment #3 from Jan Smets <jan.smets@alcatel-lucent.com> 2013-04-02 18:11:41 UTC ---
For me it's very important.  To briefly describe what we do: we have structures
that are sent to different platforms with configuration information for fail
over/redundancy/etc. First we use ccparse to parse our code and find all the
relevant types/structures/etc. We end up in the file where the type is defined,
not necessarily where it's used. Then we compile our entire project and parse
the objdump STABS output of these structures/files we found with ccparse. Then
that information is used to build a bunch of static asserts based on that
information. (eg, size of members, offsets, etc). This tool helps our software
designers.

I've just written a few thousand lines of perl code to parse DWARF output and
to  regenerate the compile time checks. GCC 4.6 seems to only support
type-sections anyway. Upgrading to 4.7 or 4.8 is not an option due to strict
release planning and limited test resources.

Anything you can do to make this work is appreciated. Thank you.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug debug/56805] DW_TAG_typedef missing when -fdebug-types-section is used (and -fno-eliminate-unused-debug-types)
  2013-04-01 23:25 [Bug debug/56805] New: DW_AT_typedef missing when -fdebug-types-section is used (and -fno-eliminate-unused-debug-types) jan.smets@alcatel-lucent.com
                   ` (2 preceding siblings ...)
  2013-04-02 18:11 ` jan.smets@alcatel-lucent.com
@ 2013-04-02 20:35 ` ccoutant at gcc dot gnu.org
  2013-04-02 20:36 ` ccoutant at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: ccoutant at gcc dot gnu.org @ 2013-04-02 20:35 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56805

--- Comment #4 from Cary Coutant <ccoutant at gcc dot gnu.org> 2013-04-02 20:34:57 UTC ---
In GCC 4.6, type sections were the default for -gdwarf-4, but -gdwarf-2 was
still the default for 4.6, I think. If you explicitly ask for -gdwarf-4, you
can also add -gstrict-dwarf and it will not generate the type sections. The
-fdebug-types-section flag was added in 4.7 when -gdwarf-4 was made the
default.

So if all you need is DWARF-4 with GCC 4.6 and -fno-eliminate-unused-types, but
you don't need type sections, just add -gstrict-dwarf.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug debug/56805] DW_TAG_typedef missing when -fdebug-types-section is used (and -fno-eliminate-unused-debug-types)
  2013-04-01 23:25 [Bug debug/56805] New: DW_AT_typedef missing when -fdebug-types-section is used (and -fno-eliminate-unused-debug-types) jan.smets@alcatel-lucent.com
                   ` (3 preceding siblings ...)
  2013-04-02 20:35 ` ccoutant at gcc dot gnu.org
@ 2013-04-02 20:36 ` ccoutant at gcc dot gnu.org
  2013-04-02 21:28 ` jan.smets@alcatel-lucent.com
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: ccoutant at gcc dot gnu.org @ 2013-04-02 20:36 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56805

Cary Coutant <ccoutant at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2013-04-02
         AssignedTo|unassigned at gcc dot       |ccoutant at gcc dot gnu.org
                   |gnu.org                     |
     Ever Confirmed|0                           |1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug debug/56805] DW_TAG_typedef missing when -fdebug-types-section is used (and -fno-eliminate-unused-debug-types)
  2013-04-01 23:25 [Bug debug/56805] New: DW_AT_typedef missing when -fdebug-types-section is used (and -fno-eliminate-unused-debug-types) jan.smets@alcatel-lucent.com
                   ` (4 preceding siblings ...)
  2013-04-02 20:36 ` ccoutant at gcc dot gnu.org
@ 2013-04-02 21:28 ` jan.smets@alcatel-lucent.com
  2013-04-12  9:38 ` jan.smets@alcatel-lucent.com
  2013-09-03  9:01 ` jan.smets@alcatel-lucent.com
  7 siblings, 0 replies; 9+ messages in thread
From: jan.smets@alcatel-lucent.com @ 2013-04-02 21:28 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56805

--- Comment #5 from Jan Smets <jan.smets@alcatel-lucent.com> 2013-04-02 21:28:37 UTC ---
-gstrict-dwarf does not disable type sections in GCC 4.6, the result is
unchanged. With 4.8 the behaviour is what you described. 

Is it really that much trouble to add a DW_TAG_typedef to the .debug_type
entry, regardless of -fno-eliminate-unused-types ?  Without it the debug entry
is incomplete, imho. I would really appreciate it. Thanks.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug debug/56805] DW_TAG_typedef missing when -fdebug-types-section is used (and -fno-eliminate-unused-debug-types)
  2013-04-01 23:25 [Bug debug/56805] New: DW_AT_typedef missing when -fdebug-types-section is used (and -fno-eliminate-unused-debug-types) jan.smets@alcatel-lucent.com
                   ` (5 preceding siblings ...)
  2013-04-02 21:28 ` jan.smets@alcatel-lucent.com
@ 2013-04-12  9:38 ` jan.smets@alcatel-lucent.com
  2013-09-03  9:01 ` jan.smets@alcatel-lucent.com
  7 siblings, 0 replies; 9+ messages in thread
From: jan.smets@alcatel-lucent.com @ 2013-04-12  9:38 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56805

--- Comment #6 from Jan Smets <jan.smets@alcatel-lucent.com> 2013-04-12 09:38:52 UTC ---
What if we created a new .debug_types section for the typedef if:
 1)  -fno-eliminate-unused-debug-types is used
 2)  a typedef is unused and otherwise eliminated.

By doing this we won't create excessive information for people who are using
debug-types-sections and who want a compact set of debugging info. Would that
be possible?

Thanks


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug debug/56805] DW_TAG_typedef missing when -fdebug-types-section is used (and -fno-eliminate-unused-debug-types)
  2013-04-01 23:25 [Bug debug/56805] New: DW_AT_typedef missing when -fdebug-types-section is used (and -fno-eliminate-unused-debug-types) jan.smets@alcatel-lucent.com
                   ` (6 preceding siblings ...)
  2013-04-12  9:38 ` jan.smets@alcatel-lucent.com
@ 2013-09-03  9:01 ` jan.smets@alcatel-lucent.com
  7 siblings, 0 replies; 9+ messages in thread
From: jan.smets@alcatel-lucent.com @ 2013-09-03  9:01 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56805

--- Comment #7 from Jan Smets <jan.smets@alcatel-lucent.com> ---
Ping


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2013-09-03  9:01 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-01 23:25 [Bug debug/56805] New: DW_AT_typedef missing when -fdebug-types-section is used (and -fno-eliminate-unused-debug-types) jan.smets@alcatel-lucent.com
2013-04-01 23:33 ` [Bug debug/56805] " jan.smets@alcatel-lucent.com
2013-04-02 17:40 ` [Bug debug/56805] DW_TAG_typedef " ccoutant at gcc dot gnu.org
2013-04-02 18:11 ` jan.smets@alcatel-lucent.com
2013-04-02 20:35 ` ccoutant at gcc dot gnu.org
2013-04-02 20:36 ` ccoutant at gcc dot gnu.org
2013-04-02 21:28 ` jan.smets@alcatel-lucent.com
2013-04-12  9:38 ` jan.smets@alcatel-lucent.com
2013-09-03  9:01 ` jan.smets@alcatel-lucent.com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).