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

* [Bug gdb/31846] GDB fails to read build ID from debug file
  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 ` 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
  2 siblings, 0 replies; 4+ messages in thread
From: antoine.allard at outlook dot com @ 2024-06-14 14:17 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #1 from Antoine Allard <antoine.allard at outlook dot com> ---
Any insight on the possible root cause of this issue or how to debug GDB itself
to understand what's wrong with my binaries would be really appreciated :)
(not sure if I filled the bug report correctly as well, let me know if that's
not the case)

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

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

* [Bug gdb/31846] GDB fails to read build ID from debug file
  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
  2 siblings, 0 replies; 4+ messages in thread
From: antoine.allard at outlook dot com @ 2024-06-14 14:17 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #2 from Antoine Allard <antoine.allard at outlook dot com> ---
Any insight on the possible root cause of this issue or how to debug GDB itself
to understand what's wrong with my binaries would be really appreciated :)
(not sure if I filled the bug report correctly as well, let me know if that's
not the case)

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

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

* [Bug gdb/31846] GDB fails to read build ID from debug file
  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
  2 siblings, 0 replies; 4+ messages in thread
From: simon.marchi at polymtl dot ca @ 2024-06-14 19:49 UTC (permalink / raw)
  To: gdb-prs

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

Simon Marchi <simon.marchi at polymtl dot ca> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |simon.marchi at polymtl dot ca

--- Comment #3 from Simon Marchi <simon.marchi at polymtl dot ca> ---
I have no idea off hand for your actual problem.  But to debug GDB, configure
(the top-level configure in binutils-gdb) with something like:

  $ ./configure CFLAGS="-g3 -O0" CXXFLAGS="-g3 -O0"
  $ make all-gdb -j$(nproc)  # the all-gdb target, in order to avoid building
the other tools

Then I usually cd in the gdb directory and use:

  $ ./gdb -nx -q --data-directory=data-directory <other args>

And you can debug gdb itself by doing:

  $ gdb --args ./gdb -nx -q --data-directory=data-directory <other args>

Debugging something like this should be relatively easy, since it's not
something timing dependent.  Break at the point the message is issued and work
your way up to see when code paths diverge.

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