[2/4] Make gdb_continue_to_breakpoint accept an expected breakpoint number
Commit Message
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(-)
@@ -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
}
}