aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorPhil Muldoon <pmuldoon@redhat.com>2013-11-07 12:04:45 +0000
committerPhil Muldoon <pmuldoon@redhat.com>2013-11-07 12:04:45 +0000
commitf76c27b5bdd446964d9920464b2f761ae7a4f62a (patch)
treec0cd5e6ac770344136b01613ddd756710393a27a /gdb/testsuite
parentd52cd232cb3a7a9f6e6857110d9119c1675d2d32 (diff)
downloadgdb-f76c27b5bdd446964d9920464b2f761ae7a4f62a.zip
gdb-f76c27b5bdd446964d9920464b2f761ae7a4f62a.tar.gz
gdb-f76c27b5bdd446964d9920464b2f761ae7a4f62a.tar.bz2
2013-11-07 Phil Muldoon <pmuldoon@redhat.com>
* python/py-breakpoint.c (bppy_get_temporary): New function. (bppy_init): New keyword: temporary. Parse it and set breakpoint to temporary if True. 2013-11-07 Phil Muldoon <pmuldoon@redhat.com> * gdb.python/py-breakpoint.exp: Add temporary breakpoint tests. 2013-11-07 Phil Muldoon <pmuldoon@redhat.com> * gdb.texinfo (Breakpoints In Python): Document temporary option in breakpoint constructor, and add documentation to the temporary attribute.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/ChangeLog4
-rw-r--r--gdb/testsuite/gdb.python/py-breakpoint.exp34
2 files changed, 38 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 40ff298..11ca125 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2013-11-07 Phil Muldoon <pmuldoon@redhat.com>
+
+ * gdb.python/py-breakpoint.exp: Add temporary breakpoint tests.
+
2013-11-06 Doug Evans <dje@sebabeach.org>
* gdb.python/py-arch.exp: Tweak test name for bad memory access test.
diff --git a/gdb/testsuite/gdb.python/py-breakpoint.exp b/gdb/testsuite/gdb.python/py-breakpoint.exp
index 687182d..e2a169b 100644
--- a/gdb/testsuite/gdb.python/py-breakpoint.exp
+++ b/gdb/testsuite/gdb.python/py-breakpoint.exp
@@ -300,3 +300,37 @@ gdb_py_test_silent_cmd "python wp1 = wp_eval (\"result\", type=gdb.BP_WATCHPOIN
gdb_test "continue" ".*\[Ww\]atchpoint.*result.*Old value =.*New value = 788.*" "Test watchpoint write"
gdb_test "python print (never_eval_bp1.count)" "0" \
"Check that this unrelated breakpoints eval function was never called."
+
+# Test temporary breakpoint
+
+# Start with a fresh gdb.
+clean_restart ${testfile}
+
+if ![runto_main] then {
+ fail "Cannot run to main."
+ return 0
+}
+delete_breakpoints
+gdb_py_test_multiple "Sub-class and check temporary breakpoint" \
+ "python" "" \
+ "class temp_bp (gdb.Breakpoint):" "" \
+ " count = 0" "" \
+ " def stop (self):" "" \
+ " self.count = self.count + 1" "" \
+ " return True" "" \
+ "end" ""
+gdb_py_test_silent_cmd "python ibp = temp_bp(\"$ibp_location\", temporary=True)" \
+ "Set temporary breakpoint" 0
+gdb_test "info breakpoints" "2.*breakpoint.*del.*py-breakpoint\.c:$ibp_location.*" \
+ "Check info breakpoints shows breakpoint with temporary status"
+gdb_test "python print (ibp.location)" "py-breakpoint\.c:$ibp_location*" \
+ "Check temporary breakpoint location"
+gdb_test "python print (ibp.temporary)" "True" \
+ "Check breakpoint temporary status"
+gdb_continue_to_breakpoint "Break at multiply." ".*/$srcfile:$ibp_location.*"
+gdb_test "python print (ibp.count)" "1" \
+ "Check temporary stop callback executed before deletion."
+gdb_test "python print (ibp.temporary)" "RuntimeError: Breakpoint 2 is invalid.*" \
+ "Check temporary breakpoint is deleted after being hit"
+gdb_test "info breakpoints" "No breakpoints or watchpoints.*" \
+ "Check info breakpoints shows temporary breakpoint is deleted"