From: Andrew Burgess <andrew.burgess@embecosm.com>
To: gdb-patches@sourceware.org
Cc: Andrew Burgess <andrew.burgess@embecosm.com>
Subject: [PATCH] gdb: Disable address space randomization for a test
Date: Mon, 30 Jul 2018 18:50:00 -0000 [thread overview]
Message-ID: <20180730185045.15565-1-andrew.burgess@embecosm.com> (raw)
The gdb.opt/inline-break.exp test script relies on capturing a $pc
value in one run of GDB, then restarting GDB and placing a breakpoint
at the previously captured $pc and checking we get the expected
behaviour.
With address space randomization on then the captured $pc value is
almost never valid in the second run of GDB, and so the test fails.
Disabling address space randomization where appropriate fixes this
issue.
gdb/testsuite/ChangeLog:
* gdb.opt/inline-break.exp: Disable address space randomization
for the two runs where we care about addresses being consistent.
---
gdb/testsuite/ChangeLog | 5 +++++
gdb/testsuite/gdb.opt/inline-break.exp | 12 ++++++++++++
2 files changed, 17 insertions(+)
diff --git a/gdb/testsuite/gdb.opt/inline-break.exp b/gdb/testsuite/gdb.opt/inline-break.exp
index aed38ed631f..00a5467d617 100644
--- a/gdb/testsuite/gdb.opt/inline-break.exp
+++ b/gdb/testsuite/gdb.opt/inline-break.exp
@@ -264,6 +264,12 @@ set line [gdb_get_line_number "break here"]
with_test_prefix "line number" {
clean_restart $binfile
+ # At the end of this test we store a $pc value, then restart GDB,
+ # and use this $pc value to place a breakpoint. If address space
+ # randomization is on, then the chance of this $pc value being
+ # correct in a second GDB instance is pretty small.
+ gdb_test "set disable-randomization off"
+
if {![runto main]} {
untested "could not run to main"
continue
@@ -289,6 +295,12 @@ with_test_prefix "address" {
clean_restart $binfile
+ # We're about to reuse the $pc value from a prevous run of GDB.
+ # Ensure address space randomization is off so that the inferior
+ # is placed at the same address as previous, and the stored $pc
+ # will still be valid.
+ gdb_test "set disable-randomization off"
+
if {![runto main]} {
untested "could not run to main"
continue
--
2.14.4
next reply other threads:[~2018-07-30 18:50 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-30 18:50 Andrew Burgess [this message]
2018-07-30 18:56 ` Paul Koning
2018-07-30 19:02 ` Andrew Burgess
2018-07-30 19:49 ` Simon Marchi
2018-07-31 12:47 ` Andrew Burgess
2018-07-31 13:32 ` Simon Marchi
2018-07-31 14:23 ` Tom Tromey
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=20180730185045.15565-1-andrew.burgess@embecosm.com \
--to=andrew.burgess@embecosm.com \
--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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).