+2019-02-15 Philippe Waroquiers <philippe.waroquiers@skynet.be>
+ Tom Tromey <tromey@adacore.com>
+
+ * breakpoint.c (~bp_location): Rename from bp_location_dtor.
+ (bp_location_ops): Remove.
+ (base_breakpoint_allocate_location): Update.
+ (free_bp_location): Update.
+ * ada-lang.c (class ada_catchpoint_location)
+ <ada_catchpoint_location>: Remove ops parameter.
+ (ada_catchpoint_location_dtor): Remove.
+ (ada_catchpoint_location_ops): Remove.
+ (allocate_location_exception): Update.
+ * breakpoint.h (struct bp_location_ops): Remove.
+ (class bp_location) <bp_location>: Remove bp_location_ops
+ parameter.
+ <~bp_location>: Add destructor.
+ <ops>: Remove.
+
2019-02-14 Thomas Schwinge <thomas@codesourcery.com>
Pedro Alves <palves@redhat.com>
class ada_catchpoint_location : public bp_location
{
public:
- ada_catchpoint_location (const bp_location_ops *ops, breakpoint *owner)
- : bp_location (ops, owner)
+ ada_catchpoint_location (breakpoint *owner)
+ : bp_location (owner)
{}
/* The condition that checks whether the exception that was raised
expression_up excep_cond_expr;
};
-/* Implement the DTOR method in the bp_location_ops structure for all
- Ada exception catchpoint kinds. */
-
-static void
-ada_catchpoint_location_dtor (struct bp_location *bl)
-{
- struct ada_catchpoint_location *al = (struct ada_catchpoint_location *) bl;
-
- al->excep_cond_expr.reset ();
-}
-
-/* The vtable to be used in Ada catchpoint locations. */
-
-static const struct bp_location_ops ada_catchpoint_location_ops =
-{
- ada_catchpoint_location_dtor
-};
-
/* An instance of this type is used to represent an Ada catchpoint. */
struct ada_catchpoint : public breakpoint
allocate_location_exception (enum ada_exception_catchpoint_kind ex,
struct breakpoint *self)
{
- return new ada_catchpoint_location (&ada_catchpoint_location_ops, self);
+ return new ada_catchpoint_location (self);
}
/* Implement the RE_SET method in the breakpoint_ops structure for all
}
}
-bp_location::bp_location (const bp_location_ops *ops, breakpoint *owner)
+bp_location::bp_location (breakpoint *owner)
{
bp_location *loc = this;
- gdb_assert (ops != NULL);
-
- loc->ops = ops;
loc->owner = owner;
loc->cond_bytecode = NULL;
loc->shlib_disabled = 0;
static void
free_bp_location (struct bp_location *loc)
{
- loc->ops->dtor (loc);
delete loc;
}
}
}
-/* Default bp_location_ops methods. */
-
-static void
-bp_location_dtor (struct bp_location *self)
+bp_location::~bp_location ()
{
- xfree (self->function_name);
+ xfree (function_name);
}
-static const struct bp_location_ops bp_location_ops =
-{
- bp_location_dtor
-};
-
/* Destructor for the breakpoint base class. */
breakpoint::~breakpoint ()
static struct bp_location *
base_breakpoint_allocate_location (struct breakpoint *self)
{
- return new bp_location (&bp_location_ops, self);
+ return new bp_location (self);
}
static void
bp_loc_other /* Miscellaneous... */
};
-/* This structure is a collection of function pointers that, if
- available, will be called instead of performing the default action
- for this bp_loc_type. */
-
-struct bp_location_ops
-{
- /* Destructor. Releases everything from SELF (but not SELF
- itself). */
- void (*dtor) (struct bp_location *self);
-};
-
class bp_location
{
public:
bp_location () = default;
- bp_location (const bp_location_ops *ops, breakpoint *owner);
+ bp_location (breakpoint *owner);
+
+ virtual ~bp_location ();
/* Chain pointer to the next breakpoint location for
the same parent breakpoint. */
bp_location *next = NULL;
- /* Methods associated with this location. */
- const bp_location_ops *ops = NULL;
-
/* The reference count. */
int refc = 0;