This is the mail archive of the
gdb-cvs@sourceware.org
mailing list for the GDB project.
[binutils-gdb] Fixed top frame assumption in watchpoint-hw-attach
- From: Richard Bunt <ricbun01 at sourceware dot org>
- To: gdb-cvs at sourceware dot org
- Date: 28 Jun 2018 08:00:52 -0000
- Subject: [binutils-gdb] Fixed top frame assumption in watchpoint-hw-attach
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=be1b6474f0d471c01f5c4d1f33e4f13df9ffb82c
commit be1b6474f0d471c01f5c4d1f33e4f13df9ffb82c
Author: Richard Bunt <richard.bunt@arm.com>
Date: Thu Jun 28 08:59:59 2018 +0100
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:
* gdb.base/watchpoint-hw-attach.c (main): Remove unneeded
code.
* gdb.base/watchpoint-hw-attach.exp: Break in outermost frame.
Diff:
---
gdb/testsuite/ChangeLog | 6 ++++++
gdb/testsuite/gdb.base/watchpoint-hw-attach.c | 1 -
gdb/testsuite/gdb.base/watchpoint-hw-attach.exp | 8 ++++----
3 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index f3856c4..f93eb97 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2018-06-28 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.
+
2018-06-28 Petr Tesarik <ptesarik@suse.cz>
* gdb.base/relocate.exp: Add test for "add-symbol-file -o ".
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"