aboutsummaryrefslogtreecommitdiff
path: root/gdb/guile
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/guile
parent588f5af53224053162732baa630fe3bdd8d0195e (diff)
downloadgdb-ad42014be254b402f7a44e578cc709fe9e30dc1d.zip
gdb-ad42014be254b402f7a44e578cc709fe9e30dc1d.tar.gz
gdb-ad42014be254b402f7a44e578cc709fe9e30dc1d.tar.bz2
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/guile')
-rw-r--r--gdb/guile/scm-breakpoint.c43
1 files changed, 35 insertions, 8 deletions
diff --git a/gdb/guile/scm-breakpoint.c b/gdb/guile/scm-breakpoint.c
index 3f25708..67484e4 100644
--- a/gdb/guile/scm-breakpoint.c
+++ b/gdb/guile/scm-breakpoint.c
@@ -69,6 +69,9 @@ typedef struct gdbscm_breakpoint_object
/* Non-zero if the breakpoint is an "internal" breakpoint. */
int is_internal;
+
+ /* Non-zero if the breakpoint is temporary. */
+ int is_temporary;
} spec;
/* The breakpoint number according to gdb.
@@ -103,6 +106,7 @@ static SCM pending_breakpoint_scm = SCM_BOOL_F;
static SCM type_keyword;
static SCM wp_class_keyword;
static SCM internal_keyword;
+static SCM temporary_keyword;
/* Administrivia for breakpoint smobs. */
@@ -332,7 +336,7 @@ bpscm_get_valid_breakpoint_smob_arg_unsafe (SCM self, int arg_pos,
/* Breakpoint methods. */
/* (make-breakpoint string [#:type integer] [#:wp-class integer]
- [#:internal boolean) -> <gdb:breakpoint>
+ [#:internal boolean] [#:temporary boolean]) -> <gdb:breakpoint>
The result is the <gdb:breakpoint> Scheme object.
The breakpoint is not available to be used yet, however.
@@ -342,22 +346,26 @@ static SCM
gdbscm_make_breakpoint (SCM location_scm, SCM rest)
{
const SCM keywords[] = {
- type_keyword, wp_class_keyword, internal_keyword, SCM_BOOL_F
+ type_keyword, wp_class_keyword, internal_keyword,
+ temporary_keyword, SCM_BOOL_F
};
char *s;
char *location;
- int type_arg_pos = -1, access_type_arg_pos = -1, internal_arg_pos = -1;
+ int type_arg_pos = -1, access_type_arg_pos = -1,
+ internal_arg_pos = -1, temporary_arg_pos = -1;
enum bptype type = bp_breakpoint;
enum target_hw_bp_type access_type = hw_write;
int internal = 0;
+ int temporary = 0;
SCM result;
breakpoint_smob *bp_smob;
- gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, keywords, "s#iit",
+ gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, keywords, "s#iitt",
location_scm, &location, rest,
&type_arg_pos, &type,
&access_type_arg_pos, &access_type,
- &internal_arg_pos, &internal);
+ &internal_arg_pos, &internal,
+ &temporary_arg_pos, &temporary);
result = bpscm_make_breakpoint_smob ();
bp_smob = (breakpoint_smob *) SCM_SMOB_DATA (result);
@@ -412,6 +420,7 @@ gdbscm_make_breakpoint (SCM location_scm, SCM rest)
bp_smob->spec.type = type;
bp_smob->spec.access_type = access_type;
bp_smob->spec.is_internal = internal;
+ bp_smob->spec.is_temporary = temporary;
return result;
}
@@ -447,6 +456,7 @@ gdbscm_register_breakpoint_x (SCM self)
try
{
int internal = bp_smob->spec.is_internal;
+ int temporary = bp_smob->spec.is_temporary;
switch (bp_smob->spec.type)
{
@@ -457,7 +467,7 @@ gdbscm_register_breakpoint_x (SCM self)
create_breakpoint (get_current_arch (),
eloc.get (), NULL, -1, NULL, false,
0,
- 0, bp_breakpoint,
+ temporary, bp_breakpoint,
0,
AUTO_BOOLEAN_TRUE,
ops,
@@ -1040,6 +1050,18 @@ gdbscm_breakpoint_number (SCM self)
return scm_from_long (bp_smob->number);
}
+
+/* (breakpoint-temporary? <gdb:breakpoint>) -> boolean */
+
+static SCM
+gdbscm_breakpoint_temporary (SCM self)
+{
+ breakpoint_smob *bp_smob
+ = bpscm_get_valid_breakpoint_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
+
+ return scm_from_bool (bp_smob->bp->disposition == disp_del
+ || bp_smob->bp->disposition == disp_del_at_next_stop);
+}
/* Return TRUE if "stop" has been set for this breakpoint.
@@ -1171,9 +1193,9 @@ static const scheme_function breakpoint_functions[] =
Create a GDB breakpoint object.\n\
\n\
Arguments:\n\
- location [#:type <type>] [#:wp-class <wp-class>] [#:internal <bool>]\n\
+ location [#:type <type>] [#:wp-class <wp-class>] [#:internal <bool>] [#:temporary <bool>]\n\
Returns:\n\
- <gdb:breakpoint object" },
+ <gdb:breakpoint> object" },
{ "register-breakpoint!", 1, 0, 0,
as_a_scm_t_subr (gdbscm_register_breakpoint_x),
@@ -1202,6 +1224,10 @@ Return #t if the breakpoint has not been deleted from GDB." },
"\
Return the breakpoint's number." },
+ { "breakpoint-temporary?", 1, 0, 0, as_a_scm_t_subr (gdbscm_breakpoint_temporary),
+ "\
+Return #t if the breakpoint is a temporary breakpoint." },
+
{ "breakpoint-type", 1, 0, 0, as_a_scm_t_subr (gdbscm_breakpoint_type),
"\
Return the type of the breakpoint." },
@@ -1345,4 +1371,5 @@ gdbscm_initialize_breakpoints (void)
type_keyword = scm_from_latin1_keyword ("type");
wp_class_keyword = scm_from_latin1_keyword ("wp-class");
internal_keyword = scm_from_latin1_keyword ("internal");
+ temporary_keyword = scm_from_latin1_keyword ("temporary");
}