+ bp_smob = (breakpoint_smob *) SCM_SMOB_DATA (result);
+
+ s = location;
+ location = gdbscm_gc_xstrdup (s);
+ xfree (s);
+
+ switch (type)
+ {
+ case bp_breakpoint:
+ if (access_type_arg_pos > 0)
+ {
+ gdbscm_misc_error (FUNC_NAME, access_type_arg_pos,
+ scm_from_int (access_type),
+ _("access type with breakpoint is not allowed"));
+ }
+ break;
+ case bp_watchpoint:
+ switch (access_type)
+ {
+ case hw_write:
+ case hw_access:
+ case hw_read:
+ break;
+ default:
+ gdbscm_out_of_range_error (FUNC_NAME, access_type_arg_pos,
+ scm_from_int (access_type),
+ _("invalid watchpoint class"));
+ }
+ break;
+ default:
+ gdbscm_out_of_range_error (FUNC_NAME, access_type_arg_pos,
+ scm_from_int (type),
+ _("invalid breakpoint type"));
+ }
+
+ bp_smob->is_scheme_bkpt = 1;
+ bp_smob->spec.location = location;
+ bp_smob->spec.type = type;
+ bp_smob->spec.access_type = access_type;
+ bp_smob->spec.is_internal = internal;
+
+ return result;
+}
+
+/* (register-breakpoint! <gdb:breakpoint>) -> unspecified
+
+ It is an error to register a breakpoint created outside of Guile,
+ or an already-registered breakpoint. */
+
+static SCM
+gdbscm_register_breakpoint_x (SCM self)
+{
+ breakpoint_smob *bp_smob
+ = bpscm_get_breakpoint_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
+ volatile struct gdb_exception except;
+
+ /* We only support registering breakpoints created with make-breakpoint. */
+ if (!bp_smob->is_scheme_bkpt)
+ scm_misc_error (FUNC_NAME, _("not a Scheme breakpoint"), SCM_EOL);
+
+ if (bpscm_is_valid (bp_smob))
+ scm_misc_error (FUNC_NAME, _("breakpoint is already registered"), SCM_EOL);
+
+ pending_breakpoint_scm = self;