From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [PATCH][gdb/testsuite] Fix compare-sections.exp with -fPIE/-pie
Date: Wed, 14 Aug 2019 15:14:00 -0000 [thread overview]
Message-ID: <20190814151405.GA22804@delia> (raw)
Hi,
When running gdb.base/compare-sections.exp with target board -fPIE/-pie, we
get:
...
FAIL: gdb.base/compare-sections.exp: after run to main: compare-sections -r
...
The test expects the read-only sections to have the same contents as in the
file:
...
# Assume startup code doesn't change read-only sections.
compare_sections "-r"
...
but that's not the case for PIE executables.
Fix this by allowing mismatched read-only sections for PIE executables.
Tested on x86_64-linux.
OK for trunk?
Thanks,
- Tom
[gdb/testsuite] Fix compare-sections.exp with -fPIE/-pie
gdb/testsuite/ChangeLog:
2019-08-14 Tom de Vries <tdevries@suse.de>
* gdb.base/compare-sections.exp ("after run to main"): Allow
mismatched read-only sections for PIE executables.
---
gdb/testsuite/gdb.base/compare-sections.exp | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/gdb/testsuite/gdb.base/compare-sections.exp b/gdb/testsuite/gdb.base/compare-sections.exp
index 7dbae5b2c2..75667ee25c 100644
--- a/gdb/testsuite/gdb.base/compare-sections.exp
+++ b/gdb/testsuite/gdb.base/compare-sections.exp
@@ -21,6 +21,8 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug}]} {
return -1
}
+set is_pie [exec_is_pie $binfile]
+
# Run the compare-sections command along with any options as specified
# by OPTIONS, and check that no mismatch is found.
proc compare_sections { {options ""} } {
@@ -87,8 +89,13 @@ with_test_prefix "after run to main" {
gdb_test "compare-sections" \
"MIS-MATCHED.*warning.*One or more sections.*does not match.*loaded file"
- # Assume startup code doesn't change read-only sections.
- compare_sections "-r"
+ if { $is_pie == 1 } {
+ gdb_test "compare-sections -r" \
+ "MIS-MATCHED.*warning.*One or more sections.*does not match.*loaded file"
+ } else {
+ # Assume startup code doesn't change read-only sections.
+ compare_sections "-r"
+ }
}
# Now test that "compare-sections -r" works as expected. Look for an
next reply other threads:[~2019-08-14 15:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-14 15:14 Tom de Vries [this message]
2019-08-16 18:14 ` Pedro Alves
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=20190814151405.GA22804@delia \
--to=tdevries@suse.de \
--cc=gdb-patches@sourceware.org \
/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