dwarf: Also match abbrev base when searching abbrev list

A .debug_abbrev section can have multiple CUs.  When caching abbrev list,
we need to check abbrev base to support multiple CUs.

	PR binutils/26808
	* dwarf.c (abbrev_list): Add abbrev_base.
	(new_abbrev_list): Add an abbrev_base argument and record it.
	(find_abbrev_list_by_abbrev_offset): Add an abbrev_base argument
	and match it.
	(process_debug_info): Pass abbrev_base to new_abbrev_list and
	find_abbrev_list_by_abbrev_offset.
	(display_debug_abbrev): Pass 0 abbrev_base to new_abbrev_list
	and find_abbrev_list_by_abbrev_offset.
	* testsuite/binutils-all/x86-64/pr26808.dump: New file.
	* testsuite/binutils-all/x86-64/pr26808.dwp.bz2: Likewise.
	* testsuite/binutils-all/x86-64/x86-64.exp: Run PR binutils/26808
	test.
This commit is contained in:
H.J. Lu 2020-10-29 09:19:25 -07:00
parent cfaa8f7692
commit 76868f3606
5 changed files with 1517 additions and 22 deletions

File diff suppressed because it is too large Load diff

Binary file not shown.

View file

@ -27,3 +27,34 @@ foreach t $test_list {
verbose [file rootname $t]
run_dump_test [file rootname $t]
}
set t $srcdir/$subdir/pr26808.dwp.bz2
# We need to strip the ".bz2", but can leave the dirname.
set test $subdir/[file tail $t]
set testname [file rootname $test]
verbose $testname
if {[catch "system \"bzip2 -dc $t > $tempfile\""] != 0} {
untested "bzip2 -dc ($testname)"
} else {
send_log "$READELF -wi $tempfile > tmpdir/pr26808.out 2> /dev/null\n"
verbose "$READELF -wi $tempfile > tmpdir/pr26808.out 2> /dev/null" 1
set got [catch "system \"$READELF -wi $tempfile > tmpdir/pr26808.out 2> /dev/null\""]
if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]]} then {
fail $testname
} else {
send_log "cmp tmpdir/pr26808.out $srcdir/$subdir/pr26808.dump\n"
verbose "cmp tmpdir/pr26808.out $srcdir/$subdir/pr26808.dump" 1
set status [remote_exec build cmp "tmpdir/pr26808.out $srcdir/$subdir/pr26808.dump"]
set exec_output [lindex $status 1]
set exec_output [prune_warnings $exec_output]
if [string match "" $exec_output] then {
pass "readelf -wi ($testname)"
} else {
send_log "$exec_output\n"
verbose "$exec_output" 1
fail "readelf -wi ($testname)"
}
}
}