[binutils-gdb] gdb/guile: allow for catchpoint type breakpoints in guile
Andrew Burgess
aburgess@sourceware.org
Fri Jun 25 17:24:48 GMT 2021
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=08080f9744094772e935204a9d59a101da83a801
commit 08080f9744094772e935204a9d59a101da83a801
Author: Andrew Burgess <andrew.burgess@embecosm.com>
Date: Wed May 5 16:53:09 2021 +0100
gdb/guile: allow for catchpoint type breakpoints in guile
This commit adds initial support for catchpoints to the guile
breakpoint API.
This commit adds a BP_CATCHPOINT constant which corresponds to
GDB's internal bp_catchpoint. The new constant is documented in the
manual.
The user can't create breakpoints with type BP_CATCHPOINT after this
commit, but breakpoints that already exist, obtained with
the (breakpoints) function, can now have this type.
gdb/ChangeLog:
* guile/scm-breakpoint.c (bpscm_type_to_string): Handle
bp_catchpoint.
(bpscm_want_scm_wrapper_p): Likewise.
(gdbscm_make_breakpoint): Likewise.
(breakpoint_integer_constants): Likewise.
gdb/doc/ChangeLog:
* guile.texinfo (Breakpoints In Guile): Add BP_CATCHPOINT
description.
gdb/testsuite/ChangeLog:
* gdb.guile/scm-breakpoint.exp (test_catchpoints): New proc.
Diff:
---
gdb/ChangeLog | 8 +++++++
gdb/doc/ChangeLog | 5 ++++
gdb/doc/guile.texi | 4 ++++
gdb/guile/scm-breakpoint.c | 6 ++++-
gdb/testsuite/ChangeLog | 4 ++++
gdb/testsuite/gdb.guile/scm-breakpoint.exp | 37 ++++++++++++++++++++++++++++++
6 files changed, 63 insertions(+), 1 deletion(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 80ccc9f4c85..b610f75d226 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,11 @@
+2021-06-25 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * guile/scm-breakpoint.c (bpscm_type_to_string): Handle
+ bp_catchpoint.
+ (bpscm_want_scm_wrapper_p): Likewise.
+ (gdbscm_make_breakpoint): Likewise.
+ (breakpoint_integer_constants): Likewise.
+
2021-06-25 Andrew Burgess <andrew.burgess@embecosm.com>
* guile/scm-breakpoint.c (gdbscm_make_breakpoint): Split the error
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index ad0b2e7c78f..1f197838a59 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -1,3 +1,8 @@
+2021-06-25 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * guile.texinfo (Breakpoints In Guile): Add BP_CATCHPOINT
+ description.
+
2021-06-21 Andrew Burgess <andrew.burgess@embecosm.com>
* gdb.texinfo (RISC-V Features): Mention vector register feature.
diff --git a/gdb/doc/guile.texi b/gdb/doc/guile.texi
index c7e43c8d63a..36fc9a7af79 100644
--- a/gdb/doc/guile.texi
+++ b/gdb/doc/guile.texi
@@ -3019,6 +3019,10 @@ This value cannot be specified when creating the breakpoint.
@item BP_ACCESS_WATCHPOINT
Hardware assisted access watchpoint.
This value cannot be specified when creating the breakpoint.
+
+@item BP_CATCHPOINT
+Catchpoint.
+This value cannot be specified when creating the breakpoint.
@end vtable
The available watchpoint types are represented by constants defined in the
diff --git a/gdb/guile/scm-breakpoint.c b/gdb/guile/scm-breakpoint.c
index 346b00629b0..3f25708afff 100644
--- a/gdb/guile/scm-breakpoint.c
+++ b/gdb/guile/scm-breakpoint.c
@@ -138,6 +138,7 @@ bpscm_type_to_string (enum bptype type)
case bp_hardware_watchpoint: return "BP_HARDWARE_WATCHPOINT";
case bp_read_watchpoint: return "BP_READ_WATCHPOINT";
case bp_access_watchpoint: return "BP_ACCESS_WATCHPOINT";
+ case bp_catchpoint: return "BP_CATCHPOINT";
default: return "internal/other";
}
}
@@ -233,7 +234,8 @@ bpscm_want_scm_wrapper_p (struct breakpoint *bp, int from_scheme)
&& bp->type != bp_watchpoint
&& bp->type != bp_hardware_watchpoint
&& bp->type != bp_read_watchpoint
- && bp->type != bp_access_watchpoint)
+ && bp->type != bp_access_watchpoint
+ && bp->type != bp_catchpoint)
return 0;
return 1;
@@ -391,6 +393,7 @@ gdbscm_make_breakpoint (SCM location_scm, SCM rest)
case bp_hardware_watchpoint:
case bp_read_watchpoint:
case bp_access_watchpoint:
+ case bp_catchpoint:
{
const char *type_name = bpscm_type_to_string (type);
gdbscm_misc_error (FUNC_NAME, type_arg_pos,
@@ -1152,6 +1155,7 @@ static const scheme_integer_constant breakpoint_integer_constants[] =
{ "BP_HARDWARE_WATCHPOINT", bp_hardware_watchpoint },
{ "BP_READ_WATCHPOINT", bp_read_watchpoint },
{ "BP_ACCESS_WATCHPOINT", bp_access_watchpoint },
+ { "BP_CATCHPOINT", bp_catchpoint },
{ "WP_READ", hw_read },
{ "WP_WRITE", hw_write },
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 330e7c84f1a..30db2611d1e 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2021-06-25 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * gdb.guile/scm-breakpoint.exp (test_catchpoints): New proc.
+
2021-06-25 Andrew Burgess <andrew.burgess@embecosm.com>
* gdb.guile/scm-breakpoint.exp (test_watchpoints): Add new tests.
diff --git a/gdb/testsuite/gdb.guile/scm-breakpoint.exp b/gdb/testsuite/gdb.guile/scm-breakpoint.exp
index 0e9e64ed4ae..c603af76a33 100644
--- a/gdb/testsuite/gdb.guile/scm-breakpoint.exp
+++ b/gdb/testsuite/gdb.guile/scm-breakpoint.exp
@@ -519,10 +519,47 @@ proc_with_prefix test_bkpt_probe {} {
"register probe breakpoint"
}
+proc_with_prefix test_catchpoints {} {
+ global srcfile testfile
+ global gdb_prompt decimal
+
+ # Start with a fresh gdb.
+ clean_restart ${testfile}
+
+ if ![gdb_guile_runto_main] {
+ return
+ }
+
+ # Try to create a catchpoint, currently this isn't supported via
+ # the guile api.
+ gdb_test "guile (define cp (make-breakpoint \"syscall\" #:type BP_CATCHPOINT))" \
+ "ERROR: In procedure gdbscm_make_breakpoint: unsupported breakpoint type in position 3: \"BP_CATCHPOINT\"\r\n.*" \
+ "create a catchpoint via the api"
+
+ # Setup a catchpoint.
+ set num "XXX"
+ gdb_test_multiple "catch syscall" "" {
+ -re "The feature \'catch syscall\' is not supported.*\r\n$gdb_prompt $" {
+ unsupported "catch syscall isn't supported"
+ return -1
+ }
+ -re "Catchpoint ($decimal) \\(any syscall\\)\r\n$gdb_prompt $" {
+ set num $expect_out(1,string)
+ pass $gdb_test_name
+ }
+ }
+
+ # Look for the catchpoint in the breakpoint list.
+ gdb_test "guile (for-each (lambda (b) (if (= (breakpoint-type b) BP_CATCHPOINT) (begin (display b) (newline)))) (breakpoints))" \
+ "#<gdb:breakpoint #${num} BP_CATCHPOINT enabled noisy hit:0 ignore:0>" \
+ "look for BP_CATCHPOINT in breakpoint list"
+}
+
test_bkpt_basic
test_bkpt_deletion
test_bkpt_cond_and_cmds
test_bkpt_invisible
+test_catchpoints
test_watchpoints
test_bkpt_internal
test_bkpt_eval_funcs
More information about the Gdb-cvs
mailing list