public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "antoine.allard at outlook dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug gdb/31846] New: GDB fails to read build ID from debug file
Date: Wed, 05 Jun 2024 09:54:22 +0000	[thread overview]
Message-ID: <bug-31846-4717@http.sourceware.org/bugzilla/> (raw)

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.

             reply	other threads:[~2024-06-05  9:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-05  9:54 antoine.allard at outlook dot com [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-31846-4717@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).