diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 583f46d852..0e3f6d954a 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -244,7 +244,7 @@ static struct breakpoint_ops momentary_breakpoint_ops;
struct breakpoint_ops bkpt_breakpoint_ops;
/* Breakpoints set on probes. */
-static struct breakpoint_ops bkpt_probe_breakpoint_ops;
+struct breakpoint_ops bkpt_probe_breakpoint_ops;
/* Dynamic printf class type. */
struct breakpoint_ops dprintf_breakpoint_ops;
diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h
index a9d689d02a..47ca1174ab 100644
--- a/gdb/breakpoint.h
+++ b/gdb/breakpoint.h
@@ -1307,6 +1307,7 @@ extern void tbreak_command (const char *, int);
extern struct breakpoint_ops base_breakpoint_ops;
extern struct breakpoint_ops bkpt_breakpoint_ops;
extern struct breakpoint_ops tracepoint_breakpoint_ops;
+extern struct breakpoint_ops bkpt_probe_breakpoint_ops;
extern struct breakpoint_ops dprintf_breakpoint_ops;
extern void initialize_breakpoint_ops (void);
diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c
index 4170737416..ddd8eeecae 100644
--- a/gdb/python/py-breakpoint.c
+++ b/gdb/python/py-breakpoint.c
@@ -834,7 +834,10 @@ bppy_init (PyObject *self, PyObject *args, PyObject *kwargs)
temporary_bp, bp_breakpoint,
0,
AUTO_BOOLEAN_TRUE,
- &bkpt_breakpoint_ops,
+ (event_location_type (location.get ())
+ == PROBE_LOCATION
+ ? &bkpt_probe_breakpoint_ops
+ : &bkpt_breakpoint_ops),
0, 1, internal_bp, 0);
break;
}
diff --git a/gdb/testsuite/gdb.python/py-breakpoint.c b/gdb/testsuite/gdb.python/py-breakpoint.c
index d102a5f306..bf5bec1200 100644
--- a/gdb/testsuite/gdb.python/py-breakpoint.c
+++ b/gdb/testsuite/gdb.python/py-breakpoint.c
@@ -15,6 +15,10 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#ifdef USE_PROBES
+#include
+#endif
+
int result = 0;
namespace foo_ns
@@ -46,6 +50,9 @@ int main (int argc, char *argv[])
{
result += multiply (foo); /* Break at multiply. */
result += add (bar); /* Break at add. */
+#ifdef USE_PROBES
+ STAP_PROBE1 (test, result_updated, result);
+#endif
}
return 0; /* Break at end. */
diff --git a/gdb/testsuite/gdb.python/py-breakpoint.exp b/gdb/testsuite/gdb.python/py-breakpoint.exp
index 625977c0ad..9e3cb475af 100644
--- a/gdb/testsuite/gdb.python/py-breakpoint.exp
+++ b/gdb/testsuite/gdb.python/py-breakpoint.exp
@@ -695,6 +695,27 @@ proc_with_prefix test_bkpt_qualified {} {
"-q in spec string and qualified false"
}
+proc_with_prefix test_bkpt_probe {} {
+ global decimal hex testfile srcfile
+
+ if { [prepare_for_testing "failed to prepare" ${testfile}-probes \
+ ${srcfile} {debug c++ additional_flags=-DUSE_PROBES}] } {
+ untested "breakpoint probe test failed"
+ return -1
+ }
+
+ if ![runto_main] then {
+ fail "cannot run to main."
+ return 0
+ }
+
+ delete_breakpoints
+ gdb_test \
+ "python gdb.Breakpoint(\"-probe test:result_updated\")" \
+ "Breakpoint $decimal at $hex" \
+ "-probe in spec string"
+}
+
test_bkpt_basic
test_bkpt_deletion
test_bkpt_cond_and_cmds
@@ -708,3 +729,4 @@ test_bkpt_pending
test_bkpt_events
test_bkpt_explicit_loc
test_bkpt_qualified
+test_bkpt_probe