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; TRY_CATCH (except, RETURN_MASK_ALL) { char *location = bp_smob->spec.location; int internal = bp_smob->spec.is_internal; switch (bp_smob->spec.type) { case bp_breakpoint: { create_breakpoint (get_current_arch (), location, NULL, -1, NULL, 0, 0, bp_breakpoint, 0, AUTO_BOOLEAN_TRUE, &bkpt_breakpoint_ops, 0, 1, internal, 0); break; } case bp_watchpoint: { enum target_hw_bp_type access_type = bp_smob->spec.access_type; if (access_type == hw_write) watch_command_wrapper (location, 0, internal); else if (access_type == hw_access) awatch_command_wrapper (location, 0, internal); else if (access_type == hw_read) rwatch_command_wrapper (location, 0, internal); else gdb_assert_not_reached ("invalid access type"); break; } default: gdb_assert_not_reached ("invalid breakpoint type"); } }
static breakpoint_smob * bpscm_get_valid_breakpoint_smob_arg_unsafe (SCM self, int arg_pos, const char *func_name) { breakpoint_smob *bp_smob = bpscm_get_breakpoint_smob_arg_unsafe (self, arg_pos, func_name); if (!bpscm_is_valid (bp_smob)) { gdbscm_invalid_object_error (func_name, arg_pos, self, _("<gdb:breakpoint>")); } return bp_smob; }
static SCM gdbscm_register_breakpoint_x (SCM self) { breakpoint_smob *bp_smob = bpscm_get_breakpoint_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME); struct gdb_exception except = exception_none; char *location, *copy; struct event_location *eloc; struct cleanup *cleanup; /* 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; location = bp_smob->spec.location; copy = location; eloc = new_linespec_location (©); cleanup = make_cleanup_delete_event_location (eloc); TRY { int internal = bp_smob->spec.is_internal; switch (bp_smob->spec.type) { case bp_breakpoint: { create_breakpoint (get_current_arch (), eloc, NULL, -1, NULL, 0, 0, bp_breakpoint, 0, AUTO_BOOLEAN_TRUE, &bkpt_breakpoint_ops, 0, 1, internal, 0); break; } case bp_watchpoint: { enum target_hw_bp_type access_type = bp_smob->spec.access_type; if (access_type == hw_write) watch_command_wrapper (location, 0, internal); else if (access_type == hw_access) awatch_command_wrapper (location, 0, internal); else if (access_type == hw_read) rwatch_command_wrapper (location, 0, internal); else gdb_assert_not_reached ("invalid access type"); break; } default: gdb_assert_not_reached ("invalid breakpoint type"); } } CATCH (ex, RETURN_MASK_ALL) { except = ex; } END_CATCH /* Ensure this gets reset, even if there's an error. */ pending_breakpoint_scm = SCM_BOOL_F; GDBSCM_HANDLE_GDB_EXCEPTION (except); do_cleanups (cleanup); return SCM_UNSPECIFIED; }