Bug 26797 - [readnow] Dwarf error result in no minimal symbols
Summary: [readnow] Dwarf error result in no minimal symbols
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: symtab (show other bugs)
Version: HEAD
: P2 normal
Target Milestone: 15.1
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-10-28 09:14 UTC by Tom de Vries
Modified: 2023-11-06 07:54 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tom de Vries 2020-10-28 09:14:57 UTC
Normally we have:
...
(gdb) file dw2-error^M
Reading symbols from dw2-error...^M
Dwarf Error: wrong version in compilation unit header (is 153, should be 2, 3, 4 or 5) [in module dw2-error]^M
(No debugging symbols found in dw2-error)^M
(gdb) PASS: gdb.dwarf2/dw2-error.exp: file dw2-error
break -q main^M
Breakpoint 1 at 0x4004ab^M
(gdb) PASS: gdb.dwarf2/dw2-error.exp: break -q main
...

But with with -readnow, we have instead:
...
(gdb) file dw2-error^M
Reading symbols from dw2-error...^M
Dwarf Error: wrong version in compilation unit header (is 153, should be 2, 3, 4 or 5) [in module dw2-error]^M
(gdb) PASS: gdb.dwarf2/dw2-error.exp: file dw2-error
break -q main^M
No symbol table is loaded.  Use the "file" command.^M
(gdb) FAIL: gdb.dwarf2/dw2-error.exp: break -q main
...

So, with -readnow, we somehow also end up without minimal symbols.
Comment 1 Tom Tromey 2020-10-31 18:23:13 UTC
I think there's another bug on this topic somewhere...
basically the DWARF reader should try harder when it
encounters invalid DWARF.  For example we could issue
a warning but still accept some of the DWARF (say CUs
that do not cause failures); and in any case not
reject the entire objfile.
Comment 2 Sourceware Commits 2023-09-08 10:27:23 UTC
The master branch has been updated by Tom de Vries <vries@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=92b7ae3f9a3333cb7902c8a7676ae7ed5bcd54d0

commit 92b7ae3f9a3333cb7902c8a7676ae7ed5bcd54d0
Author: Tom de Vries <tdevries@suse.de>
Date:   Fri Sep 8 12:27:02 2023 +0200

    [gdb/testsuite] Add kfail in gdb.dwarf2/dwzbuildid.exp
    
    When running test-case gdb.dwarf2/dwzbuildid.exp using target board readnow, I
    get:
    ...
    (gdb) file dwzbuildid-mismatch^M
    Reading symbols from dwzbuildid-mismatch...^M
    warning: File "dwzbuildid5.o" has a different build-id, file skipped^M
    could not find '.gnu_debugaltlink' file for dwzbuildid-mismatch^M
    (gdb) delete breakpoints^M
    (gdb) info breakpoints^M
    No breakpoints or watchpoints.^M
    (gdb) break -qualified main^M
    No symbol table is loaded.  Use the "file" command.^M
    Make breakpoint pending on future shared library load? (y or [n]) n^M
    (gdb) FAIL: gdb.dwarf2/dwzbuildid.exp: mismatch: gdb_breakpoint: set breakpoint at main
    ...
    
    This is PR symtab/26797: when using readnow, a failure in reading the dwarf
    results in the minimal symbols not being available.
    
    Add a corresponding KFAIL.
    
    Tested on x86_64-linux.