enum bptype type,
int loc_enabled, int thread);
-static void breakpoint_adjustment_warning (CORE_ADDR, CORE_ADDR, int, int);
+static void breakpoint_adjustment_warning (CORE_ADDR, CORE_ADDR, int, bool);
static CORE_ADDR adjust_breakpoint_address (struct gdbarch *gdbarch,
CORE_ADDR bpaddr,
enum bptype bptype,
struct program_space *pspace);
-static int watchpoint_locations_match (const struct bp_location *loc1,
- const struct bp_location *loc2);
+static bool watchpoint_locations_match (const struct bp_location *loc1,
+ const struct bp_location *loc2);
-static int breakpoint_locations_match (const struct bp_location *loc1,
- const struct bp_location *loc2,
- bool sw_hw_bps_match = false);
+static bool breakpoint_locations_match (const struct bp_location *loc1,
+ const struct bp_location *loc2,
+ bool sw_hw_bps_match = false);
-static int breakpoint_location_address_match (struct bp_location *bl,
- const struct address_space *aspace,
- CORE_ADDR addr);
+static bool breakpoint_location_address_match (struct bp_location *bl,
+ const struct address_space *aspace,
+ CORE_ADDR addr);
-static int breakpoint_location_address_range_overlap (struct bp_location *,
- const address_space *,
- CORE_ADDR, int);
+static bool breakpoint_location_address_range_overlap (struct bp_location *,
+ const address_space *,
+ CORE_ADDR, int);
static int remove_breakpoint (struct bp_location *);
static int remove_breakpoint_1 (struct bp_location *, enum remove_bp_reason);
static bool is_masked_watchpoint (const struct breakpoint *b);
-/* Return 1 if B refers to a static tracepoint set by marker ("-m"), zero
- otherwise. */
+/* Return true if B refers to a static tracepoint set by marker ("-m"),
+ zero otherwise. */
-static int strace_marker_p (struct breakpoint *b);
+static bool strace_marker_p (struct breakpoint *b);
static void bkpt_probe_create_sals_from_location_spec
(location_spec *locspec,
/* Return true if GDB should evaluate breakpoint conditions or false
otherwise. */
-static int
+static bool
gdb_evaluates_breakpoint_condition_p (void)
{
const char *mode = breakpoint_condition_evaluation_mode ();
struct cmd_list_element *save_cmdlist;
/* Return whether a breakpoint is an active enabled breakpoint. */
-static int
+static bool
breakpoint_enabled (struct breakpoint *b)
{
return (b->enable_state == bp_enabled);
return simple_control;
}
-/* Return non-zero if BL->TARGET_INFO contains valid information. */
+/* Return true if BL->TARGET_INFO contains valid information. */
-static int
+static bool
bp_location_has_shadow (struct bp_location *bl)
{
if (bl->loc_type != bp_loc_software_breakpoint)
- return 0;
+ return false;
if (!bl->inserted)
- return 0;
+ return false;
if (bl->target_info.shadow_len == 0)
/* BL isn't valid, or doesn't shadow memory. */
- return 0;
- return 1;
+ return false;
+ return true;
}
/* Update BUF, which is LEN bytes read from the target address
and in any state. It is presently left to the target allowing
memory accesses when threads are running. */
-static int
+static bool
watchpoint_in_thread_scope (struct watchpoint *b)
{
return (b->pspace == current_program_space
}
/* Assuming that B is a watchpoint:
- - Reparse watchpoint expression, if REPARSE is non-zero
+ - Reparse watchpoint expression, if REPARSE is true
- Evaluate expression and store the result in B->val
- Evaluate the condition if there is one, and store the result
in b->loc->cond.
watchpoint removal from inferior. */
static void
-update_watchpoint (struct watchpoint *b, int reparse)
+update_watchpoint (struct watchpoint *b, bool reparse)
{
bool within_current_scope;
}
}
-
-/* Returns 1 iff breakpoint location should be
+/* Returns true iff breakpoint location should be
inserted in the inferior. We don't differentiate the type of BL's owner
(breakpoint vs. tracepoint), although insert_location in tracepoint's
breakpoint_ops is not defined, because in insert_bp_location,
tracepoint's insert_location will not be called. */
-static int
+
+static bool
should_be_inserted (struct bp_location *bl)
{
if (bl->owner == NULL || !breakpoint_enabled (bl->owner))
- return 0;
+ return false;
if (bl->owner->disposition == disp_del_at_next_stop)
- return 0;
+ return false;
if (!bl->enabled || bl->disabled_by_cond
|| bl->shlib_disabled || bl->duplicate)
- return 0;
+ return false;
if (user_breakpoint_p (bl->owner) && bl->pspace->executing_startup)
- return 0;
+ return false;
/* This is set for example, when we're attached to the parent of a
vfork, and have detached from the child. The child is running
the child could still trip on the parent's breakpoints. Since
the parent is blocked anyway, it won't miss any breakpoint. */
if (bl->pspace->breakpoints_not_allowed)
- return 0;
+ return false;
/* Don't insert a breakpoint if we're trying to step past its
location, except if the breakpoint is a single-step breakpoint,
{
infrun_debug_printf ("skipping breakpoint: stepping past insn at: %s",
paddress (bl->gdbarch, bl->address));
- return 0;
+ return false;
}
/* Don't insert watchpoints if we're trying to step past the
infrun_debug_printf ("stepping past non-steppable watchpoint. "
"skipping watchpoint at %s:%d",
paddress (bl->gdbarch, bl->address), bl->length);
- return 0;
+ return false;
}
- return 1;
+ return true;
}
/* Same as should_be_inserted but does the check assuming
static void
build_target_condition_list (struct bp_location *bl)
{
- int null_condition_or_parse_error = 0;
+ bool null_condition_or_parse_error = false;
int modified = bl->needs_update;
/* Release conditions left over from a previous insert. */
went wrong or we have a null condition expression. */
if (!loc->cond_bytecode)
{
- null_condition_or_parse_error = 1;
+ null_condition_or_parse_error = true;
break;
}
}
static void
build_target_command_list (struct bp_location *bl)
{
- int null_command_or_parse_error = 0;
+ bool null_command_or_parse_error = false;
int modified = bl->needs_update;
/* Clear commands left over from a previous insert. */
went wrong or we have a null command expression. */
if (!loc->cmd_bytecode)
{
- null_command_or_parse_error = 1;
+ null_command_or_parse_error = true;
break;
}
}
{
struct watchpoint *w = (struct watchpoint *) bpt;
- update_watchpoint (w, 0 /* don't reparse. */);
+ update_watchpoint (w, false /* don't reparse. */);
}
/* Updating watchpoints creates new locations, so update the global
them, as half-inserted watchpoint is of limited use. */
for (breakpoint *bpt : all_breakpoints ())
{
- int some_failed = 0;
+ bool some_failed = false;
if (!is_hardware_watchpoint (bpt))
continue;
for (bp_location *loc : bpt->locations ())
if (!loc->inserted && should_be_inserted (loc))
{
- some_failed = 1;
+ some_failed = true;
break;
}
/* Returns TRUE if MSYM point to the "not found" sentinel. */
-static int
+static bool
msym_not_found_p (const struct minimal_symbol *msym)
{
return msym == &msym_not_found;
/* Does B have a location spec? */
-static int
+static bool
breakpoint_location_spec_empty_p (const struct breakpoint *b)
{
return (b->locspec != nullptr && b->locspec->empty_p ());
enum breakpoint_here
breakpoint_here_p (const address_space *aspace, CORE_ADDR pc)
{
- int any_breakpoint_here = 0;
+ bool any_breakpoint_here = false;
for (bp_location *bl : all_bp_locations ())
{
else if (bl->permanent)
return permanent_breakpoint_here;
else
- any_breakpoint_here = 1;
+ any_breakpoint_here = true;
}
}
return 0;
}
-/* Returns non-zero iff BL is inserted at PC, in address space
- ASPACE. */
+/* Returns true iff BL is inserted at PC, in address space ASPACE. */
-static int
+static bool
bp_location_inserted_here_p (const struct bp_location *bl,
const address_space *aspace, CORE_ADDR pc)
{
&& breakpoint_address_match (bl->pspace->aspace, bl->address,
aspace, pc))
{
- if (overlay_debugging
- && section_is_overlay (bl->section)
- && !section_is_mapped (bl->section))
- return 0; /* unmapped overlay -- can't be a match */
- else
- return 1;
+ /* An unmapped overlay can't be a match. */
+ return !(overlay_debugging
+ && section_is_overlay (bl->section)
+ && !section_is_mapped (bl->section));
}
- return 0;
+ return false;
}
/* Returns non-zero iff there's a breakpoint inserted at PC. */
breakpoint_proceeded = 1;
}
-/* Return non-zero iff CMD as the first line of a command sequence is `silent'
+/* Return true iff CMD as the first line of a command sequence is `silent'
or its equivalent. */
-static int
+static bool
command_line_is_silent (struct command_line *cmd)
{
return cmd && (strcmp ("silent", cmd->line) == 0);
case, it is the caller's responsibility to recall it again with the
bpstat of the current thread. */
-static int
+static bool
bpstat_do_actions_1 (bpstat **bsp)
{
bpstat *bs;
- int again = 0;
+ bool again = false;
/* Avoid endless recursion if a `source' command is contained
in bs->commands. */
if (executing_breakpoint_commands)
- return 0;
+ return false;
scoped_restore save_executing
= make_scoped_restore (&executing_breakpoint_commands, 1);
command, and can easily blow up GDB stack. Instead, we
return true, which will trigger the caller to recall us
with the new stop_bpstat. */
- again = 1;
+ again = true;
break;
}
}
{
struct watchpoint *b;
frame_info_ptr fr;
- int within_current_scope;
+ bool within_current_scope;
/* BS is built from an existing struct breakpoint. */
gdb_assert (bs->breakpoint_at != NULL);
return WP_IGNORE;
if (b->exp_valid_block == NULL)
- within_current_scope = 1;
+ within_current_scope = true;
else
{
frame_info_ptr frame = get_current_frame ();
function = get_frame_function (fr);
if (function == NULL
|| !contained_in (b->exp_valid_block, function->value_block ()))
- within_current_scope = 0;
+ within_current_scope = false;
}
if (within_current_scope)
breakpoint location BL. This function does not check if we should
stop, only if BL explains the stop. */
-static int
+static bool
bpstat_check_location (const struct bp_location *bl,
const address_space *aspace, CORE_ADDR bp_addr,
const target_waitstatus &ws)
gdb_assert (b != NULL);
{
- int must_check_value = 0;
-
+ bool must_check_value = false;
+
if (b->type == bp_watchpoint)
/* For a software watchpoint, we must always check the
watched value. */
- must_check_value = 1;
+ must_check_value = true;
else if (b->watchpoint_triggered == watch_triggered_yes)
/* We have a hardware watchpoint (read, write, or access)
and the target earlier reported an address watched by
this watchpoint. */
- must_check_value = 1;
+ must_check_value = true;
else if (b->watchpoint_triggered == watch_triggered_unknown
&& 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
a data address, we can't figure it out. */
- must_check_value = 1;
+ must_check_value = true;
if (must_check_value)
{
break;
}
}
- else /* must_check_value == 0 */
+ else /* !must_check_value */
{
/* This is a case where some watchpoint(s) triggered, but
not at the address of this watchpoint, or else no
if (cond != nullptr && b->disposition != disp_del_at_next_stop)
{
- int within_current_scope = 1;
+ bool within_current_scope = true;
struct watchpoint * w;
/* We use scoped_value_mark because it could be a long time
if (frame != NULL)
select_frame (frame);
else
- within_current_scope = 0;
+ within_current_scope = false;
}
if (within_current_scope)
{
/* Returns true if we need to track moribund locations of LOC's type
on the current target. */
-static int
+static bool
need_moribund_for_location_type (const struct bp_location *loc)
{
return ((loc->loc_type == bp_loc_software_breakpoint
{
struct watchpoint *w = (struct watchpoint *) bs->breakpoint_at;
- update_watchpoint (w, 0 /* don't reparse. */);
+ update_watchpoint (w, false /* don't reparse. */);
need_remove_insert = 1;
}
static char bpenables[] = "nynny";
struct ui_out *uiout = current_uiout;
- int header_of_multiple = 0;
- int part_of_multiple = (loc != NULL);
+ bool header_of_multiple = false;
+ bool part_of_multiple = (loc != NULL);
struct value_print_options opts;
get_user_print_options (&opts);
&& (b->loc != NULL
&& (b->loc->next != NULL
|| !b->loc->enabled || b->loc->disabled_by_cond)))
- header_of_multiple = 1;
+ header_of_multiple = true;
if (loc == NULL)
loc = b->loc;
default_collect_info ();
}
-static int
+static bool
breakpoint_has_pc (struct breakpoint *b,
struct program_space *pspace,
CORE_ADDR pc, struct obj_section *section)
if (bl->pspace == pspace
&& bl->address == pc
&& (!overlay_debugging || bl->section == section))
- return 1;
+ return true;
}
- return 0;
+ return false;
}
/* See breakpoint.h. */
/* Assuming LOC1 and LOC2's owners are hardware watchpoints, returns
true if LOC1 and LOC2 represent the same watchpoint location. */
-static int
+static bool
watchpoint_locations_match (const struct bp_location *loc1,
const struct bp_location *loc2)
{
loc2->length,
loc2->watchpoint_type,
w2->cond_exp.get ())))
- return 0;
+ return false;
/* Note that this checks the owner's type, not the location's. In
case the target does not support read watchpoints, but does
matches ASPACE2. On targets that have global breakpoints, the address
space doesn't really matter. */
-static int
+static bool
breakpoint_address_match_range (const address_space *aspace1,
CORE_ADDR addr1,
int len1, const address_space *aspace2,
matches the breakpoint's address space. On targets that have global
breakpoints, the address space doesn't really matter. */
-static int
+static bool
breakpoint_location_address_match (struct bp_location *bl,
const address_space *aspace,
CORE_ADDR addr)
space. On targets that have global breakpoints, the address space
doesn't really matter. */
-static int
+static bool
breakpoint_location_address_range_overlap (struct bp_location *bl,
const address_space *aspace,
CORE_ADDR addr, int len)
Then, if LOC1 and LOC2 represent the same tracepoint location, returns
true, otherwise returns false. */
-static int
+static bool
tracepoint_locations_match (const struct bp_location *loc1,
const struct bp_location *loc2)
{
different locations. */
return (loc1->address == loc2->address && loc1->owner == loc2->owner);
else
- return 0;
+ return false;
}
/* Assuming LOC1 and LOC2's types' have meaningful target addresses
breakpoint locations and hardware breakpoint locations match,
otherwise they don't. */
-static int
+static bool
breakpoint_locations_match (const struct bp_location *loc1,
const struct bp_location *loc2,
bool sw_hw_bps_match)
hw_point2 = is_hardware_watchpoint (loc2->owner);
if (hw_point1 != hw_point2)
- return 0;
+ return false;
else if (hw_point1)
return watchpoint_locations_match (loc1, loc2);
else if (is_tracepoint (loc1->owner) || is_tracepoint (loc2->owner))
static void
breakpoint_adjustment_warning (CORE_ADDR from_addr, CORE_ADDR to_addr,
- int bnum, int have_bnum)
+ int bnum, bool have_bnum)
{
/* The longest string possibly returned by hex_string_custom
is 50 chars. These must be at least that big for safety. */
a user's expectations. Print a warning if an adjustment
is required. */
if (adjusted_bpaddr != bpaddr)
- breakpoint_adjustment_warning (bpaddr, adjusted_bpaddr, 0, 0);
+ breakpoint_adjustment_warning (bpaddr, adjusted_bpaddr, 0, false);
return adjusted_bpaddr;
}
static void
disable_breakpoints_in_unloaded_shlib (struct so_list *solib)
{
- int disabled_shlib_breaks = 0;
+ bool disabled_shlib_breaks = false;
for (bp_location *loc : all_bp_locations ())
{
"for unloaded shared library \"%s\""),
solib->so_name);
}
- disabled_shlib_breaks = 1;
+ disabled_shlib_breaks = true;
}
}
}
for (breakpoint *b : all_breakpoints ())
{
- int bp_modified = 0;
+ bool bp_modified = false;
if (!is_breakpoint (b) && !is_tracepoint (b))
continue;
mark_breakpoint_location_modified (loc);
- bp_modified = 1;
+ bp_modified = true;
}
}
unsigned flags)
{
struct linespec_result canonical;
- int pending = 0;
+ bool pending = false;
int task = 0;
int prev_bkpt_count = breakpoint_count;
a pending breakpoint and selected yes, or pending
breakpoint behavior is on and thus a pending breakpoint
is defaulted on behalf of the user. */
- pending = 1;
+ pending = true;
}
else
throw;
Don't do anything about disabled watchpoints, since they will be
reevaluated again when enabled. */
- update_watchpoint (this, 1 /* reparse */);
+ update_watchpoint (this, true /* reparse */);
}
/* Implement the "insert" method for hardware watchpoints. */
/* Finally update the new watchpoint. This creates the locations
that should be inserted. */
- update_watchpoint (w.get (), 1);
+ update_watchpoint (w.get (), true /* reparse */);
install_breakpoint (internal, std::move (w), 1);
}
for (breakpoint *b : all_tracepoints ())
{
struct tracepoint *t;
- int bp_location_downloaded = 0;
+ bool bp_location_downloaded = false;
if ((b->type == bp_fast_tracepoint
? !may_insert_fast_tracepoints
target_download_tracepoint (bl);
bl->inserted = 1;
- bp_location_downloaded = 1;
+ bp_location_downloaded = true;
}
t = (struct tracepoint *) b;
t->number_on_target = b->number;
{
/* Tells if 'old_loc' is found among the new locations. If
not, we have to free it. */
- int found_object = 0;
+ bool found_object = false;
/* Tells if the location should remain inserted in the target. */
- int keep_in_target = 0;
- int removed = 0;
+ bool keep_in_target = false;
+ bool removed = false;
/* Skip LOCP entries which will definitely never be needed.
Stop either at or being the one matching OLD_LOC. */
}
if (bp_locations[loc2_i] == old_loc)
- found_object = 1;
+ found_object = true;
}
/* We have already handled this address, update it so that we don't
{
/* The location is still present in the location list,
and still should be inserted. Don't do anything. */
- keep_in_target = 1;
+ keep_in_target = true;
}
else
{
if (unduplicated_should_be_inserted (loc2))
{
swap_insertion (old_loc, loc2);
- keep_in_target = 1;
+ keep_in_target = true;
break;
}
}
"breakpoint %d\n"),
old_loc->owner->number);
}
- removed = 1;
+ removed = true;
}
}
if (bl->address != bl->requested_address)
breakpoint_adjustment_warning (bl->requested_address,
bl->address,
- number, 1);
+ number, true);
annotate_breakpoint (number);
maybe_print_thread_hit_breakpoint (uiout);
strace_marker_create_breakpoints_sal,
};
-static int
+static bool
strace_marker_p (struct breakpoint *b)
{
return b->type == bp_static_marker_tracepoint;
PSPACE is NULL, all locations of all program spaces are
considered. */
-static int
+static bool
all_locations_are_pending (struct breakpoint *b, struct program_space *pspace)
{
for (bp_location *loc : b->locations ())
|| loc->pspace == pspace)
&& !loc->shlib_disabled
&& !loc->pspace->executing_startup)
- return 0;
- return 1;
+ return false;
+ return true;
}
/* Subroutine of update_breakpoint_locations to simplify it.
- Return non-zero if multiple fns in list LOC have the same name.
+ Return true if multiple fns in list LOC have the same name.
Null names are ignored. */
-static int
+static bool
ambiguous_names_p (struct bp_location *loc)
{
struct bp_location *l;
/* NOTE: We can assume slot != NULL here because xcalloc never
returns NULL. */
if (*slot != NULL)
- return 1;
+ return true;
*slot = name;
}
- return 0;
+ return false;
}
/* When symbols change, it probably means the sources changed as well,
return sal;
}
-/* Returns 1 iff locations A and B are sufficiently same that
+/* Returns true iff locations A and B are sufficiently same that
we don't need to report breakpoint as changed. */
-static int
+static bool
locations_are_equal (struct bp_location *a, struct bp_location *b)
{
while (a && b)
{
if (a->address != b->address)
- return 0;
+ return false;
if (a->shlib_disabled != b->shlib_disabled)
- return 0;
+ return false;
if (a->enabled != b->enabled)
- return 0;
+ return false;
if (a->disabled_by_cond != b->disabled_by_cond)
- return 0;
+ return false;
a = a->next;
b = b->next;
}
if ((a == NULL) != (b == NULL))
- return 0;
+ return false;
- return 1;
+ return true;
}
/* Split all locations of B that are bound to PSPACE out of B's
}
catch (gdb_exception_error &e)
{
- int not_found_and_ok = 0;
+ int not_found_and_ok = false;
/* For pending breakpoints, it's expected that parsing will
fail until the right shared library is loaded. User has
|| (loc && loc->shlib_disabled)
|| (loc && loc->pspace->executing_startup)
|| enable_state == bp_disabled))
- not_found_and_ok = 1;
+ not_found_and_ok = true;
if (!not_found_and_ok)
{
orig_enable_state = bpt->enable_state;
bpt->enable_state = bp_enabled;
- update_watchpoint (w, 1 /* reparse */);
+ update_watchpoint (w, true /* reparse */);
}
catch (const gdb_exception &e)
{
save_breakpoints (const char *filename, int from_tty,
bool (*filter) (const struct breakpoint *))
{
- int any = 0;
+ bool any = false;
int extra_trace_bits = 0;
if (filename == 0 || *filename == 0)
if (filter && !filter (tp))
continue;
- any = 1;
+ any = true;
if (is_tracepoint (tp))
{
set_cmd_completer (command, completer);
}
-/* Zero if any of the breakpoint's locations could be a location where
- functions have been inlined, nonzero otherwise. */
+/* False if any of the breakpoint's locations could be a location where
+ functions have been inlined, true otherwise. */
-static int
+static bool
is_non_inline_function (struct breakpoint *b)
{
/* The shared library event breakpoint is set on the address of a
non-inline function. */
- if (b->type == bp_shlib_event)
- return 1;
-
- return 0;
+ return (b->type == bp_shlib_event);
}
/* Nonzero if the specified PC cannot be a location where functions