Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Markus Metzger via Gdb-patches <gdb-patches@sourceware.org>
To: gdb-patches@sourceware.org
Subject: [PATCH 4/4] testsuite, gdb.btrace: fix 32-bit PIE false positives
Date: Thu, 17 Dec 2020 16:12:12 +0100	[thread overview]
Message-ID: <20201217151212.1179058-5-markus.t.metzger@intel.com> (raw)
In-Reply-To: <20201217151212.1179058-1-markus.t.metzger@intel.com>

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 -no-pie -fno-pie to avoid this complication.

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

	* gdb.btrace/exception.exp: Build with -no-pie -fno-pie.
	* gdb.btrace/function_call_history.exp: Likewise.
	* gdb.btrace/unknown_functions.exp: Likewise.
---
 gdb/testsuite/gdb.btrace/exception.exp             | 5 ++++-
 gdb/testsuite/gdb.btrace/function_call_history.exp | 5 ++++-
 gdb/testsuite/gdb.btrace/unknown_functions.exp     | 9 ++++++---
 3 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/gdb/testsuite/gdb.btrace/exception.exp b/gdb/testsuite/gdb.btrace/exception.exp
index 0d242227938..b515de87b01 100755
--- a/gdb/testsuite/gdb.btrace/exception.exp
+++ b/gdb/testsuite/gdb.btrace/exception.exp
@@ -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 \
+	{additional_flags=-fno-pie ldflags=-no-pie c++ debug}] {
     return -1
 }
 
diff --git a/gdb/testsuite/gdb.btrace/function_call_history.exp b/gdb/testsuite/gdb.btrace/function_call_history.exp
index 51536ff6035..ea22692bb47 100644
--- a/gdb/testsuite/gdb.btrace/function_call_history.exp
+++ b/gdb/testsuite/gdb.btrace/function_call_history.exp
@@ -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
-if [prepare_for_testing "failed to prepare" $testfile {} {debug}] {
+if [prepare_for_testing "failed to prepare" $testfile {} \
+	{additional_flags=-fno-pie ldflags=-no-pie debug}] {
     return -1
 }
 
diff --git a/gdb/testsuite/gdb.btrace/unknown_functions.exp b/gdb/testsuite/gdb.btrace/unknown_functions.exp
index 4db9c70f496..76803319d9f 100644
--- a/gdb/testsuite/gdb.btrace/unknown_functions.exp
+++ b/gdb/testsuite/gdb.btrace/unknown_functions.exp
@@ -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=-fno-pie additional_flags=-Wl,-x ldflags=-no-pie}] {
     return -1
 }
 
-- 
2.26.2

Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Gary Kershaw
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928


  parent reply	other threads:[~2020-12-17 15:14 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-17 15:12 [PATCH] gdb, record: rephrase the 'not recording' error message Markus Metzger via Gdb-patches
2020-12-17 15:12 ` [PATCH 1/4] testsuite, gdb.btrace: make test names unique Markus Metzger via Gdb-patches
2020-12-18 19:34   ` Simon Marchi via Gdb-patches
2020-12-21  7:26     ` Metzger, Markus T via Gdb-patches
2020-12-17 15:12 ` [PATCH 2/4] testsuite, gdb.python: make py-record-*.exp " Markus Metzger via Gdb-patches
2020-12-18 19:35   ` Simon Marchi via Gdb-patches
2020-12-17 15:12 ` [PATCH 3/4] testsuite, gdb.btrace: skip multi-inferior.exp on gdbserver targets Markus Metzger via Gdb-patches
2020-12-18 19:49   ` Simon Marchi via Gdb-patches
2020-12-21  7:27     ` Metzger, Markus T via Gdb-patches
2020-12-21 13:50       ` Simon Marchi via Gdb-patches
2020-12-17 15:12 ` Markus Metzger via Gdb-patches [this message]
2020-12-18 20:01   ` [PATCH 4/4] testsuite, gdb.btrace: fix 32-bit PIE false positives Simon Marchi via Gdb-patches
2020-12-21  7:27     ` Metzger, Markus T via Gdb-patches
2020-12-18 19:18 ` [PATCH] gdb, record: rephrase the 'not recording' error message Simon Marchi via Gdb-patches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201217151212.1179058-5-markus.t.metzger@intel.com \
    --to=gdb-patches@sourceware.org \
    --cc=markus.t.metzger@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox