summaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.guile/scm-breakpoint.exp
diff options
context:
space:
mode:
authorGeorge Barrett <bob@bob131.so>2021-06-09 23:56:11 +1000
committerSimon Marchi <simon.marchi@polymtl.ca>2021-07-28 20:30:24 -0400
commitad42014be254b402f7a44e578cc709fe9e30dc1d (patch)
treec5074628919b7ddd2c1ef6162deb54d6cd627222 /gdb/testsuite/gdb.guile/scm-breakpoint.exp
parent588f5af53224053162732baa630fe3bdd8d0195e (diff)
downloadbinutils-gdb-ad42014be254b402f7a44e578cc709fe9e30dc1d.tar.gz
Guile: temporary breakpoints
Adds API to the Guile bindings for creating temporary breakpoints and querying whether an existing breakpoint object is temporary. This is effectively a transliteration of the Python implementation. It's worth noting that the added `is_temporary' flag is ignored in the watchpoint registration path. This replicates the behaviour of the Python implementation, but might be a bit surprising for users. gdb/ChangeLog: 2021-06-09 George Barrett <bob@bob131.so> * guile/scm-breakpoint.c (gdbscm_breakpoint_object::spec): Add is_temporary field. (temporary_keyword): Add keyword object for make-breakpoint argument parsing. (gdbscm_make_breakpoint): Accept #:temporary keyword argument and store the value in the allocated object's spec.is_temporary. (gdbscm_register_breakpoint_x): Pass the breakpoint's spec.is_temporary value to create_breakpoint. (gdbscm_breakpoint_temporary): Add breakpoint-temporary? procedure implementation. (breakpoint_functions::make-breakpoint): Update documentation string and fix a typo. (breakpoint_functions::breakpoint-temporary?): Add breakpoint-temporary? procedure. (gdbscm_initialize_breakpoints): Initialise temporary_keyword variable. NEWS (Guile API): Mention new temporary breakpoints API. gdb/doc/ChangeLog: 2021-06-09 George Barrett <bob@bob131.so> * guile.texi (Breakpoints In Guile): Update make-breakpoint documentation to reflect new #:temporary argument. Add documentation for new breakpoint-temporary? procedure. gdb/testsuite/ChangeLog: 2021-06-09 George Barrett <bob@bob131.so> * gdb.guile/scm-breakpoint.exp: Add additional tests for temporary breakpoints. Change-Id: I2de332ee7c256f5591d7141ab3ad50d31b871d17
Diffstat (limited to 'gdb/testsuite/gdb.guile/scm-breakpoint.exp')
-rw-r--r--gdb/testsuite/gdb.guile/scm-breakpoint.exp33
1 files changed, 33 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.guile/scm-breakpoint.exp b/gdb/testsuite/gdb.guile/scm-breakpoint.exp
index be898cacaa7..c5f19e154d7 100644
--- a/gdb/testsuite/gdb.guile/scm-breakpoint.exp
+++ b/gdb/testsuite/gdb.guile/scm-breakpoint.exp
@@ -485,6 +485,38 @@ proc_with_prefix test_bkpt_registration {} {
"= #t" "breakpoint valid after re-registration"
}
+proc_with_prefix test_bkpt_temporary { } {
+ global srcfile testfile hex decimal
+
+ # Start with a fresh gdb.
+ clean_restart ${testfile}
+
+ if ![gdb_guile_runto_main] {
+ fail "cannot run to main."
+ return 0
+ }
+ delete_breakpoints
+
+ set ibp_location [gdb_get_line_number "Break at multiply."]
+ gdb_scm_test_silent_cmd "guile (define ibp (make-breakpoint \"$ibp_location\" #:temporary #t))" \
+ "create temporary breakpoint"
+ gdb_scm_test_silent_cmd "guile (register-breakpoint! ibp)" \
+ "register ibp"
+ gdb_test "info breakpoints" \
+ "2.*breakpoint.*del.*scm-breakpoint\.c:$ibp_location.*" \
+ "check info breakpoints shows breakpoint with temporary status"
+ gdb_test "guile (print (breakpoint-location ibp))" "scm-breakpoint\.c:$ibp_location*" \
+ "check temporary breakpoint location"
+ gdb_test "guile (print (breakpoint-temporary? ibp))" "#t" \
+ "check breakpoint temporary status"
+ gdb_continue_to_breakpoint "Break at multiply." \
+ ".*$srcfile:$ibp_location.*"
+ gdb_test "guile (print (breakpoint-temporary? ibp))" "Invalid object: <gdb:breakpoint>.*" \
+ "check temporary breakpoint is deleted after being hit"
+ gdb_test "info breakpoints" "No breakpoints or watchpoints.*" \
+ "check info breakpoints shows temporary breakpoint is deleted"
+}
+
proc_with_prefix test_bkpt_address {} {
global decimal srcfile
@@ -564,5 +596,6 @@ test_watchpoints
test_bkpt_internal
test_bkpt_eval_funcs
test_bkpt_registration
+test_bkpt_temporary
test_bkpt_address
test_bkpt_probe