testsuite, gdb.btrace: fix 32-bit PIE false positives

For 32-bit position independent executables, GCC generates an extra call to

    __x86.get_pc_thunk.<reg>

which appears in the function call history.  It is correct to appear there
but this confuses the tests, which check for an expected sequence of
functions.

Build with nopie to avoid this complication.

gdb/testsuite/ChangeLog:
2020-12-04  Markus Metzger  <markus.t.metzger@intel.com>

	* gdb.btrace/exception.exp: Build with nopie.
	* gdb.btrace/function_call_history.exp: Likewise.
	* gdb.btrace/unknown_functions.exp: Likewise.
This commit is contained in:
Markus Metzger
2020-12-04 10:29:06 +01:00
parent 806e7575e2
commit 0fe69a94d4
4 changed files with 19 additions and 5 deletions

View File

@ -1,3 +1,9 @@
2020-12-21 Markus Metzger <markus.t.metzger@intel.com>
* gdb.btrace/exception.exp: Build with nopie.
* gdb.btrace/function_call_history.exp: Likewise.
* gdb.btrace/unknown_functions.exp: Likewise.
2020-12-21 Markus Metzger <markus.t.metzger@intel.com>
* gdb.btrace/multi-inferior.exp: Skip if use_gdb_stub.

View File

@ -22,8 +22,11 @@ if { [skip_btrace_tests] } {
return -1
}
# We expect a specific function call history. This gets messed up with
# PIE on 32-bit.
standard_testfile exception.cc
if [prepare_for_testing "failed to prepare" $testfile $srcfile {c++ debug}] {
if [prepare_for_testing "failed to prepare" $testfile $srcfile \
{nopie c++ debug}] {
return -1
}

View File

@ -22,8 +22,10 @@ if { [skip_btrace_tests] } {
return -1
}
# We expect a specific function call history. This gets messed up with
# PIE on 32-bit.
standard_testfile
if [prepare_for_testing "failed to prepare" $testfile {} {debug}] {
if [prepare_for_testing "failed to prepare" $testfile {} {nopie debug}] {
return -1
}

View File

@ -24,9 +24,12 @@ if { [skip_btrace_tests] } {
standard_testfile
# discard local symbols
set ldflags "additional_flags=-Wl,-x"
if [prepare_for_testing "failed to prepare" $testfile $srcfile $ldflags] {
# We expect a specific function call history. This gets messed up with
# PIE on 32-bit.
#
# Also discard local symbols.
if [prepare_for_testing "failed to prepare" $testfile $srcfile \
{additional_flags=-Wl,-x nopie}] {
return -1
}