A breakpoint is really of this type iff its ops pointer points to
CATCH_EXEC_BREAKPOINT_OPS. */
-struct exec_catchpoint : public breakpoint
+struct exec_catchpoint : public catchpoint
{
- explicit exec_catchpoint (struct gdbarch *gdbarch)
- : breakpoint (gdbarch, bp_catchpoint)
+ exec_catchpoint (struct gdbarch *gdbarch, bool temp, const char *cond_string)
+ : catchpoint (gdbarch, temp, cond_string)
{
}
if ((*arg != '\0') && !isspace (*arg))
error (_("Junk at end of arguments."));
- std::unique_ptr<exec_catchpoint> c (new exec_catchpoint (gdbarch));
- init_catchpoint (c.get (), gdbarch, temp, cond_string);
+ std::unique_ptr<exec_catchpoint> c
+ (new exec_catchpoint (gdbarch, temp, cond_string));
install_breakpoint (0, std::move (c), 1);
}
catchpoint. A breakpoint is really of this type iff its ops pointer points
to CATCH_FORK_BREAKPOINT_OPS. */
-struct fork_catchpoint : public breakpoint
+struct fork_catchpoint : public catchpoint
{
- fork_catchpoint (struct gdbarch *gdbarch, bool is_vfork_)
- : breakpoint (gdbarch, bp_catchpoint),
+ fork_catchpoint (struct gdbarch *gdbarch, bool temp,
+ const char *cond_string, bool is_vfork_)
+ : catchpoint (gdbarch, temp, cond_string),
is_vfork (is_vfork_)
{
}
bool temp, const char *cond_string,
bool is_vfork)
{
- std::unique_ptr<fork_catchpoint> c (new fork_catchpoint (gdbarch,
- is_vfork));
-
- init_catchpoint (c.get (), gdbarch, temp, cond_string);
+ std::unique_ptr<fork_catchpoint> c
+ (new fork_catchpoint (gdbarch, temp, cond_string, is_vfork));
install_breakpoint (0, std::move (c), 1);
}
A breakpoint is really of this type iff its ops pointer points to
CATCH_SOLIB_BREAKPOINT_OPS. */
-struct solib_catchpoint : public breakpoint
+struct solib_catchpoint : public catchpoint
{
- solib_catchpoint (struct gdbarch *gdbarch, bool is_load_, const char *arg)
- : breakpoint (gdbarch, bp_catchpoint),
+ solib_catchpoint (struct gdbarch *gdbarch, bool temp,
+ const char *cond_string,
+ bool is_load_, const char *arg)
+ : catchpoint (gdbarch, temp, cond_string),
is_load (is_load_),
regex (arg == nullptr ? nullptr : make_unique_xstrdup (arg)),
compiled (arg == nullptr
if (*arg == '\0')
arg = nullptr;
- std::unique_ptr<solib_catchpoint> c (new solib_catchpoint (gdbarch,
+ std::unique_ptr<solib_catchpoint> c (new solib_catchpoint (gdbarch, is_temp,
+ nullptr,
is_load, arg));
- init_catchpoint (c.get (), gdbarch, is_temp, NULL);
-
c->enable_state = enabled ? bp_enabled : bp_disabled;
install_breakpoint (0, std::move (c), 1);
/* An instance of this type is used to represent a signal
catchpoint. */
-struct signal_catchpoint : public breakpoint
+struct signal_catchpoint : public catchpoint
{
- signal_catchpoint (struct gdbarch *gdbarch, std::vector<gdb_signal> &&sigs,
+ signal_catchpoint (struct gdbarch *gdbarch, bool temp,
+ std::vector<gdb_signal> &&sigs,
bool catch_all_)
- : breakpoint (gdbarch, bp_catchpoint),
+ : catchpoint (gdbarch, temp, nullptr),
signals_to_be_caught (std::move (sigs)),
catch_all (catch_all_)
{
struct gdbarch *gdbarch = get_current_arch ();
std::unique_ptr<signal_catchpoint> c
- (new signal_catchpoint (gdbarch, std::move (filter), catch_all));
- init_catchpoint (c.get (), gdbarch, tempflag, nullptr);
+ (new signal_catchpoint (gdbarch, tempflag, std::move (filter), catch_all));
install_breakpoint (0, std::move (c), 1);
}
std::unique_ptr<syscall_catchpoint> c
(new syscall_catchpoint (gdbarch, std::move (filter)));
- init_catchpoint (c.get (), gdbarch, tempflag, nullptr);
install_breakpoint (0, std::move (c), 1);
}
/* The type of an exception catchpoint. */
-struct exception_catchpoint : public base_breakpoint
+struct exception_catchpoint : public catchpoint
{
exception_catchpoint (struct gdbarch *gdbarch,
+ bool temp, const char *cond_string,
enum exception_event_kind kind_,
std::string &&except_rx)
- : base_breakpoint (gdbarch, bp_catchpoint),
+ : catchpoint (gdbarch, temp, cond_string),
kind (kind_),
exception_rx (std::move (except_rx)),
pattern (exception_rx.empty ()
struct gdbarch *gdbarch = get_current_arch ();
std::unique_ptr<exception_catchpoint> cp
- (new exception_catchpoint (gdbarch, ex_event, std::move (except_rx)));
-
- init_catchpoint (cp.get (), gdbarch, tempflag, cond_string);
+ (new exception_catchpoint (gdbarch, tempflag, cond_string,
+ ex_event, std::move (except_rx)));
cp->re_set ();
/* See breakpoint.h. */
-void
-init_catchpoint (struct breakpoint *b,
- struct gdbarch *gdbarch, bool temp,
- const char *cond_string)
+catchpoint::catchpoint (struct gdbarch *gdbarch, bool temp,
+ const char *cond_string_)
+ : base_breakpoint (gdbarch, bp_catchpoint)
{
symtab_and_line sal;
sal.pspace = current_program_space;
- /* This should already have been set in the constructor. */
- gdb_assert (b->type == bp_catchpoint);
- init_raw_breakpoint (b, sal, bp_catchpoint);
+ init_raw_breakpoint (this, sal, bp_catchpoint);
- if (cond_string == nullptr)
- b->cond_string.reset ();
- else
- b->cond_string = make_unique_xstrdup (cond_string);
- b->disposition = temp ? disp_del : disp_donttouch;
+ if (cond_string_ != nullptr)
+ cond_string = make_unique_xstrdup (cond_string_);
+ disposition = temp ? disp_del : disp_donttouch;
}
void
int static_trace_marker_id_idx = 0;
};
+/* The base class for catchpoints. */
+
+struct catchpoint : public base_breakpoint
+{
+ /* If TEMP is true, then make the breakpoint temporary. If
+ COND_STRING is not NULL, then store it in the breakpoint. */
+ catchpoint (struct gdbarch *gdbarch, bool temp, const char *cond_string);
+
+ void re_set () override
+ {
+ /* For catchpoints, the default is to do nothing. */
+ }
+};
+
\f
/* The following stuff is an abstract data type "bpstat" ("breakpoint
status"). This provides the ability to determine whether we have
int enabled,
int from_tty);
-/* Initialize a new breakpoint of the bp_catchpoint kind. If TEMP
- is true, then make the breakpoint temporary. If COND_STRING is
- not NULL, then store it in the breakpoint. */
-
-extern void init_catchpoint (struct breakpoint *b,
- struct gdbarch *gdbarch, bool temp,
- const char *cond_string);
-
/* Add breakpoint B on the breakpoint list, and notify the user, the
target and breakpoint_created observers of its existence. If
INTERNAL is non-zero, the breakpoint number will be allocated from