public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug testsuite/27920] New: [gdb/testsuite] hardcoding -readnow skips testing of partial symbols
@ 2021-05-27 9:57 vries at gcc dot gnu.org
2021-05-27 13:22 ` [Bug testsuite/27920] " cvs-commit at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: vries at gcc dot gnu.org @ 2021-05-27 9:57 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=27920
Bug ID: 27920
Summary: [gdb/testsuite] hardcoding -readnow skips testing of
partial symbols
Product: gdb
Version: 10.1
Status: NEW
Severity: normal
Priority: P2
Component: testsuite
Assignee: unassigned at sourceware dot org
Reporter: vries at gcc dot gnu.org
Target Milestone: ---
I looked into test-case gdb.dwarf2/dw2-icycle.exp, and found:
...
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $srcfile2] {nodebug}] } {
return -1
}
# We are trying to verify that the partial symtab to symtab expansion
# for the debugging info hand-coded in our assembly file does not cause
# the debugger to crash (infinite recursion). To facilitate the test,
# start the debugger with -readnow. This force expansion as soon as
# the objfile is loaded.
set saved_gdbflags $GDBFLAGS
set GDBFLAGS "$GDBFLAGS -readnow"
clean_restart ${testfile}
set GDBFLAGS $saved_gdbflags
...
There seems to be a mismatch between comment and code.
It's true that -readnow forces full symtabs to be generated.
But it specifically skips expansion from partial symtab to full symtab.
I we want to exercise that path, we should use "maint expand-symtabs" instead.
Generally, hardcoding -readnow in test-cases is undesirable because it skips
testing the default way of handling things in gdb using partial symtabs.
Testing readnow can be done using the target board.
And if we really want a test-case to be tested with readnow with any target
board we can f.i. add -readnow.exp variant (see
gdb.base/list-ambiguous-readnow.exp). There are also test-cases that
internally iterate over different loading modes like
partial-syms/readnow/index.
I did a first scan in gdb.dwarf2/*.exp, removing -readnow from test-cases, and
ran into PR27919.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug testsuite/27920] [gdb/testsuite] hardcoding -readnow skips testing of partial symbols
2021-05-27 9:57 [Bug testsuite/27920] New: [gdb/testsuite] hardcoding -readnow skips testing of partial symbols vries at gcc dot gnu.org
@ 2021-05-27 13:22 ` cvs-commit at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-05-27 13:22 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=27920
--- Comment #1 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom de Vries <vries@sourceware.org>:
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=248f7165005096fc618c5fd9bf3588719fc589ef
commit 248f7165005096fc618c5fd9bf3588719fc589ef
Author: Tom de Vries <tdevries@suse.de>
Date: Thu May 27 15:22:38 2021 +0200
[gdb/symtab] Fix segfault in process_psymtab_comp_unit
When running test-case gdb.dwarf2/dw2-dummy-cu.exp without -readnow, we run
into:
...
(gdb) file outputs/gdb.dwarf2/dw2-dummy-cu/dw2-dummy-cu^M
Reading symbols from outputs/gdb.dwarf2/dw2-dummy-cu/dw2-dummy-cu...^M
ERROR: Couldn't load dw2-dummy-cu into GDB (eof).
...
The problem is that we're running into a segfault:
...
Thread 1 "gdb" received signal SIGSEGV, Segmentation fault.
process_psymtab_comp_unit (this_cu=0x2141090, per_objfile=0x1aa4140,
want_partial_unit=false, pretend_language=language_minimal)
at /home/vries/gdb_versions/devel/src/gdb/dwarf2/read.c:7023
7023 switch (reader.comp_unit_die->tag)
...
due to reader.comp_unit_die == nullptr:
...
(gdb) p reader.comp_unit_die
$1 = (die_info *) 0x0
...
Indeed, there's no CU DIE in the test-case:
...
$ readelf -wi outputs/gdb.dwarf2/dw2-dummy-cu/dw2-dummy-cu
Contents of the .debug_info section:
Compilation Unit @ offset 0x0:
Length: 0x7 (32-bit)
Version: 2
Abbrev Offset: 0x0
Pointer Size: 4
$
...
Fix this by handling reader.comp_unit_die == nullptr in
process_psymtab_comp_unit.
Update the test-case to trigger this PR, as per PR27920 - "[gdb/testsuite]
hardcoding -readnow skips testing of partial symbols".
Tested on x86_64-linux.
gdb/ChangeLog:
2021-05-27 Tom de Vries <tdevries@suse.de>
PR symtab/27919
* dwarf2/read.c (process_psymtab_comp_unit):
gdb/testsuite/ChangeLog:
2021-05-27 Tom de Vries <tdevries@suse.de>
PR symtab/27919
PR testsuite/27920
* gdb.dwarf2/dw2-dummy-cu.exp: Use maint expand-symtabs instead of
-readnow.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-05-27 13:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-27 9:57 [Bug testsuite/27920] New: [gdb/testsuite] hardcoding -readnow skips testing of partial symbols vries at gcc dot gnu.org
2021-05-27 13:22 ` [Bug testsuite/27920] " cvs-commit at gcc dot gnu.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).