public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug symtab/31689] New: [gdb/symtab] PR gas/29517 workaround, dwarf2 case
@ 2024-05-01 13:14 vries at gcc dot gnu.org
  2024-05-01 13:21 ` [Bug symtab/31689] " vries at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2024-05-01 13:14 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31689

            Bug ID: 31689
           Summary: [gdb/symtab] PR gas/29517 workaround, dwarf2 case
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: symtab
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

Consider the following example:
...
$ gcc -g ~/data/hello.c
$ gcc -g hello.s -c
$ readelf -wi hello.o
Contents of the .debug_info section:

  Compilation Unit @ offset 0:
   Length:        0x41 (32-bit)
   Version:       2
   Abbrev Offset: 0
   Pointer Size:  8
 <0><b>: Abbrev Number: 1 (DW_TAG_compile_unit)
    <c>   DW_AT_stmt_list   : 0
    <10>   DW_AT_low_pc      : 0
    <18>   DW_AT_high_pc     : 0x15
    <20>   DW_AT_name        : (indirect string, offset: 0): hello.s
    <24>   DW_AT_comp_dir    : (indirect string, offset: 0x8): /home/vries/gdb
    <28>   DW_AT_producer    : (indirect string, offset: 0x18): GNU AS 2.41.0
    <2c>   DW_AT_language    : 32769    (MIPS assembler)
 <1><2e>: Abbrev Number: 2 (DW_TAG_subprogram)
    <2f>   DW_AT_name        : (indirect string, offset: 0x26): main
    <33>   DW_AT_external    : 1
    <34>   DW_AT_low_pc      : 0
    <3c>   DW_AT_high_pc     : 0x15
 <1><44>: Abbrev Number: 0
...

The return type of main is incorrect.  It doesn't have a DW_AT_type attribute,
and consequently the return type is void.

This is PR gas/29517.  There is a fix for this, added in gas 2.40.

We can see that gas 2.41 is used.  So the fix is present in the assembler used.

However, the fix only works for dwarf3 and later, because it requires
DW_TAG_unspecified type, and the CU dwarf version is 2, due to:
...
$ gcc -g hello.s -c -v 2>&1 | grep "/as " | sed 's%.*/as %as %'
as --gdwarf2 -v --64 -o hello.o hello.s
...

A workaround for this problem was added here:
...
commit 1d45d90934b10862c00a22bcf4075815a785001b
Author: Tom de Vries <tdevries@suse.de>
Date:   Mon Oct 16 16:32:28 2023 +0200

    [gdb/symtab] Work around PR gas/29517
...
but that one is only active for gas 2.39.

For dwarf2, it should be active for gas >= 2.39.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug symtab/31689] [gdb/symtab] PR gas/29517 workaround, dwarf2 case
  2024-05-01 13:14 [Bug symtab/31689] New: [gdb/symtab] PR gas/29517 workaround, dwarf2 case vries at gcc dot gnu.org
@ 2024-05-01 13:21 ` vries at gcc dot gnu.org
  2024-05-01 13:22 ` vries at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2024-05-01 13:21 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31689

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
FTR, found this using fedora's gdb.base/gnu-ifunc-strstr-workaround.exp, with
glibc debug info installed (otherwise it's unsupported).

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug symtab/31689] [gdb/symtab] PR gas/29517 workaround, dwarf2 case
  2024-05-01 13:14 [Bug symtab/31689] New: [gdb/symtab] PR gas/29517 workaround, dwarf2 case vries at gcc dot gnu.org
  2024-05-01 13:21 ` [Bug symtab/31689] " vries at gcc dot gnu.org
@ 2024-05-01 13:22 ` vries at gcc dot gnu.org
  2024-05-01 14:46 ` vries at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2024-05-01 13:22 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31689

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
Testing a fix.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug symtab/31689] [gdb/symtab] PR gas/29517 workaround, dwarf2 case
  2024-05-01 13:14 [Bug symtab/31689] New: [gdb/symtab] PR gas/29517 workaround, dwarf2 case vries at gcc dot gnu.org
  2024-05-01 13:21 ` [Bug symtab/31689] " vries at gcc dot gnu.org
  2024-05-01 13:22 ` vries at gcc dot gnu.org
@ 2024-05-01 14:46 ` vries at gcc dot gnu.org
  2024-05-02  7:34 ` cvs-commit at gcc dot gnu.org
  2024-05-02  7:35 ` vries at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2024-05-01 14:46 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31689

--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #2)
> Testing a fix.

https://sourceware.org/pipermail/gdb-patches/2024-May/208731.html

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug symtab/31689] [gdb/symtab] PR gas/29517 workaround, dwarf2 case
  2024-05-01 13:14 [Bug symtab/31689] New: [gdb/symtab] PR gas/29517 workaround, dwarf2 case vries at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2024-05-01 14:46 ` vries at gcc dot gnu.org
@ 2024-05-02  7:34 ` cvs-commit at gcc dot gnu.org
  2024-05-02  7:35 ` vries at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-05-02  7:34 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31689

--- Comment #4 from Sourceware Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom de Vries <vries@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=5ce0e02478cc79a260c7e29822450284a32b9b12

commit 5ce0e02478cc79a260c7e29822450284a32b9b12
Author: Tom de Vries <tdevries@suse.de>
Date:   Thu May 2 09:34:46 2024 +0200

    [gdb/symtab] Work around PR gas/29517, dwarf2 case

    In commit 1d45d90934b ("[gdb/symtab] Work around PR gas/29517") we added a
    workaround for PR gas/29517.

    The problem is present in gas version 2.39, and fixed in 2.40, so the
    workaround is only active for gas version == 2.39.

    However, the problem in gas is only fixed for dwarf version >= 3, which
    supports DW_TAG_unspecified_type.

    Fix this by also activating the workaround for dwarf version == 2.

    Tested on x86_64-linux.

    Approved-by: Kevin Buettner <kevinb@redhat.com>

    PR symtab/31689
    https://sourceware.org/bugzilla/show_bug.cgi?id=31689

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug symtab/31689] [gdb/symtab] PR gas/29517 workaround, dwarf2 case
  2024-05-01 13:14 [Bug symtab/31689] New: [gdb/symtab] PR gas/29517 workaround, dwarf2 case vries at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2024-05-02  7:34 ` cvs-commit at gcc dot gnu.org
@ 2024-05-02  7:35 ` vries at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2024-05-02  7:35 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31689

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
   Target Milestone|---                         |15.1
         Resolution|---                         |FIXED

--- Comment #5 from Tom de Vries <vries at gcc dot gnu.org> ---
Fixed.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

end of thread, other threads:[~2024-05-02  7:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-01 13:14 [Bug symtab/31689] New: [gdb/symtab] PR gas/29517 workaround, dwarf2 case vries at gcc dot gnu.org
2024-05-01 13:21 ` [Bug symtab/31689] " vries at gcc dot gnu.org
2024-05-01 13:22 ` vries at gcc dot gnu.org
2024-05-01 14:46 ` vries at gcc dot gnu.org
2024-05-02  7:34 ` cvs-commit at gcc dot gnu.org
2024-05-02  7:35 ` vries at gcc dot gnu.org

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).