+2017-06-02 Simon Marchi <simon.marchi@polymtl.ca>
+
+ * breakpoint.h (struct breakpoint_ops) <dtor>: Remove.
+ (struct breakpoint) <~breakpoint>: New.
+ (struct watchpoint): Inherit from breakpoint.
+ <~watchpoint>: New.
+ <base>: Remove.
+ (struct tracepoint): Inherit from breakpoint.
+ <base>: Remove.
+ * breakpoint.c (longjmp_breakpoint_ops): Remove.
+ (struct longjmp_breakpoint): Inherit from breakpoint.
+ <~longjmp_breakpoint>: New.
+ <base>: Remove.
+ (new_breakpoint_from_type): Remove casts.
+ (watchpoint_in_thread_scope): Remove reference to base field.
+ (watchpoint_del_at_next_stop): Likewise.
+ (update_watchpoint): Likewise.
+ (watchpoint_check): Likewise.
+ (bpstat_check_watchpoint): Likewise.
+ (set_longjmp_breakpoint): Likewise.
+ (struct fork_catchpoint): Inherit from breakpoint.
+ <base>: Remove.
+ (struct solib_catchpoint): Inherit from breakpoint.
+ <~solib_catchpoint>: New.
+ <base>: Remove.
+ (dtor_catch_solib): Change to ...
+ (solib_catchpoint::~solib_catchpoint): ... this.
+ (breakpoint_hit_catch_solib): Remove reference to base field.
+ (add_solib_catchpoint): Likewise.
+ (create_fork_vfork_event_catchpoint): Likewise.
+ (struct exec_catchpoint): Inherit from breakpoint.
+ <~exec_catchpoint>: New.
+ <base>: Remove.
+ (dtor_catch_exec): Change to ...
+ (exec_catchpoint::~exec_catchpoint): ... this.
+ (dtor_watchpoint): Change to ...
+ (watchpoint::~watchpoint): ... this.
+ (watch_command_1): Remove reference to base field.
+ (catch_exec_command_1): Likewise.
+ (base_breakpoint_dtor): Change to ...
+ (breakpoint::~breakpoint): ... this.
+ (base_breakpoint_ops): Remove dtor field value.
+ (longjmp_bkpt_dtor): Change to ...
+ (longjmp_breakpoint::~longjmp_breakpoint): ... this.
+ (strace_marker_create_breakpoints_sal): Remove reference to base
+ field.
+ (delete_breakpoint): Don't manually call breakpoint destructor.
+ (create_tracepoint_from_upload): Remove reference to base field.
+ (trace_pass_set_count): Likewise.
+ (initialize_breakpoint_ops): Don't initialize
+ momentary_breakpoint_ops, don't set dtors.
+ * ada-lang.c (struct ada_catchpoint): Inherit from breakpoint.
+ <~ada_catchpoint>: New.
+ <base>: Remove.
+ (create_excep_cond_exprs): Remove reference to base field.
+ (dtor_exception): Change to ...
+ (ada_catchpoint::~ada_catchpoint): ... this.
+ (dtor_catch_exception): Remove.
+ (dtor_catch_exception_unhandled): Remove.
+ (dtor_catch_assert): Remove.
+ (create_ada_exception_catchpoint): Remove reference to base
+ field.
+ (initialize_ada_catchpoint_ops): Don't set dtors.
+ * break-catch-sig.c (struct signal_catchpoint): Inherit from
+ breakpoint.
+ <~signal_catchpoint>: New.
+ <base>: Remove.
+ (signal_catchpoint_dtor): Change to ...
+ (signal_catchpoint::~signal_catchpoint): ... this.
+ (create_signal_catchpoint): Remove reference to base field.
+ (initialize_signal_catchpoint_ops): Don't set dtor.
+ * break-catch-syscall.c (struct syscall_catchpoint): Inherit
+ from breakpoint.
+ <~syscall_catchpoint>: New.
+ <base>: Remove.
+ (dtor_catch_syscall): Change to ...
+ (syscall_catchpoint::~syscall_catchpoint): ... this.
+ (create_syscall_event_catchpoint): Remove reference to base
+ field.
+ (initialize_syscall_catchpoint_ops): Don't set dtor.
+ * break-catch-throw.c (struct exception_catchpoint): Inherit
+ from breakpoint.
+ <~exception_catchpoint>: New.
+ <base>: Remove.
+ (dtor_exception_catchpoint): Change to ...
+ (exception_catchpoint::~exception_catchpoint): ... this.
+ (handle_gnu_v3_exceptions): Remove reference to base field.
+ (initialize_throw_catchpoint_ops): Don't set dtor.
+ * ctf.c (ctf_get_traceframe_address): Remove reference to base
+ field.
+ * remote.c (remote_get_tracepoint_status): Likewise.
+ * tracefile-tfile.c (tfile_get_traceframe_address): Likewise.
+ * tracefile.c (tracefile_fetch_registers): Likewise.
+ * tracepoint.c (actions_command): Likewise.
+ (validate_actionline): Likewise.
+ (tfind_1): Likewise.
+ (get_traceframe_location): Likewise.
+ (find_matching_tracepoint_location): Likewise.
+ (parse_tracepoint_status): Likewise.
+ * mi/mi-cmd-break.c (mi_cmd_break_passcount): Likewise.
+
2017-06-02 Simon Marchi <simon.marchi@polymtl.ca>
* breakpoint.c (struct longjmp_breakpoint): New struct.
ada_catchpoint_location_dtor
};
-/* An instance of this type is used to represent an Ada catchpoint.
- It includes a "struct breakpoint" as a kind of base class; users
- downcast to "struct breakpoint *" when needed. */
+/* An instance of this type is used to represent an Ada catchpoint. */
-struct ada_catchpoint
+struct ada_catchpoint : public breakpoint
{
- /* The base class. */
- struct breakpoint base;
+ ~ada_catchpoint () override;
/* The name of the specific exception the user specified. */
char *excep_string;
return;
/* Same if there are no locations... */
- if (c->base.loc == NULL)
+ if (c->loc == NULL)
return;
/* Compute the condition expression in text form, from the specific
/* Iterate over all the catchpoint's locations, and parse an
expression for each. */
- for (bl = c->base.loc; bl != NULL; bl = bl->next)
+ for (bl = c->loc; bl != NULL; bl = bl->next)
{
struct ada_catchpoint_location *ada_loc
= (struct ada_catchpoint_location *) bl;
{
warning (_("failed to reevaluate internal exception condition "
"for catchpoint %d: %s"),
- c->base.number, e.message);
+ c->number, e.message);
}
END_CATCH
}
do_cleanups (old_chain);
}
-/* Implement the DTOR method in the breakpoint_ops structure for all
- exception catchpoint kinds. */
+/* ada_catchpoint destructor. */
-static void
-dtor_exception (enum ada_exception_catchpoint_kind ex, struct breakpoint *b)
+ada_catchpoint::~ada_catchpoint ()
{
- struct ada_catchpoint *c = (struct ada_catchpoint *) b;
-
- xfree (c->excep_string);
-
- bkpt_breakpoint_ops.dtor (b);
+ xfree (this->excep_string);
}
/* Implement the ALLOCATE_LOCATION method in the breakpoint_ops
/* Virtual table for "catch exception" breakpoints. */
-static void
-dtor_catch_exception (struct breakpoint *b)
-{
- dtor_exception (ada_catch_exception, b);
-}
-
static struct bp_location *
allocate_location_catch_exception (struct breakpoint *self)
{
/* Virtual table for "catch exception unhandled" breakpoints. */
-static void
-dtor_catch_exception_unhandled (struct breakpoint *b)
-{
- dtor_exception (ada_catch_exception_unhandled, b);
-}
-
static struct bp_location *
allocate_location_catch_exception_unhandled (struct breakpoint *self)
{
/* Virtual table for "catch assert" breakpoints. */
-static void
-dtor_catch_assert (struct breakpoint *b)
-{
- dtor_exception (ada_catch_assert, b);
-}
-
static struct bp_location *
allocate_location_catch_assert (struct breakpoint *self)
{
= ada_exception_sal (ex_kind, excep_string, &addr_string, &ops);
c = new ada_catchpoint ();
- init_ada_exception_breakpoint (&c->base, gdbarch, sal, addr_string,
+ init_ada_exception_breakpoint (c, gdbarch, sal, addr_string,
ops, tempflag, disabled, from_tty);
c->excep_string = excep_string;
create_excep_cond_exprs (c);
if (cond_string != NULL)
- set_breakpoint_condition (&c->base, cond_string, from_tty);
- install_breakpoint (0, &c->base, 1);
+ set_breakpoint_condition (c, cond_string, from_tty);
+ install_breakpoint (0, c, 1);
}
/* Implement the "catch exception" command. */
ops = &catch_exception_breakpoint_ops;
*ops = bkpt_breakpoint_ops;
- ops->dtor = dtor_catch_exception;
ops->allocate_location = allocate_location_catch_exception;
ops->re_set = re_set_catch_exception;
ops->check_status = check_status_catch_exception;
ops = &catch_exception_unhandled_breakpoint_ops;
*ops = bkpt_breakpoint_ops;
- ops->dtor = dtor_catch_exception_unhandled;
ops->allocate_location = allocate_location_catch_exception_unhandled;
ops->re_set = re_set_catch_exception_unhandled;
ops->check_status = check_status_catch_exception_unhandled;
ops = &catch_assert_breakpoint_ops;
*ops = bkpt_breakpoint_ops;
- ops->dtor = dtor_catch_assert;
ops->allocate_location = allocate_location_catch_assert;
ops->re_set = re_set_catch_assert;
ops->check_status = check_status_catch_assert;
/* Momentary breakpoints class type. */
static struct breakpoint_ops momentary_breakpoint_ops;
-/* Momentary breakpoints for bp_longjmp and bp_exception class type. */
-static struct breakpoint_ops longjmp_breakpoint_ops;
-
/* The breakpoint_ops structure to be used in regular user created
breakpoints. */
struct breakpoint_ops bkpt_breakpoint_ops;
}
}
-struct longjmp_breakpoint
+struct longjmp_breakpoint : public breakpoint
{
- breakpoint base;
+ ~longjmp_breakpoint () override;
};
/* Encapsulate tests for different types of tracepoints. */
breakpoint *b;
if (is_tracepoint_type (type))
- b = (breakpoint *) new tracepoint ();
+ b = new tracepoint ();
else if (is_longjmp_type (type))
- b = (breakpoint *) new longjmp_breakpoint ();
+ b = new longjmp_breakpoint ();
else
b = new breakpoint ();
static int
watchpoint_in_thread_scope (struct watchpoint *b)
{
- return (b->base.pspace == current_program_space
+ return (b->pspace == current_program_space
&& (ptid_equal (b->watchpoint_thread, null_ptid)
|| (ptid_equal (inferior_ptid, b->watchpoint_thread)
&& !is_executing (inferior_ptid))));
static void
watchpoint_del_at_next_stop (struct watchpoint *w)
{
- struct breakpoint *b = &w->base;
-
- if (b->related_breakpoint != b)
+ if (w->related_breakpoint != w)
{
- gdb_assert (b->related_breakpoint->type == bp_watchpoint_scope);
- gdb_assert (b->related_breakpoint->related_breakpoint == b);
- b->related_breakpoint->disposition = disp_del_at_next_stop;
- b->related_breakpoint->related_breakpoint = b->related_breakpoint;
- b->related_breakpoint = b;
+ gdb_assert (w->related_breakpoint->type == bp_watchpoint_scope);
+ gdb_assert (w->related_breakpoint->related_breakpoint == w);
+ w->related_breakpoint->disposition = disp_del_at_next_stop;
+ w->related_breakpoint->related_breakpoint = w->related_breakpoint;
+ w->related_breakpoint = w;
}
- b->disposition = disp_del_at_next_stop;
+ w->disposition = disp_del_at_next_stop;
}
/* Extract a bitfield value from value VAL using the bit parameters contained in
if (!watchpoint_in_thread_scope (b))
return;
- if (b->base.disposition == disp_del_at_next_stop)
+ if (b->disposition == disp_del_at_next_stop)
return;
frame_saved = 0;
/* We don't free locations. They are stored in the bp_location array
and update_global_location_list will eventually delete them and
remove breakpoints if needed. */
- b->base.loc = NULL;
+ b->loc = NULL;
if (within_current_scope && reparse)
{
/* Note that unlike with breakpoints, the watchpoint's condition
expression is stored in the breakpoint object, not in the
locations (re)created below. */
- if (b->base.cond_string != NULL)
+ if (b->cond_string != NULL)
{
b->cond_exp.reset ();
- s = b->base.cond_string;
+ s = b->cond_string;
b->cond_exp = parse_exp_1 (&s, 0, b->cond_exp_valid_block, 0);
}
}
the target gains execution, through breakpoint_re_set. */
if (!can_use_hw_watchpoints)
{
- if (b->base.ops->works_in_software_mode (&b->base))
- b->base.type = bp_watchpoint;
+ if (b->ops->works_in_software_mode (b))
+ b->type = bp_watchpoint;
else
error (_("Can't set read/access watchpoint when "
"hardware watchpoints are disabled."));
happens, the code that reports it updates b->val directly.
We don't keep track of the memory value for masked
watchpoints. */
- if (!b->val_valid && !is_masked_watchpoint (&b->base))
+ if (!b->val_valid && !is_masked_watchpoint (b))
{
if (b->val_bitsize != 0)
{
}
type = hw_write;
- if (b->base.type == bp_read_watchpoint)
+ if (b->type == bp_read_watchpoint)
type = hw_read;
- else if (b->base.type == bp_access_watchpoint)
+ else if (b->type == bp_access_watchpoint)
type = hw_access;
- loc = allocate_bp_location (&b->base);
- for (tmp = &(b->base.loc); *tmp != NULL; tmp = &((*tmp)->next))
+ loc = allocate_bp_location (b);
+ for (tmp = &(b->loc); *tmp != NULL; tmp = &((*tmp)->next))
;
*tmp = loc;
loc->gdbarch = get_type_arch (value_type (v));
/* If this is a software watchpoint, we try to turn it
to a hardware one -- count resources as if B was of
hardware watchpoint type. */
- type = b->base.type;
+ type = b->type;
if (type == bp_watchpoint)
type = bp_hardware_watchpoint;
manually. */
/* Count resources used by all watchpoints except B. */
- i = hw_watchpoint_used_count_others (&b->base, type, &other_type_used);
+ i = hw_watchpoint_used_count_others (b, type, &other_type_used);
/* Add in the resources needed for B. */
- i += hw_watchpoint_use_count (&b->base);
+ i += hw_watchpoint_use_count (b);
target_resources_ok
= target_can_use_hardware_watchpoint (type, i, other_type_used);
if (target_resources_ok <= 0)
{
- int sw_mode = b->base.ops->works_in_software_mode (&b->base);
+ int sw_mode = b->ops->works_in_software_mode (b);
if (target_resources_ok == 0 && !sw_mode)
error (_("Target does not support this type of "
"resources for this watchpoint."));
/* Downgrade to software watchpoint. */
- b->base.type = bp_watchpoint;
+ b->type = bp_watchpoint;
}
else
{
found we have enough resources to turn it to a
hardware watchpoint. Otherwise, this is a
nop. */
- b->base.type = type;
+ b->type = type;
}
}
- else if (!b->base.ops->works_in_software_mode (&b->base))
+ else if (!b->ops->works_in_software_mode (b))
{
if (!can_use_hw_watchpoints)
error (_("Can't set read/access watchpoint when "
"read/access watchpoint."));
}
else
- b->base.type = bp_watchpoint;
+ b->type = bp_watchpoint;
- loc_type = (b->base.type == bp_watchpoint? bp_loc_other
+ loc_type = (b->type == bp_watchpoint? bp_loc_other
: bp_loc_hardware_watchpoint);
- for (bl = b->base.loc; bl; bl = bl->next)
+ for (bl = b->loc; bl; bl = bl->next)
bl->loc_type = loc_type;
}
above left it without any location set up. But,
bpstat_stop_status requires a location to be able to report
stops, so make sure there's at least a dummy one. */
- if (b->base.type == bp_watchpoint && b->base.loc == NULL)
- software_watchpoint_add_no_memory_location (&b->base, frame_pspace);
+ if (b->type == bp_watchpoint && b->loc == NULL)
+ software_watchpoint_add_no_memory_location (b, frame_pspace);
}
else if (!within_current_scope)
{
printf_filtered (_("\
Watchpoint %d deleted because the program has left the block\n\
in which its expression is valid.\n"),
- b->base.number);
+ b->number);
watchpoint_del_at_next_stop (b);
}
struct value *mark;
struct value *new_val;
- if (is_masked_watchpoint (&b->base))
+ if (is_masked_watchpoint (b))
/* Since we don't know the exact trigger address (from
stopped_data_address), just tell the user we've triggered
a mask watchpoint. */
uiout->field_string
("reason", async_reason_lookup (EXEC_ASYNC_WATCHPOINT_SCOPE));
uiout->text ("\nWatchpoint ");
- uiout->field_int ("wpnum", b->base.number);
+ uiout->field_int ("wpnum", b->number);
uiout->text (" deleted because the program has left the block in\n"
"which its expression is valid.\n");
}
/* Make sure the watchpoint's commands aren't executed. */
- decref_counted_command_line (&b->base.commands);
+ decref_counted_command_line (&b->commands);
watchpoint_del_at_next_stop (b);
return WP_DELETED;
{
int must_check_value = 0;
- if (b->base.type == bp_watchpoint)
+ if (b->type == bp_watchpoint)
/* For a software watchpoint, we must always check the
watched value. */
must_check_value = 1;
this watchpoint. */
must_check_value = 1;
else if (b->watchpoint_triggered == watch_triggered_unknown
- && b->base.type == bp_hardware_watchpoint)
+ && b->type == bp_hardware_watchpoint)
/* We were stopped by a hardware watchpoint, but the target could
not report the data address. We must check the watchpoint's
value. Access and read watchpoints are out of luck; without
{
char *message
= xstrprintf ("Error evaluating expression for watchpoint %d\n",
- b->base.number);
+ b->number);
struct cleanup *cleanups = make_cleanup (xfree, message);
int e = catch_errors (watchpoint_check, bs, message,
RETURN_MASK_ALL);
bs->stop = 0;
break;
case WP_VALUE_CHANGED:
- if (b->base.type == bp_read_watchpoint)
+ if (b->type == bp_read_watchpoint)
{
/* There are two cases to consider here:
}
break;
case WP_VALUE_NOT_CHANGED:
- if (b->base.type == bp_hardware_watchpoint
- || b->base.type == bp_watchpoint)
+ if (b->type == bp_hardware_watchpoint
+ || b->type == bp_watchpoint)
{
/* Don't stop: write watchpoints shouldn't fire if
the value hasn't changed. */
SWITCH_THRU_ALL_UIS ()
{
printf_filtered (_("Watchpoint %d deleted.\n"),
- b->base.number);
+ b->number);
}
watchpoint_del_at_next_stop (b);
/* We've already printed what needs to be printed. */
/* longjmp_breakpoint_ops ensures INITIATING_FRAME is cleared again
after their removal. */
clone = momentary_breakpoint_from_master (b, type,
- &longjmp_breakpoint_ops, 1);
+ &momentary_breakpoint_ops, 1);
clone->thread = thread;
}
/* FORK & VFORK catchpoints. */
/* An instance of this type is used to represent a fork or vfork
- catchpoint. It includes a "struct breakpoint" as a kind of base
- class; users downcast to "struct breakpoint *" when needed. A
- breakpoint is really of this type iff its ops pointer points to
- CATCH_FORK_BREAKPOINT_OPS. */
+ catchpoint. A breakpoint is really of this type iff its ops pointer points
+ to CATCH_FORK_BREAKPOINT_OPS. */
-struct fork_catchpoint
+struct fork_catchpoint : public breakpoint
{
- /* The base class. */
- struct breakpoint base;
-
/* Process id of a child process whose forking triggered this
catchpoint. This field is only valid immediately after this
catchpoint has triggered. */
static struct breakpoint_ops catch_vfork_breakpoint_ops;
/* An instance of this type is used to represent an solib catchpoint.
- It includes a "struct breakpoint" as a kind of base class; users
- downcast to "struct breakpoint *" when needed. A breakpoint is
- really of this type iff its ops pointer points to
+ A breakpoint is really of this type iff its ops pointer points to
CATCH_SOLIB_BREAKPOINT_OPS. */
-struct solib_catchpoint
+struct solib_catchpoint : public breakpoint
{
- /* The base class. */
- struct breakpoint base;
+ ~solib_catchpoint () override;
/* True for "catch load", false for "catch unload". */
unsigned char is_load;
regex_t compiled;
};
-static void
-dtor_catch_solib (struct breakpoint *b)
+solib_catchpoint::~solib_catchpoint ()
{
- struct solib_catchpoint *self = (struct solib_catchpoint *) b;
-
- if (self->regex)
- regfree (&self->compiled);
- xfree (self->regex);
-
- base_breakpoint_ops.dtor (b);
+ if (this->regex)
+ regfree (&this->compiled);
+ xfree (this->regex);
}
static int
if (other->type != bp_shlib_event)
continue;
- if (self->base.pspace != NULL && other->pspace != self->base.pspace)
+ if (self->pspace != NULL && other->pspace != self->pspace)
continue;
for (other_bl = other->loc; other_bl != NULL; other_bl = other_bl->next)
}
c->is_load = is_load;
- init_catchpoint (&c->base, gdbarch, is_temp, NULL,
+ init_catchpoint (c, gdbarch, is_temp, NULL,
&catch_solib_breakpoint_ops);
- c->base.enable_state = enabled ? bp_enabled : bp_disabled;
+ c->enable_state = enabled ? bp_enabled : bp_disabled;
discard_cleanups (cleanup);
- install_breakpoint (0, &c->base, 1);
+ install_breakpoint (0, c, 1);
}
/* A helper function that does all the work for "catch load" and
{
struct fork_catchpoint *c = new fork_catchpoint ();
- init_catchpoint (&c->base, gdbarch, tempflag, cond_string, ops);
+ init_catchpoint (c, gdbarch, tempflag, cond_string, ops);
c->forked_inferior_pid = null_ptid;
- install_breakpoint (0, &c->base, 1);
+ install_breakpoint (0, c, 1);
}
/* Exec catchpoints. */
/* An instance of this type is used to represent an exec catchpoint.
- It includes a "struct breakpoint" as a kind of base class; users
- downcast to "struct breakpoint *" when needed. A breakpoint is
- really of this type iff its ops pointer points to
+ A breakpoint is really of this type iff its ops pointer points to
CATCH_EXEC_BREAKPOINT_OPS. */
-struct exec_catchpoint
+struct exec_catchpoint : public breakpoint
{
- /* The base class. */
- struct breakpoint base;
+ ~exec_catchpoint () override;
/* Filename of a program whose exec triggered this catchpoint.
This field is only valid immediately after this catchpoint has
char *exec_pathname;
};
-/* Implement the "dtor" breakpoint_ops method for exec
- catchpoints. */
+/* Exec catchpoint destructor. */
-static void
-dtor_catch_exec (struct breakpoint *b)
+exec_catchpoint::~exec_catchpoint ()
{
- struct exec_catchpoint *c = (struct exec_catchpoint *) b;
-
- xfree (c->exec_pathname);
-
- base_breakpoint_ops.dtor (b);
+ xfree (this->exec_pathname);
}
static int
return 1;
}
-/* Implement the "dtor" breakpoint_ops method for watchpoints. */
+/* Watchpoint destructor. */
-static void
-dtor_watchpoint (struct breakpoint *self)
+watchpoint::~watchpoint ()
{
- struct watchpoint *w = (struct watchpoint *) self;
-
- xfree (w->exp_string);
- xfree (w->exp_string_reparse);
- value_free (w->val);
-
- base_breakpoint_ops.dtor (self);
+ xfree (this->exp_string);
+ xfree (this->exp_string_reparse);
+ value_free (this->val);
}
/* Implement the "re_set" breakpoint_ops method for watchpoints. */
watch_command_1 (const char *arg, int accessflag, int from_tty,
int just_location, int internal)
{
- struct breakpoint *b, *scope_breakpoint = NULL;
+ struct breakpoint *scope_breakpoint = NULL;
const struct block *exp_valid_block = NULL, *cond_exp_valid_block = NULL;
struct value *val, *mark, *result;
int saved_bitpos = 0, saved_bitsize = 0;
bp_type = bp_hardware_watchpoint;
w = new watchpoint ();
- b = &w->base;
+
if (use_mask)
- init_raw_breakpoint_without_location (b, NULL, bp_type,
+ init_raw_breakpoint_without_location (w, NULL, bp_type,
&masked_watchpoint_breakpoint_ops);
else
- init_raw_breakpoint_without_location (b, NULL, bp_type,
+ init_raw_breakpoint_without_location (w, NULL, bp_type,
&watchpoint_breakpoint_ops);
- b->thread = thread;
- b->disposition = disp_donttouch;
- b->pspace = current_program_space;
+ w->thread = thread;
+ w->disposition = disp_donttouch;
+ w->pspace = current_program_space;
w->exp = std::move (exp);
w->exp_valid_block = exp_valid_block;
w->cond_exp_valid_block = cond_exp_valid_block;
}
if (cond_start)
- b->cond_string = savestring (cond_start, cond_end - cond_start);
+ w->cond_string = savestring (cond_start, cond_end - cond_start);
else
- b->cond_string = 0;
+ w->cond_string = 0;
if (frame_id_p (watchpoint_frame))
{
{
/* The scope breakpoint is related to the watchpoint. We will
need to act on them together. */
- b->related_breakpoint = scope_breakpoint;
- scope_breakpoint->related_breakpoint = b;
+ w->related_breakpoint = scope_breakpoint;
+ scope_breakpoint->related_breakpoint = w;
}
if (!just_location)
}
CATCH (e, RETURN_MASK_ALL)
{
- delete_breakpoint (b);
+ delete_breakpoint (w);
throw_exception (e);
}
END_CATCH
- install_breakpoint (internal, b, 1);
+ install_breakpoint (internal, w, 1);
do_cleanups (back_to);
}
error (_("Junk at end of arguments."));
c = new exec_catchpoint ();
- init_catchpoint (&c->base, gdbarch, tempflag, cond_string,
+ init_catchpoint (c, gdbarch, tempflag, cond_string,
&catch_exec_breakpoint_ops);
c->exec_pathname = NULL;
- install_breakpoint (0, &c->base, 1);
+ install_breakpoint (0, c, 1);
}
void
bp_location_dtor
};
-/* Default breakpoint_ops methods all breakpoint_ops ultimately
- inherit from. */
+/* Destructor for the breakpoint base class. */
-static void
-base_breakpoint_dtor (struct breakpoint *self)
+breakpoint::~breakpoint ()
{
- decref_counted_command_line (&self->commands);
- xfree (self->cond_string);
- xfree (self->extra_string);
- xfree (self->filter);
+ decref_counted_command_line (&this->commands);
+ xfree (this->cond_string);
+ xfree (this->extra_string);
+ xfree (this->filter);
}
static struct bp_location *
struct breakpoint_ops base_breakpoint_ops =
{
- base_breakpoint_dtor,
base_breakpoint_allocate_location,
base_breakpoint_re_set,
base_breakpoint_insert_location,
It gets cleared already on the removal of the first one of such placed
breakpoints. This is OK as they get all removed altogether. */
-static void
-longjmp_bkpt_dtor (struct breakpoint *self)
+longjmp_breakpoint::~longjmp_breakpoint ()
{
- struct thread_info *tp = find_thread_global_id (self->thread);
+ thread_info *tp = find_thread_global_id (this->thread);
- if (tp)
+ if (tp != NULL)
tp->initiating_frame = null_frame_id;
-
- momentary_breakpoint_ops.dtor (self);
}
/* Specific methods for probe breakpoints. */
location = copy_event_location (canonical->location.get ());
tp = new tracepoint ();
- init_breakpoint_sal (&tp->base, gdbarch, expanded,
+ init_breakpoint_sal (tp, gdbarch, expanded,
std::move (location), NULL,
cond_string, extra_string,
type_wanted, disposition,
corresponds to this one */
tp->static_trace_marker_id_idx = i;
- install_breakpoint (internal, &tp->base, 0);
+ install_breakpoint (internal, tp, 0);
}
}
self-contained, but it's not the case now. */
update_global_location_list (UGLL_DONT_INSERT);
- bpt->ops->dtor (bpt);
/* On the chance that someone will soon try again to delete this
same bp, we mark it as deleted before freeing its storage. */
bpt->type = bp_none;
if (utp->pass > 0)
{
xsnprintf (small_buf, sizeof (small_buf), "%d %d", utp->pass,
- tp->base.number);
+ tp->number);
trace_pass_command (small_buf, 0);
}
cmd_list = read_command_lines_1 (read_uploaded_action, 1, NULL, NULL);
- breakpoint_set_commands (&tp->base, std::move (cmd_list));
+ breakpoint_set_commands (tp, std::move (cmd_list));
}
else if (!VEC_empty (char_ptr, utp->actions)
|| !VEC_empty (char_ptr, utp->step_actions))
utp->number);
/* Copy any status information that might be available. */
- tp->base.hit_count = utp->hit_count;
+ tp->hit_count = utp->hit_count;
tp->traceframe_usage = utp->traceframe_usage;
return tp;
trace_pass_set_count (struct tracepoint *tp, int count, int from_tty)
{
tp->pass_count = count;
- observer_notify_breakpoint_modified (&tp->base);
+ observer_notify_breakpoint_modified (tp);
if (from_tty)
printf_filtered (_("Setting tracepoint %d's passcount to %d\n"),
- tp->base.number, count);
+ tp->number, count);
}
/* Set passcount for tracepoint.
ops->print_it = momentary_bkpt_print_it;
ops->print_mention = momentary_bkpt_print_mention;
- /* Momentary breakpoints for bp_longjmp and bp_exception. */
- ops = &longjmp_breakpoint_ops;
- *ops = momentary_breakpoint_ops;
- ops->dtor = longjmp_bkpt_dtor;
-
/* Probe breakpoints. */
ops = &bkpt_probe_breakpoint_ops;
*ops = bkpt_breakpoint_ops;
/* Watchpoints. */
ops = &watchpoint_breakpoint_ops;
*ops = base_breakpoint_ops;
- ops->dtor = dtor_watchpoint;
ops->re_set = re_set_watchpoint;
ops->insert_location = insert_watchpoint;
ops->remove_location = remove_watchpoint;
/* Exec catchpoints. */
ops = &catch_exec_breakpoint_ops;
*ops = base_breakpoint_ops;
- ops->dtor = dtor_catch_exec;
ops->insert_location = insert_catch_exec;
ops->remove_location = remove_catch_exec;
ops->breakpoint_hit = breakpoint_hit_catch_exec;
/* Solib-related catchpoints. */
ops = &catch_solib_breakpoint_ops;
*ops = base_breakpoint_ops;
- ops->dtor = dtor_catch_solib;
ops->insert_location = insert_catch_solib;
ops->remove_location = remove_catch_solib;
ops->breakpoint_hit = breakpoint_hit_catch_solib;