public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/31846] New: GDB fails to read build ID from debug file
@ 2024-06-05  9:54 antoine.allard at outlook dot com
  2024-06-14 14:17 ` [Bug gdb/31846] " antoine.allard at outlook dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: antoine.allard at outlook dot com @ 2024-06-05  9:54 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 31846
           Summary: GDB fails to read build ID from debug file
           Product: gdb
           Version: HEAD
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: antoine.allard at outlook dot com
  Target Milestone: ---

I have reproduced this issue with both GDB 14.2 and HEAD.
I have a separate debug file
_debug/.build-id/d8/93a4204e84a2777fd175096616364bcdfb6714.debug_ that GDB is
resolving but skips with the following warning:
```
(gdb) symbol-file XXX
Reading symbols from XXX...
warning: File "debug/.build-id/d8/93a4204e84a2777fd175096616364bcdfb6714.debug"
has no build-id, file skipped
```

However, other tools can read the build ID embedded in this debug file:
``` 
$ file --version
file-5.33
$ file debug/.build-id/d8/93a4204e84a2777fd175096616364bcdfb6714.debug
debug/.build-id/d8/93a4204e84a2777fd175096616364bcdfb6714.debug: ELF 64-bit LSB
executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter
*empty*, for GNU/Linux 3.2.0,
BuildID[sha1]=d893a4204e84a2777fd175096616364bcdfb6714, with debug_info, not
stripped
$ readelf --version
GNU readelf version 2.30-119.el8
$ readelf -n debug/.build-id/d8/93a4204e84a2777fd175096616364bcdfb6714.debug |
grep "Build ID:"
    Build ID: d893a4204e84a2777fd175096616364bcdfb6714
```

I have another binary from the same build that GDB has no issue with:
```
(gdb) symbol-file YYY
Reading symbols from YYY...
Reading symbols from
debug/.build-id/dc/48b56fec6a71a384f0b78dfa0431f25d6fb62f.debug...
```

The only difference as far as I can tell is in the size of the debug files:
```
# XXX skipped debug file
$ du -skh debug/.build-id/d8/93a4204e84a2777fd175096616364bcdfb6714.debug
5.6G    debug/.build-id/d8/93a4204e84a2777fd175096616364bcdfb6714.debug

# YYY loaded debug file
$ du -skh debug/.build-id/dc/48b56fec6a71a384f0b78dfa0431f25d6fb62f.debug
19M     debug/.build-id/dc/48b56fec6a71a384f0b78dfa0431f25d6fb62f.debug
```

I tried to debug GDB itself and I was able to pinpoint to difference between
XXX and YYY to the calls to `bfd_check_format()` in `build_id_bfd_get()`
[gdb/build-id.c:33](https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=gdb/build-id.c;h=41667d5e5cf3dd9fb3a9f778fb56d21a2e3485c0;hb=HEAD#l41).
Both call `bfd_check_format()` return false in the case of the XXX debug file,
but I am not able to understand why.

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

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

end of thread, other threads:[~2024-06-14 19:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-05  9:54 [Bug gdb/31846] New: GDB fails to read build ID from debug file antoine.allard at outlook dot com
2024-06-14 14:17 ` [Bug gdb/31846] " antoine.allard at outlook dot com
2024-06-14 14:17 ` antoine.allard at outlook dot com
2024-06-14 19:49 ` simon.marchi at polymtl dot ca

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