public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug symtab/25969] New: Ignoring .debug_aranges with clang .debug_names
@ 2020-05-11  9:10 vries at gcc dot gnu.org
  2020-05-11  9:41 ` [Bug symtab/25969] " vries at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2020-05-11  9:10 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 25969
           Summary: Ignoring .debug_aranges with clang .debug_names
           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: ---

[ Spinoff PR of PR25941 . ]

Consider the patch and test-case submitted in
https://sourceware.org/pipermail/gdb-patches/2020-May/168179.html .

That is, test-case test.c:
...
int
main (void)
{
 int sum,a,b;
 sum = a + b;
 return sum;
}
...

Compiled liked so:
...
$ clang-10 test.c -gdwarf-5 -o test.out -gpubnames 
..

When loading into gdb, we have:
...
$ gdb test.out
warning: Section .debug_aranges in /data/gdb_versions/devel/test.out entry at
offset 0 debug_info_offset 0 does not exists, ignoring .debug_aranges.
...

The .debug_aranges warning triggers because the .debug_aranges section contains
one entry:
...
debug_aranges contents:
Address Range Header: length = 0x0000002c, version = 0x0002, cu_offset =
0x00000000, addr_size = 0x08, seg_size = 0x00
[0x00000000004003c0,  0x00000000004003eb)
...
which refers to the CU at offset 0, but the CU list (based on the CU list in
.debug_names) only contains the one at 0xc7, so we fail to find it.

-- 
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/25969] Ignoring .debug_aranges with clang .debug_names
  2020-05-11  9:10 [Bug symtab/25969] New: Ignoring .debug_aranges with clang .debug_names vries at gcc dot gnu.org
@ 2020-05-11  9:41 ` vries at gcc dot gnu.org
  2020-09-22  6:18 ` sourav0311 at gmail dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2020-05-11  9:41 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
AFAIU, to fix this, we'll have to do a top-level scan of the CUs, and build
partial symbols for CUs are not contained in any index.

-- 
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/25969] Ignoring .debug_aranges with clang .debug_names
  2020-05-11  9:10 [Bug symtab/25969] New: Ignoring .debug_aranges with clang .debug_names vries at gcc dot gnu.org
  2020-05-11  9:41 ` [Bug symtab/25969] " vries at gcc dot gnu.org
@ 2020-09-22  6:18 ` sourav0311 at gmail dot com
  2023-12-05 21:04 ` tromey at sourceware dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: sourav0311 at gmail dot com @ 2020-09-22  6:18 UTC (permalink / raw)
  To: gdb-prs

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

Sourabh Singh Tomar <sourav0311 at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sourav0311 at gmail dot com

--- Comment #2 from Sourabh Singh Tomar <sourav0311 at gmail dot com> ---
GDB when trying to parse `debug_names` also parses `debug_aranges`
section, however `debug_aranges` section is not generated/present
in `clang-trunk` generated executables. This warning is the result
of GDB not checking whether the section is even present/empty.

clang version 12.0.0

$clang -gdwarf-5 -gpubnames test.c
$readelf -S a.out | awk /debug/
  [24] .debug_abbrev     PROGBITS         0000000000000000  000009a4
  [25] .debug_info       PROGBITS         0000000000000000  000009ed
  [26] .debug_str_offset PROGBITS         0000000000000000  00000a46
  [27] .debug_str        PROGBITS         0000000000000000  00000a6e
  [28] .debug_addr       PROGBITS         0000000000000000  00000af5
  [29] .debug_names      PROGBITS         0000000000000000  00000b08
  [30] .debug_line       PROGBITS         0000000000000000  00000b78
  [31] .debug_line_str   PROGBITS         0000000000000000  00000be1


A quick fix could be:
```
static void
create_addrmap_from_aranges (dwarf2_per_objfile *per_objfile,
                             struct dwarf2_section_info *section)
{
  /*If section is empty(or not present) bail out early.*/
  if (section->empty ())
    return;
```

Because anyway we are bailing out after emitting the warning:
```
if (!insertpair.second)
        {
          warning (_("Section .debug_aranges in %s has duplicate "
                     "debug_info_offset %s, ignoring .debug_aranges."),
                   objfile_name (objfile), sect_offset_str (per_cu->sect_off));
          return;
        }
```

-- 
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/25969] Ignoring .debug_aranges with clang .debug_names
  2020-05-11  9:10 [Bug symtab/25969] New: Ignoring .debug_aranges with clang .debug_names vries at gcc dot gnu.org
  2020-05-11  9:41 ` [Bug symtab/25969] " vries at gcc dot gnu.org
  2020-09-22  6:18 ` sourav0311 at gmail dot com
@ 2023-12-05 21:04 ` tromey at sourceware dot org
  2023-12-06  9:29 ` cvs-commit at gcc dot gnu.org
  2023-12-06  9:36 ` vries at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: tromey at sourceware dot org @ 2023-12-05 21:04 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at sourceware dot org

--- Comment #3 from Tom Tromey <tromey at sourceware dot org> ---
(In reply to Sourabh Singh Tomar from comment #2)

> A quick fix could be:

FWIW the work in bug #24820 has a patch sort of like this;
though I suspect this will be fixed earlier by the
pending patch.

-- 
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/25969] Ignoring .debug_aranges with clang .debug_names
  2020-05-11  9:10 [Bug symtab/25969] New: Ignoring .debug_aranges with clang .debug_names vries at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2023-12-05 21:04 ` tromey at sourceware dot org
@ 2023-12-06  9:29 ` cvs-commit at gcc dot gnu.org
  2023-12-06  9:36 ` vries at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-12-06  9:29 UTC (permalink / raw)
  To: gdb-prs

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

--- 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=b17ef9dcd8d16eedf4e60565cd7701698b5a0b6b

commit b17ef9dcd8d16eedf4e60565cd7701698b5a0b6b
Author: Tom de Vries via Gdb-patches <gdb-patches@sourceware.org>
Date:   Wed Dec 6 10:29:17 2023 +0100

    [gdb/symtab] Redo "Fix assert in set_length"

    This reverts commit 1c04f72368c ("[gdb/symtab] Fix assert in set_length"),
due
    to a regression reported in PR29572, and implements a different fix for
PR29453.

    The fix is to not use the CU table in a .debug_names section to construct
    all_units, but instead use create_all_units, and then verify the CU
    table from .debug_names.  This also fixes PR25969, so remove the KFAIL.

    Approved-By: Tom Tromey <tom@tromey.com>

    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29572
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=25969

-- 
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/25969] Ignoring .debug_aranges with clang .debug_names
  2020-05-11  9:10 [Bug symtab/25969] New: Ignoring .debug_aranges with clang .debug_names vries at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2023-12-06  9:29 ` cvs-commit at gcc dot gnu.org
@ 2023-12-06  9:36 ` vries at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2023-12-06  9:36 UTC (permalink / raw)
  To: gdb-prs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |15.1
             Status|NEW                         |RESOLVED
         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:[~2023-12-06  9:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-11  9:10 [Bug symtab/25969] New: Ignoring .debug_aranges with clang .debug_names vries at gcc dot gnu.org
2020-05-11  9:41 ` [Bug symtab/25969] " vries at gcc dot gnu.org
2020-09-22  6:18 ` sourav0311 at gmail dot com
2023-12-05 21:04 ` tromey at sourceware dot org
2023-12-06  9:29 ` cvs-commit at gcc dot gnu.org
2023-12-06  9:36 ` 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).