the target gains execution, through breakpoint_re_set. */
if (!can_use_hw_watchpoints)
{
- if (b->ops->works_in_software_mode (b))
+ if (b->works_in_software_mode ())
b->type = bp_watchpoint;
else
error (_("Can't set read/access watchpoint when "
= target_can_use_hardware_watchpoint (type, i, other_type_used);
if (target_resources_ok <= 0)
{
- int sw_mode = b->ops->works_in_software_mode (b);
+ int sw_mode = b->works_in_software_mode ();
if (target_resources_ok == 0 && !sw_mode)
error (_("Target does not support this type of "
b->type = type;
}
}
- else if (!b->ops->works_in_software_mode (b))
+ else if (!b->works_in_software_mode ())
{
if (!can_use_hw_watchpoints)
error (_("Can't set read/access watchpoint when "
{
int val;
- val = bl->owner->ops->insert_location (bl);
+ val = bl->owner->insert_location (bl);
if (val)
bp_excpt = gdb_exception {RETURN_ERROR, GENERIC_ERROR};
}
{
int val;
- val = bl->owner->ops->insert_location (bl);
+ val = bl->owner->insert_location (bl);
if (val)
bp_excpt = gdb_exception {RETURN_ERROR, GENERIC_ERROR};
}
{
int val;
- gdb_assert (bl->owner->ops != NULL
- && bl->owner->ops->insert_location != NULL);
-
- val = bl->owner->ops->insert_location (bl);
+ val = bl->owner->insert_location (bl);
/* If trying to set a read-watchpoint, and it turns out it's not
supported, try emulating one with an access watchpoint. */
if (val == 1)
{
bl->watchpoint_type = hw_access;
- val = bl->owner->ops->insert_location (bl);
+ val = bl->owner->insert_location (bl);
if (val)
/* Back to the original value. */
{
int val;
- gdb_assert (bl->owner->ops != NULL
- && bl->owner->ops->insert_location != NULL);
-
- val = bl->owner->ops->insert_location (bl);
+ val = bl->owner->insert_location (bl);
if (val)
{
bl->owner->enable_state = bp_disabled;
&& !memory_validate_breakpoint (bl->gdbarch, &bl->target_info))
val = 0;
else
- val = bl->owner->ops->remove_location (bl, reason);
+ val = bl->owner->remove_location (bl, reason);
}
else
{
wrong code with the saved shadow contents. */
if (bl->loc_type == bp_loc_hardware_breakpoint
|| section_is_mapped (bl->section))
- val = bl->owner->ops->remove_location (bl, reason);
+ val = bl->owner->remove_location (bl, reason);
else
val = 0;
}
}
else if (bl->loc_type == bp_loc_hardware_watchpoint)
{
- gdb_assert (bl->owner->ops != NULL
- && bl->owner->ops->remove_location != NULL);
-
bl->inserted = (reason == DETACH_BREAKPOINT);
- bl->owner->ops->remove_location (bl, reason);
+ bl->owner->remove_location (bl, reason);
/* Failure to remove any of the hardware watchpoints comes here. */
if (reason == REMOVE_BREAKPOINT && bl->inserted)
&& breakpoint_enabled (bl->owner)
&& !bl->duplicate)
{
- gdb_assert (bl->owner->ops != NULL
- && bl->owner->ops->remove_location != NULL);
-
- val = bl->owner->ops->remove_location (bl, reason);
+ val = bl->owner->remove_location (bl, reason);
if (val)
return val;
}
else
{
- if (bsp->breakpoint_at->ops->explains_signal (bsp->breakpoint_at,
- sig))
+ if (bsp->breakpoint_at->explains_signal (sig))
return true;
}
}
return PRINT_UNKNOWN;
/* Normal case. Call the breakpoint's print_it method. */
- return b->ops->print_it (bs);
+ return b->print_it (bs);
}
break;
watch after that (since the garbage may or may not equal
the first value assigned). */
/* We print all the stop information in
- breakpoint_ops->print_it, but in this case, by the time we
- call breakpoint_ops->print_it this bp will be deleted
+ breakpointprint_it, but in this case, by the time we
+ call breakpoint->print_it this bp will be deleted
already. So we have no choice but print the information
here. */
/* BL is from an existing breakpoint. */
gdb_assert (b != NULL);
- return b->ops->breakpoint_hit (bl, aspace, bp_addr, ws);
+ return b->breakpoint_hit (bl, aspace, bp_addr, ws);
}
/* Determine if the watched values have actually changed, and we
continue;
b = bs->breakpoint_at;
- b->ops->check_status (bs);
+ b->check_status (bs);
if (bs->stop)
{
bpstat_check_breakpoint_conditions (bs, thread);
? bs->commands.get () : NULL))
bs->print = 0;
- b->ops->after_condition_true (bs);
+ b->after_condition_true (bs);
}
}
/* 5 and 6 */
bool result = false;
- if (!raw_loc && b->ops != NULL && b->ops->print_one (b, last_loc))
+ if (!raw_loc && b->print_one (last_loc))
result = true;
else
{
uiout->text ("\n");
if (!part_of_multiple)
- b->ops->print_one_detail (b, uiout);
+ b->print_one_detail (uiout);
if (part_of_multiple && frame_id_p (b->frame_id))
{
static struct bp_location *
allocate_bp_location (struct breakpoint *bpt)
{
- return bpt->ops->allocate_location (bpt);
+ return bpt->allocate_location ();
}
/* Decrement reference count. If the reference count reaches 0,
{
/* Special types of hardware breakpoints may use more than
one register. */
- i += b->ops->resources_needed (bl);
+ i += b->resources_needed (bl);
}
return i;
{
/* Special types of hardware watchpoints may use more than
one register. */
- i += b->ops->resources_needed (bl);
+ i += b->resources_needed (bl);
}
return i;
static void
mention (struct breakpoint *b)
{
- b->ops->print_mention (b);
+ b->print_mention ();
current_uiout->text ("\n");
}
\f
return 0;
}
-/* Helper for breakpoint and tracepoint breakpoint_ops->mention
+/* Helper for breakpoint and tracepoint breakpoint->mention
callbacks. */
static void
return bp_location_range (this->loc);
}
-static struct bp_location *
-base_breakpoint_allocate_location (struct breakpoint *self)
-{
- return new bp_location (self);
-}
-
struct bp_location *
breakpoint::allocate_location ()
{
return new bp_location (this);
}
-static void
-base_breakpoint_re_set (struct breakpoint *b)
-{
- /* Nothing to re-set. */
-}
-
#define internal_error_pure_virtual_called() \
gdb_assert_not_reached ("pure virtual function called")
-static int
-base_breakpoint_insert_location (struct bp_location *bl)
-{
- internal_error_pure_virtual_called ();
-}
-
int
breakpoint::insert_location (struct bp_location *bl)
{
internal_error_pure_virtual_called ();
}
-static int
-base_breakpoint_remove_location (struct bp_location *bl,
- enum remove_bp_reason reason)
-{
- internal_error_pure_virtual_called ();
-}
-
int
breakpoint::remove_location (struct bp_location *bl,
enum remove_bp_reason reason)
internal_error_pure_virtual_called ();
}
-static int
-base_breakpoint_breakpoint_hit (const struct bp_location *bl,
- const address_space *aspace,
- CORE_ADDR bp_addr,
- const target_waitstatus &ws)
-{
- internal_error_pure_virtual_called ();
-}
-
int
breakpoint::breakpoint_hit (const struct bp_location *bl,
const address_space *aspace,
internal_error_pure_virtual_called ();
}
-static void
-base_breakpoint_check_status (bpstat *bs)
-{
- /* Always stop. */
-}
-
-/* A "works_in_software_mode" breakpoint_ops method that just internal
- errors. */
-
-static int
-base_breakpoint_works_in_software_mode (const struct breakpoint *b)
-{
- internal_error_pure_virtual_called ();
-}
-
int
breakpoint::works_in_software_mode () const
{
internal_error_pure_virtual_called ();
}
-/* A "resources_needed" breakpoint_ops method that just internal
- errors. */
-
-static int
-base_breakpoint_resources_needed (const struct bp_location *bl)
-{
- internal_error_pure_virtual_called ();
-}
-
int
breakpoint::resources_needed (const struct bp_location *bl)
{
internal_error_pure_virtual_called ();
}
-static enum print_stop_action
-base_breakpoint_print_it (bpstat *bs)
-{
- internal_error_pure_virtual_called ();
-}
-
enum print_stop_action
breakpoint::print_it (bpstat *bs)
{
internal_error_pure_virtual_called ();
}
-static bool
-base_breakpoint_print_one (struct breakpoint *, struct bp_location **)
-{
- return false;
-}
-
-static void
-base_breakpoint_print_one_detail (const struct breakpoint *self,
- struct ui_out *uiout)
-{
- /* nothing */
-}
-
-static void
-base_breakpoint_print_mention (struct breakpoint *b)
-{
- internal_error_pure_virtual_called ();
-}
-
void
breakpoint::print_mention ()
{
internal_error_pure_virtual_called ();
}
-static void
-base_breakpoint_print_recreate (struct breakpoint *b, struct ui_file *fp)
-{
- internal_error_pure_virtual_called ();
-}
-
void
breakpoint::print_recreate (struct ui_file *fp)
{
internal_error_pure_virtual_called ();
}
-static std::vector<symtab_and_line>
-base_breakpoint_decode_location (struct breakpoint *b,
- struct event_location *location,
- struct program_space *search_pspace)
-{
- internal_error_pure_virtual_called ();
-}
-
std::vector<symtab_and_line>
breakpoint::decode_location (struct event_location *location,
struct program_space *search_pspace)
internal_error_pure_virtual_called ();
}
-/* The default 'explains_signal' method. */
-
-static int
-base_breakpoint_explains_signal (struct breakpoint *b, enum gdb_signal sig)
-{
- return 1;
-}
-
-/* The default "after_condition_true" method. */
-
-static void
-base_breakpoint_after_condition_true (struct bpstat *bs)
-{
- /* Nothing to do. */
-}
-
struct breakpoint_ops base_breakpoint_ops =
{
- base_breakpoint_allocate_location,
- base_breakpoint_re_set,
- base_breakpoint_insert_location,
- base_breakpoint_remove_location,
- base_breakpoint_breakpoint_hit,
- base_breakpoint_check_status,
- base_breakpoint_resources_needed,
- base_breakpoint_works_in_software_mode,
- base_breakpoint_print_it,
- base_breakpoint_print_one,
- base_breakpoint_print_one_detail,
- base_breakpoint_print_mention,
- base_breakpoint_print_recreate,
base_breakpoint_create_sals_from_location,
base_breakpoint_create_breakpoints_sal,
- base_breakpoint_decode_location,
- base_breakpoint_explains_signal,
- base_breakpoint_after_condition_true,
};
struct breakpoint_ops vtable_breakpoint_ops =
{
- [] (struct breakpoint *b) { return b->allocate_location (); },
- [] (struct breakpoint *b) { b->re_set (); },
- [] (struct bp_location *l)
- {
- return l->owner->insert_location (l);
- },
- [] (struct bp_location *l, enum remove_bp_reason reason)
- {
- return l->owner->remove_location (l, reason);
- },
- [] (const struct bp_location *bl,
- const address_space *aspace,
- CORE_ADDR bp_addr,
- const target_waitstatus &ws)
- {
- return bl->owner->breakpoint_hit (bl, aspace, bp_addr, ws);
- },
- [] (struct bpstat *bs) { bs->breakpoint_at->check_status (bs); },
- [] (const struct bp_location *bl)
- { return bl->owner->resources_needed (bl); },
- [] (const struct breakpoint *b)
- { return b->works_in_software_mode (); },
- [] (struct bpstat *bs)
- { return bs->breakpoint_at->print_it (bs); },
- [] (struct breakpoint *b, struct bp_location **bl)
- { return b->print_one (bl); },
- [] (const struct breakpoint *b, struct ui_out *out)
- { b->print_one_detail (out); },
- [] (struct breakpoint *b) { b->print_mention (); },
- [] (struct breakpoint *b, struct ui_file *fp)
- { b->print_recreate (fp); },
create_sals_from_location_default,
create_breakpoints_sal_default,
- [] (struct breakpoint *b,
- struct event_location *location,
- struct program_space *search_pspace)
- { return b->decode_location (location, search_pspace); },
- [] (struct breakpoint *b, enum gdb_signal s)
- { return b->explains_signal (s); },
- [] (struct bpstat *bs)
- { bs->breakpoint_at->after_condition_true (bs); }
};
/* Default breakpoint_ops methods. */
try
{
- sals = b->ops->decode_location (b, location, search_pspace);
+ sals = b->decode_location (location, search_pspace);
}
catch (gdb_exception_error &e)
{
input_radix = b->input_radix;
set_language (b->language);
- b->ops->re_set (b);
+ b->re_set ();
}
/* Re-set breakpoint locations for the current program space.
if (filter && !filter (tp))
continue;
- tp->ops->print_recreate (tp, &fp);
+ tp->print_recreate (&fp);
/* Note, we can't rely on tp->number for anything, as we can't
assume the recreated breakpoint numbers will match. Use $bpnum
struct breakpoint_ops
{
- /* Allocate a location for this breakpoint. */
- struct bp_location * (*allocate_location) (struct breakpoint *);
-
- /* Reevaluate a breakpoint. This is necessary after symbols change
- (e.g., an executable or DSO was loaded, or the inferior just
- started). */
- void (*re_set) (struct breakpoint *self);
-
- /* Insert the breakpoint or watchpoint or activate the catchpoint.
- Return 0 for success, 1 if the breakpoint, watchpoint or
- catchpoint type is not supported, -1 for failure. */
- int (*insert_location) (struct bp_location *);
-
- /* Remove the breakpoint/catchpoint that was previously inserted
- with the "insert" method above. Return 0 for success, 1 if the
- breakpoint, watchpoint or catchpoint type is not supported,
- -1 for failure. */
- int (*remove_location) (struct bp_location *, enum remove_bp_reason reason);
-
- /* Return true if it the target has stopped due to hitting
- breakpoint location BL. This function does not check if we
- should stop, only if BL explains the stop. ASPACE is the address
- space in which the event occurred, BP_ADDR is the address at
- which the inferior stopped, and WS is the target_waitstatus
- describing the event. */
- int (*breakpoint_hit) (const struct bp_location *bl,
- const address_space *aspace,
- CORE_ADDR bp_addr,
- const target_waitstatus &ws);
-
- /* Check internal conditions of the breakpoint referred to by BS.
- If we should not stop for this breakpoint, set BS->stop to 0. */
- void (*check_status) (struct bpstat *bs);
-
- /* Tell how many hardware resources (debug registers) are needed
- for this breakpoint. If this function is not provided, then
- the breakpoint or watchpoint needs one debug register. */
- int (*resources_needed) (const struct bp_location *);
-
- /* Tell whether we can downgrade from a hardware watchpoint to a software
- one. If not, the user will not be able to enable the watchpoint when
- there are not enough hardware resources available. */
- int (*works_in_software_mode) (const struct breakpoint *);
-
- /* The normal print routine for this breakpoint, called when we
- hit it. */
- enum print_stop_action (*print_it) (struct bpstat *bs);
-
- /* Display information about this breakpoint, for "info
- breakpoints". Returns false if this method should use the
- default behavior. */
- bool (*print_one) (struct breakpoint *, struct bp_location **);
-
- /* Display extra information about this breakpoint, below the normal
- breakpoint description in "info breakpoints".
-
- In the example below, the "address range" line was printed
- by print_one_detail_ranged_breakpoint.
-
- (gdb) info breakpoints
- Num Type Disp Enb Address What
- 2 hw breakpoint keep y in main at test-watch.c:70
- address range: [0x10000458, 0x100004c7]
-
- */
- void (*print_one_detail) (const struct breakpoint *, struct ui_out *);
-
- /* Display information about this breakpoint after setting it
- (roughly speaking; this is called from "mention"). */
- void (*print_mention) (struct breakpoint *);
-
- /* Print to FP the CLI command that recreates this breakpoint. */
- void (*print_recreate) (struct breakpoint *, struct ui_file *fp);
-
/* Create SALs from location, storing the result in linespec_result.
For an explanation about the arguments, see the function
enum bptype, enum bpdisp, int, int,
int, const struct breakpoint_ops *,
int, int, int, unsigned);
-
- /* Given the location (second parameter), this method decodes it and
- returns the SAL locations related to it. For ordinary
- breakpoints, it calls `decode_line_full'. If SEARCH_PSPACE is
- not NULL, symbol search is restricted to just that program space.
-
- This function is called inside `location_to_sals'. */
- std::vector<symtab_and_line> (*decode_location)
- (struct breakpoint *b,
- struct event_location *location,
- struct program_space *search_pspace);
-
- /* Return true if this breakpoint explains a signal. See
- bpstat_explains_signal. */
- int (*explains_signal) (struct breakpoint *, enum gdb_signal);
-
- /* Called after evaluating the breakpoint's condition,
- and only if it evaluated true. */
- void (*after_condition_true) (struct bpstat *bs);
};
/* Helper for breakpoint_ops->print_recreate implementations. Prints