public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug symtab/31725] New: [gdb/symtab]
@ 2024-05-10 13:40 vries at gcc dot gnu.org
  2024-05-10 13:41 ` [Bug symtab/31725] [gdb/symtab] wrong .debug_str section used in dwarf_decode_macro_bytes vries at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2024-05-10 13:40 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 31725
           Summary: [gdb/symtab]
           Product: gdb
           Version: 14.1
            Status: NEW
          Severity: normal
          Priority: P2
         Component: symtab
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

Consider a hello world, compiled as the fission board does, with -g3 added:
...
$ gcc -gdwarf-4 -gsplit-dwarf -ggnu-pubnames -fdebug-types-section
-Wl,--gdb-index -fuse-ld=gold ~/gdb/hello.c -g3
...

When loading the exec in gdb, we get:
...
$ gdb -q a.out
Reading symbols from a.out...
DW_FORM_strp pointing outside of .debug_str section [in module
/home/vries/binutils/a.out]
(gdb) 
...

Debugging this shows that this is triggered from:
...
207       if (str_offset >= size)
208         error (_("%s pointing outside of %s section [in module %s]"),
209                form_name, get_name (), get_file_name ());
...
with:
...
(gdb) p size
$3 = 33
(gdb) p str_offset
$4 = 553845450
...

Clearly there's something going wrong with the str_offset, that's way too big.

But the size of 33 is very small.  It's correct though, it's the size of the
.debug_str section in a.out.

Going up to dwarf_decode_macro_bytes, we see this is the reason we're using
that .debug_str section:
...
533                       body = per_objfile->per_bfd->str.read_string
(objfile,         
...

However, there's a str_section argument that points to the .debug_str section
in a-hello.dwo:
...
gdb) p *str_section
$6 = {s = {section = 0xaaaaabc1a718, containing_section = 0xaaaaabc1a718}, 
  buffer = 0xaaaaabc1b5b0 "__LDBL_DECIMAL_DIG__ 36", size = 24351,
virtual_offset = 0, 
  readin = true, is_virtual = false}
...

I wonder if we shouldn't be using that one.

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

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

end of thread, other threads:[~2024-05-22  6:12 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-10 13:40 [Bug symtab/31725] New: [gdb/symtab] vries at gcc dot gnu.org
2024-05-10 13:41 ` [Bug symtab/31725] [gdb/symtab] wrong .debug_str section used in dwarf_decode_macro_bytes vries at gcc dot gnu.org
2024-05-10 13:46 ` vries at gcc dot gnu.org
2024-05-10 14:36 ` vries at gcc dot gnu.org
2024-05-13 10:32 ` vries at gcc dot gnu.org
2024-05-13 11:58 ` vries at gcc dot gnu.org
2024-05-13 12:05 ` vries at gcc dot gnu.org
2024-05-13 15:58 ` vries at gcc dot gnu.org
2024-05-22  6:12 ` 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).