From fed1c982dec3baba167b3fd4df3538f09fa3d339 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sun, 1 May 2022 16:11:26 -0600 Subject: Introduce catchpoint class This introduces a catchpoint class that is used as the base class for all catchpoints. init_catchpoint is rewritten to be a constructor instead. This changes the hierarchy a little -- some catchpoints now inherit from base_breakpoint whereas previously they did not. This isn't a problem, as long as re_set is redefined in catchpoint. --- gdb/break-catch-load.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'gdb/break-catch-load.c') diff --git a/gdb/break-catch-load.c b/gdb/break-catch-load.c index 8579f4e..617ee2b 100644 --- a/gdb/break-catch-load.c +++ b/gdb/break-catch-load.c @@ -33,10 +33,12 @@ 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 @@ -229,11 +231,10 @@ add_solib_catchpoint (const char *arg, bool is_load, bool is_temp, bool enabled) if (*arg == '\0') arg = nullptr; - std::unique_ptr c (new solib_catchpoint (gdbarch, + std::unique_ptr 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); -- cgit v1.1