public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/31497] New: gdb internal fatal error while opening a core dump; binary built with '-gsplit-dwarf'
@ 2024-03-16  7:42 sungdgdhtryrt at gmail dot com
  2024-03-16 16:17 ` [Bug gdb/31497] " tromey at sourceware dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: sungdgdhtryrt at gmail dot com @ 2024-03-16  7:42 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 31497
           Summary: gdb internal fatal error while opening a core dump;
                    binary built with '-gsplit-dwarf'
           Product: gdb
           Version: HEAD
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: sungdgdhtryrt at gmail dot com
  Target Milestone: ---

Created attachment 15406
  --> https://sourceware.org/bugzilla/attachment.cgi?id=15406&action=edit
gdb crash dump

gdb internal fatal error while opening a core dump.

The binary is built with '-gsplit-dwarf', clang-16 using dwp. Dwarf version 5
is used.
Without split dwarf everything is good.

The error occurs from commit 65067f1c2c842f001017638c4fe53613d6656263 until
latest,
previous commits work well.


I did some debugging with gdb.core maybe it can help:

read_dwo_str_index (...): read.c:~19427
{
...
      bfd *abfd = reader->dwo_file->sections.str_offsets.get_bfd_owner ();
      const gdb_byte *p = reader->dwo_file->sections.str_offsets.buffer;

      -> p is NULL -> SIGSEGV in read_initial_length() below

      /* Header: Initial length.  */
      read_initial_length (abfd, p + bytes_read, &bytes_read);
...
}

In create_dwo_unit_in_dwp_v5(): ~10794
uint32_t offset is NULL (incorrect), but uint32_t size is correct,
see at the bottom the readelf dump section [ 6]
---

In create_dwp_hash_table(): ~10127
The offsets and sizes will be set:
      htab->section_pool.v5.offsets = ids_ptr + sizeof (uint32_t) * nr_columns;
      htab->section_pool.v5.sizes = ...

-> It seems htab->section_pool.v5.offsets will be zero after the assignment,
although sizes is correct.


Here is the readelf section dump of the dwp file:

readelf -W -S x.dwp
There are 10 section headers, starting at offset 0x861d0:

Section Headers:
  [Nr] Name                   Type            Address          Off    Size   ES
Flg Lk Inf Al
  [ 0]                        NULL            0000000000000000 000000 000000 00
     0   0  0
  [ 1] .strtab                STRTAB          0000000000000000 086138 000091 00
     0   0  1
  [ 2] .debug_loclists.dwo    PROGBITS        0000000000000000 000040 0000af 00
  E  0   0  1
  [ 3] .debug_abbrev.dwo      PROGBITS        0000000000000000 0000ef 00116b 00
  E  0   0  1
  [ 4] .debug_rnglists.dwo    PROGBITS        0000000000000000 00125a 000151 00
  E  0   0  1
  [ 5] .debug_str.dwo         PROGBITS        0000000000000000 0013ab 05703c 01
MSE  0   0  1

  [ 6] .debug_str_offsets.dwo PROGBITS        0000000000000000 0583e7 0057f8 00
  E  0   0  1
      --- gdb/dwarf2/read.c:10821 [create_dwo_unit_in_dwp_v5] -> size=0x57f8
correct but offset=0 wrong

  [ 7] .debug_info.dwo        PROGBITS        0000000000000000 05dbdf 0284dd 00
  E  0   0  1
  [ 8] .debug_cu_index        PROGBITS        0000000000000000 0860bc 000064 00
     0   0  1
  [ 9] .symtab                SYMTAB          0000000000000000 086120 000018 18
     1   1  8

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

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

end of thread, other threads:[~2024-03-19 13:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-16  7:42 [Bug gdb/31497] New: gdb internal fatal error while opening a core dump; binary built with '-gsplit-dwarf' sungdgdhtryrt at gmail dot com
2024-03-16 16:17 ` [Bug gdb/31497] " tromey at sourceware dot org
2024-03-17  4:01 ` sam at gentoo dot org
2024-03-17  7:37 ` sungdgdhtryrt at gmail dot com
2024-03-17 22:01 ` tromey at sourceware dot org
2024-03-18 18:05 ` sungdgdhtryrt at gmail dot com
2024-03-19 13:18 ` tromey at sourceware dot 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).