public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Richard Bunt <richard.bunt@arm.com>
To: gdb-patches@sourceware.org
Cc: nd@arm.com
Subject: [PATCH] Fixed top frame assumption in watchpoint-hw-attach
Date: Wed, 27 Jun 2018 10:18:00 -0000	[thread overview]
Message-ID: <d8b751d8-b6dd-2bda-50cd-102e0d9fe32a@arm.com> (raw)

Fixed top frame assumption in watchpoint-hw-attach

watchpoint-hw-attach.exp was noticed to fail on some machines.
Thanks to the input from sergiodj and palves on the IRC channel,
it was concluded that the test case incorrectly assumed that on
attach it was landed in the top-most frame of the inferior. This
was fixed by running to a break point in main by explicitly
defining the source file name before continuing with the test.

Tested on the following architectures x86_64, aarch64 and ppc64le.

gdb/testsuite/ChangeLog:

2018-06-25  Richard Bunt  <richard.bunt@arm.com>

	* gdb.base/watchpoint-hw-attach.c (main): Remove unneeded
	code.
	* gdb.base/watchpoint-hw-attach.exp: Break in outermost frame.
---
 gdb/testsuite/gdb.base/watchpoint-hw-attach.c   | 1 -
 gdb/testsuite/gdb.base/watchpoint-hw-attach.exp | 8 ++++----
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/gdb/testsuite/gdb.base/watchpoint-hw-attach.c
b/gdb/testsuite/gdb.base/watchpoint-hw-attach.c
index 9d55b28..5bfea50 100644
--- a/gdb/testsuite/gdb.base/watchpoint-hw-attach.c
+++ b/gdb/testsuite/gdb.base/watchpoint-hw-attach.c
@@ -36,7 +36,6 @@ main (void)
   for (counter = 0; !should_continue && counter < 100; counter++)
     sleep (1);			/* pidacquired */

-  watched_variable = 0;		/* prewatchtrigger */
   /* Trigger a watchpoint.  */
   watched_variable = 4;
   printf ("My variable is %d\n", watched_variable);
diff --git a/gdb/testsuite/gdb.base/watchpoint-hw-attach.exp
b/gdb/testsuite/gdb.base/watchpoint-hw-attach.exp
index 0c5037c..ba7205d 100644
--- a/gdb/testsuite/gdb.base/watchpoint-hw-attach.exp
+++ b/gdb/testsuite/gdb.base/watchpoint-hw-attach.exp
@@ -57,12 +57,12 @@ clean_restart $binfile

 gdb_test "attach $testpid" "Attaching to program: .*, process $testpid.*"

-gdb_test_no_output "set should_continue = 1"
-
 # Ensure the test program is in the top frame so the required
 # variables are in scope.
-gdb_breakpoint [gdb_get_line_number "prewatchtrigger"]
-gdb_continue_to_breakpoint "prewatchtrigger"
+gdb_breakpoint $srcfile:[gdb_get_line_number "pidacquired"]
+gdb_continue_to_breakpoint "$srcfile:pidacquired"
+
+gdb_test_no_output "set should_continue = 1"

 gdb_test "watch watched_variable" \
 	 "Hardware watchpoint $decimal: watched_variable"
-- 
1.8.5.6

             reply	other threads:[~2018-06-27 10:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-27 10:18 Richard Bunt [this message]
2018-06-27 13:31 ` Simon Marchi
2018-06-29 14:51 ` Pedro Alves
2018-06-29 15:23   ` Richard Bunt
2018-06-29 16:39   ` Richard Bunt
2018-06-29 16:40     ` 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=d8b751d8-b6dd-2bda-50cd-102e0d9fe32a@arm.com \
    --to=richard.bunt@arm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=nd@arm.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).