binutils-gdb/gdb/testsuite/gdb.dwarf2/fission-loclists-pie.exp
Tom de Vries c39c86378f [gdb/testsuite] Fix gdb.dwarf2/fission-reread.exp with .gdb_index
When running test-case gdb.dwarf2/fission-reread.exp with target board
cc-with-gdb-index, we run into:
...
gdb compile failed, warning: Could not find DWO TU \
  fission-reread.dwo(0x9022f1ceac7e8b19) referenced by TU at offset 0x0 \
  [in module outputs/gdb.dwarf2/fission-reread/fission-reread]
...
The problem is that the .dwo file is not found.

There's code added in the .exp file to make sure the .dwo can be found:
...
 # Make sure we can find the .dwo file, regardless of whether we're
 # running in parallel mode.
 gdb_test_no_output "set debug-file-directory [file dirname $binfile]" \
     "set debug-file-directory"
...
This works normally, but not for the gdb invocation done by cc-with-tweaks.sh
for target board cc-with-gdb-index.

Fix this by finding the full path to the .dwo file and passing it
to the compilation.

Tested on x86_64-linux with native and target boards cc-with-gdb-index,
cc-with-debug-names and readnow.

gdb/testsuite/ChangeLog:

2021-02-01  Tom de Vries  <tdevries@suse.de>

	* gdb.dwarf2/fission-base.S: Pass -DDWO=$dwo.
	* gdb.dwarf2/fission-loclists-pie.S: Same.
	* gdb.dwarf2/fission-loclists.S: Same.
	* gdb.dwarf2/fission-multi-cu.S: Same.
	* gdb.dwarf2/fission-reread.S: Same.
	* gdb.dwarf2/fission-base.exp: Use DWO.
	* gdb.dwarf2/fission-loclists-pie.exp: Same.
	* gdb.dwarf2/fission-loclists.exp: Same.
	* gdb.dwarf2/fission-multi-cu.exp: Same.
	* gdb.dwarf2/fission-reread.exp: Same.
2021-02-01 18:24:49 +01:00

57 lines
1.6 KiB
Plaintext

# Copyright 2016-2021 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# This testcase exercises PR symtab/19999.
# For Fission, while we shouldn't add the DWARF base address to addresses
# coming from .debug_addr, will still need to add the base offset in case
# we're debugging a PIE executable.
load_lib dwarf.exp
# We run objcopy locally to split out the .dwo file.
if [is_remote host] {
return 0
}
# This test can only be run on targets which support DWARF-2 and use gas.
if ![dwarf2_support] {
return 0
}
# This test can only be run on x86-64 targets.
if {![istarget x86_64-*] || ![is_lp64_target]} {
return 0
}
standard_testfile .S
set dwo [standard_output_file "fission-loclists-pie.dwo"]
if [build_executable_from_fission_assembler \
"$testfile.exp" "$binfile" "$srcfile" \
[list "nodebug" "ldflags=-pie" additional_flags=-DDWO=$dwo]] {
return -1
}
clean_restart $binfile
if ![runto_main] {
return -1
}
# Verify gdb can find argc.
gdb_test "p argc" " = 1"