gdb_test "break foo" "Breakpoint $decimal at $hex"
gdb_test "info breakpoints" "<foo\\(\\)@plt>"
-# This is used as an override for delete_breakpoints when we don't
-# want functions in gdb.exp to delete breakpoints behind the scenes
-# for us.
-proc do_not_delete_breakpoints {} {
- # Just do nothing.
-}
-
# Runto main, but don't delete all the breakpoints.
-with_override delete_breakpoints do_not_delete_breakpoints {
- if {![runto_main]} {
- return -1
- }
+if {![runto_main no-delete-breakpoints]} {
+ return -1
}
# The breakpoint should now be showing in `foo` for real.
$test
}
-# Used as a replacement for delete_breakpoints while calling
-# runto_main in one case where we don't want to delete all the
-# breakpoints.
-proc disable_delete_breakpoints {} {
-}
-
# Uses the global variables DEBUGDIR and DB which are setup elsewhere
# in this script.
#
# the contents of DW_AT_comp_dir and DW_AT_name.
gdb_test "set cwd $debugdir" "" "file [file tail $binfile] cwd"
gdb_breakpoint $lineno
- with_override delete_breakpoints disable_delete_breakpoints {
- if {![runto_main]} {
- return
- }
- gdb_continue_to_breakpoint "runto breakpoint in main" \
- ".* Breakpoint here\\. .*"
+
+ # Run to main, but don't delete all breakpoints.
+ if {![runto_main no-delete-breakpoints]} {
+ return
}
+ gdb_continue_to_breakpoint "runto breakpoint in main" \
+ ".* Breakpoint here\\. .*"
+
# GDB should now find the executable file.
set enable_debuginfod_question \
"Enable debuginfod for this session. \\(y or \\\[n\\\]\\) "
# single quoted C++ function specifier.
#
# If there are additional arguments, pass them to gdb_breakpoint.
-# We recognize no-message/message ourselves.
+# We recognize no-message/message ourselves as well as no-delete-brekpoints.
#
# no-message is messed up here, like gdb_breakpoint: to preserve
# historical usage fails are always printed by default.
# no-message: turns off printing of fails (and passes, but they're already off)
# message: turns on printing of passes (and fails, but they're already on)
+#
+# The 'no-delete-brekpoints' option stops this proc from deleting all
+# breakpoints.
proc runto { linespec args } {
global gdb_prompt
global bkptno_numopt_re
global decimal
- delete_breakpoints
+ if {[lsearch -exact $args no-delete-breakpoints] == -1} {
+ delete_breakpoints
+ }
set print_pass 0
set print_fail 1
# Ask gdb to run until we hit a breakpoint at main.
#
-# N.B. This function deletes all existing breakpoints.
-# If you don't want that, use gdb_start_cmd.
+# N.B. By default this function deletes all existing breakpoints. If
+# you don't want that then pass the 'no-delete-breakpoints' argument.
-proc runto_main { } {
- return [runto main qualified]
+proc runto_main { args } {
+ return [runto main qualified {*}$args]
}
### Continue, and expect to hit a breakpoint.