This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 2/4] Make gdb_continue_to_breakpoint accept an expected breakpoint number
- From: Simon Marchi <simon dot marchi at ericsson dot com>
- To: <gdb-patches at sourceware dot org>
- Cc: Simon Marchi <simon dot marchi at ericsson dot com>
- Date: Tue, 18 Apr 2017 18:13:19 -0400
- Subject: [PATCH 2/4] Make gdb_continue_to_breakpoint accept an expected breakpoint number
- Authentication-results: sourceware.org; auth=none
- Authentication-results: sourceware.org; dkim=none (message not signed) header.d=none;sourceware.org; dmarc=none action=none header.from=ericsson.com;
- References: <20170418221321.20993-1-simon.marchi@ericsson.com>
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
The gdb_continue_to_breakpoint procedure currently accepts a location
pattern that is checked against the function name/address/filename part
of the breakpoint hit message. This patch adds a similar parameter, but
for the breakpoint number. It can be used to verify that the execution
has stopped at the breakpoint we are expected to hit.
gdb/testsuite/ChangeLog:
* lib/gdb.exp (gdb_continue_to_breakpoint): Add breakpoint_num
parameter, use it in the regex.
---
gdb/testsuite/lib/gdb.exp | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 98ce7970c7..00d46d7eb0 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -584,17 +584,21 @@ proc runto_main { } {
return [runto main no-message]
}
-### Continue, and expect to hit a breakpoint.
-### Report a pass or fail, depending on whether it seems to have
-### worked. Use NAME as part of the test name; each call to
-### continue_to_breakpoint should use a NAME which is unique within
-### that test file.
-proc gdb_continue_to_breakpoint {name {location_pattern .*}} {
+# Continue, and expect to hit a breakpoint. Report a pass or fail, depending on
+# whether it seems to have worked.
+#
+# Use NAME as part of the test name.
+#
+# LOCATION_PATTERN is matched against the location (function name/address/
+# filename/line number) part of the breakpoint hit message.
+#
+# BREAKPOINT_NUM is the GDB number of the breakpoint we expect to hit.
+proc gdb_continue_to_breakpoint {name {location_pattern .*} {breakpoint_num "\[0-9\]+"}} {
global gdb_prompt
set full_name "continue to breakpoint: $name"
gdb_test_multiple "continue" $full_name {
- -re "(?:Breakpoint|Temporary breakpoint) .* (at|in) $location_pattern\r\n$gdb_prompt $" {
+ -re "(?:Breakpoint|Temporary breakpoint) ($breakpoint_num), .* (at|in) $location_pattern\r\n$gdb_prompt $" {
pass $full_name
}
}
--
2.11.0