if (!is_breakpoint (b))
return;
- for (bp_location *loc : b->locations ())
- loc->condition_changed = condition_modified;
+ for (bp_location &loc : b->locations ())
+ loc.condition_changed = condition_modified;
}
/* Mark location as "conditions have changed" in case the target supports
else
{
int loc_num = 1;
- for (bp_location *loc : b->locations ())
+ for (bp_location &loc : b->locations ())
{
- loc->cond.reset ();
- if (loc->disabled_by_cond && loc->enabled)
+ loc.cond.reset ();
+ if (loc.disabled_by_cond && loc.enabled)
gdb_printf (_("Breakpoint %d's condition is now valid at "
"location %d, enabling.\n"),
b->number, loc_num);
- loc->disabled_by_cond = false;
+ loc.disabled_by_cond = false;
loc_num++;
/* No need to free the condition agent expression
the error and the condition string will be rejected.
This two-pass approach is taken to avoid setting the
state of locations in case of a reject. */
- for (const bp_location *loc : b->locations ())
+ for (const bp_location &loc : b->locations ())
{
try
{
const char *arg = exp;
- parse_exp_1 (&arg, loc->address,
- block_for_pc (loc->address), 0);
+ parse_exp_1 (&arg, loc.address,
+ block_for_pc (loc.address), 0);
if (*arg != 0)
error (_("Junk at end of expression"));
break;
/* Condition string is invalid. If this happens to
be the last loc, abandon (if not forced) or continue
(if forced). */
- if (loc == &b->last_loc () && !force)
+ if (&loc == &b->last_loc () && !force)
throw;
}
}
/* If we reach here, the condition is valid at some locations. */
int loc_num = 1;
- for (bp_location *loc : b->locations ())
+ for (bp_location &loc : b->locations ())
{
- set_breakpoint_location_condition (exp, loc, b->number, loc_num);
+ set_breakpoint_location_condition (exp, &loc, b->number, loc_num);
loc_num++;
}
}
if (b->type == bp_static_tracepoint
|| b->type == bp_static_marker_tracepoint)
{
- for (bp_location *loc : b->locations ())
- if (loc->address == addr)
+ for (bp_location &loc : b->locations ())
+ if (loc.address == addr)
found.push_back (b);
}
loc_type = (b->type == bp_watchpoint? bp_loc_software_watchpoint
: bp_loc_hardware_watchpoint);
- for (bp_location *bl : b->locations ())
- bl->loc_type = loc_type;
+
+ for (bp_location &bl : b->locations ())
+ bl.loc_type = loc_type;
}
/* If a software watchpoint is not watching any memory, then the
if (bpt->disposition == disp_del_at_next_stop)
continue;
-
- for (bp_location *loc : bpt->locations ())
- if (!loc->inserted && should_be_inserted (loc))
+
+ for (bp_location &loc : bpt->locations ())
+ if (!loc.inserted && should_be_inserted (&loc))
{
some_failed = true;
break;
if (some_failed)
{
- for (bp_location *loc : bpt->locations ())
- if (loc->inserted)
- remove_breakpoint (loc);
+ for (bp_location &loc : bpt->locations ())
+ if (loc.inserted)
+ remove_breakpoint (&loc);
hw_breakpoint_error = 1;
tmp_error_stream.printf ("Could not insert "
if (!breakpoint_enabled (bpt))
continue;
- for (bp_location *loc : bpt->locations ())
- if (loc->pspace->aspace == aspace && loc->inserted)
+ for (bp_location &loc : bpt->locations ())
+ if (loc.pspace->aspace == aspace && loc.inserted)
{
CORE_ADDR l, h;
/* Check for intersection. */
- l = std::max<CORE_ADDR> (loc->address, addr);
- h = std::min<CORE_ADDR> (loc->address + loc->length, addr + len);
+ l = std::max<CORE_ADDR> (loc.address, addr);
+ h = std::min<CORE_ADDR> (loc.address + loc.length, addr + len);
if (l < h)
return 1;
}
{
int locno = 1;
- for (bp_location *loc : b->locations ())
+ for (bp_location &loc : b->locations ())
{
- if (bl == loc)
+ if (bl == &loc)
return locno;
++locno;
struct watchpoint *w = (struct watchpoint *) b;
w->watchpoint_triggered = watch_triggered_no;
- for (bp_location *loc : b->locations ())
+ for (bp_location &loc : b->locations ())
{
if (is_masked_watchpoint (b))
{
CORE_ADDR newaddr = addr & w->hw_wp_mask;
- CORE_ADDR start = loc->address & w->hw_wp_mask;
+ CORE_ADDR start = loc.address & w->hw_wp_mask;
if (newaddr == start)
{
}
/* Exact match not required. Within range is sufficient. */
else if (target_watchpoint_addr_within_range
- (current_inferior ()->top_target (), addr, loc->address,
- loc->length))
+ (current_inferior ()->top_target (), addr, loc.address,
+ loc.length))
{
w->watchpoint_triggered = watch_triggered_yes;
break;
if (!breakpoint_enabled (b))
continue;
- for (bp_location *bl : b->locations ())
+ for (bp_location &bl : b->locations ())
{
/* For hardware watchpoints, we look only at the first
location. The watchpoint_check function will work on the
entire expression, not the individual locations. For
read watchpoints, the watchpoints_triggered function has
checked all locations already. */
- if (b->type == bp_hardware_watchpoint && bl != &b->first_loc ())
+ if (b->type == bp_hardware_watchpoint && &bl != &b->first_loc ())
break;
- if (!bl->enabled || bl->disabled_by_cond || bl->shlib_disabled)
+ if (!bl.enabled || bl.disabled_by_cond || bl.shlib_disabled)
continue;
- if (!bpstat_check_location (bl, aspace, bp_addr, ws))
+ if (!bpstat_check_location (&bl, aspace, bp_addr, ws))
continue;
/* Come here if it's a watchpoint, or if the break address
matches. */
- bpstat *bs = new bpstat (bl, &bs_link); /* Alloc a bpstat to
+ bpstat *bs = new bpstat (&bl, &bs_link); /* Alloc a bpstat to
explain stop. */
/* Assume we stop. Should we find a watchpoint that is not
|| !target_supports_evaluation_of_breakpoint_conditions ())
return condition_evaluation_host;
- for (bp_location *bl : b->locations ())
+ for (bp_location &bl : b->locations ())
{
- if (bl->cond_bytecode)
+ if (bl.cond_bytecode)
target_evals++;
else
host_evals++;
locations_list.emplace (uiout, "locations");
int n = 1;
- for (bp_location *loc : b->locations ())
+ for (bp_location &loc : b->locations ())
{
ui_out_emit_tuple loc_tuple_emitter (uiout, NULL);
- print_one_breakpoint_location (b, loc, n, last_loc,
+ print_one_breakpoint_location (b, &loc, n, last_loc,
allflag, allflag);
n++;
}
{
int print_address_bits = 0;
- for (bp_location *loc : b->locations ())
+ for (bp_location &loc : b->locations ())
{
- if (!bl_address_is_meaningful (loc))
+ if (!bl_address_is_meaningful (&loc))
continue;
- int addr_bit = gdbarch_addr_bit (loc->gdbarch);
+ int addr_bit = gdbarch_addr_bit (loc.gdbarch);
if (addr_bit > print_address_bits)
print_address_bits = addr_bit;
}
if (show_internal || user_breakpoint_p (b))
{
print_one_breakpoint (b, &last_loc, show_internal);
- for (bp_location *loc : b->locations ())
- if (loc->disabled_by_cond)
+ for (bp_location &loc : b->locations ())
+ if (loc.disabled_by_cond)
has_disabled_by_cond_location = true;
}
}
struct program_space *pspace,
CORE_ADDR pc, struct obj_section *section)
{
- for (bp_location *bl : b->locations ())
+ for (bp_location &bl : b->locations ())
{
- if (bl->pspace == pspace
- && bl->address == pc
- && (!overlay_debugging || bl->section == section))
+ if (bl.pspace == pspace
+ && bl.address == pc
+ && (!overlay_debugging || bl.section == section))
return true;
}
return false;
if (!is_breakpoint (b) && !is_tracepoint (b))
continue;
- for (bp_location *loc : b->locations ())
+ for (bp_location &loc : b->locations ())
{
- CORE_ADDR loc_addr = loc->address;
+ CORE_ADDR loc_addr = loc.address;
- if (loc->loc_type != bp_loc_hardware_breakpoint
- && loc->loc_type != bp_loc_software_breakpoint)
+ if (loc.loc_type != bp_loc_hardware_breakpoint
+ && loc.loc_type != bp_loc_software_breakpoint)
continue;
- if (loc->shlib_disabled != 0)
+ if (loc.shlib_disabled != 0)
continue;
- if (objfile->pspace != loc->pspace)
+ if (objfile->pspace != loc.pspace)
continue;
- if (loc->loc_type != bp_loc_hardware_breakpoint
- && loc->loc_type != bp_loc_software_breakpoint)
+ if (loc.loc_type != bp_loc_hardware_breakpoint
+ && loc.loc_type != bp_loc_software_breakpoint)
continue;
if (is_addr_in_objfile (loc_addr, objfile))
{
- loc->shlib_disabled = 1;
+ loc.shlib_disabled = 1;
/* At this point, we don't know whether the object was
unmapped from the inferior or not, so leave the
inserted flag alone. We'll handle failure to
uninsert quietly, in case the object was indeed
unmapped. */
- mark_breakpoint_location_modified (loc);
+ mark_breakpoint_location_modified (&loc);
bp_modified = true;
}
for (breakpoint *b : all_breakpoints ())
if (b->type == bp_hardware_breakpoint && breakpoint_enabled (b))
- for (bp_location *bl : b->locations ())
+ for (bp_location &bl : b->locations ())
{
/* Special types of hardware breakpoints may use more than
one register. */
- i += b->resources_needed (bl);
+ i += b->resources_needed (&bl);
}
return i;
if (!breakpoint_enabled (b))
return 0;
- for (bp_location *bl : b->locations ())
+ for (bp_location &bl : b->locations ())
{
/* Special types of hardware watchpoints may use more than
one register. */
- i += b->resources_needed (bl);
+ i += b->resources_needed (&bl);
}
return i;
/* The order of the locations is now stable. Set the location
condition using the location's number. */
int loc_num = 1;
- for (bp_location *bl : locations ())
+ for (bp_location &bl : locations ())
{
if (cond_string != nullptr)
- set_breakpoint_location_condition (cond_string.get (), bl,
+ set_breakpoint_location_condition (cond_string.get (), &bl,
number, loc_num);
++loc_num;
if (b->type != bp_none && !is_watchpoint (b)
&& user_breakpoint_p (b))
{
- for (bp_location *loc : b->locations ())
+ for (bp_location &loc : b->locations ())
{
/* If the user specified file:line, don't allow a PC
match. This matches historical gdb behavior. */
int pc_match = (!sal.explicit_line
&& sal.pc
- && (loc->pspace == sal.pspace)
- && (loc->address == sal.pc)
- && (!section_is_overlay (loc->section)
- || loc->section == sal.section));
+ && (loc.pspace == sal.pspace)
+ && (loc.address == sal.pc)
+ && (!section_is_overlay (loc.section)
+ || loc.section == sal.section));
int line_match = 0;
if ((default_match || sal.explicit_line)
- && loc->symtab != NULL
+ && loc.symtab != NULL
&& sal_fullname != NULL
- && sal.pspace == loc->pspace
- && loc->line_number == sal.line
- && filename_cmp (symtab_to_fullname (loc->symtab),
+ && sal.pspace == loc.pspace
+ && loc.line_number == sal.line
+ && filename_cmp (symtab_to_fullname (loc.symtab),
sal_fullname) == 0)
line_match = 1;
if (can_download_tracepoint == TRIBOOL_FALSE)
break;
- for (bp_location *bl : b->locations ())
+ for (bp_location &bl : b->locations ())
{
/* In tracepoint, locations are _never_ duplicated, so
should_be_inserted is equivalent to
unduplicated_should_be_inserted. */
- if (!should_be_inserted (bl) || bl->inserted)
+ if (!should_be_inserted (&bl) || bl.inserted)
continue;
- switch_to_program_space_and_thread (bl->pspace);
+ switch_to_program_space_and_thread (bl.pspace);
- target_download_tracepoint (bl);
+ target_download_tracepoint (&bl);
- bl->inserted = 1;
+ bl.inserted = 1;
bp_location_downloaded = true;
}
t = (struct tracepoint *) b;
bp_locations.clear ();
for (breakpoint *b : all_breakpoints ())
- for (bp_location *loc : b->locations ())
- bp_locations.push_back (loc);
+ for (bp_location &loc : b->locations ())
+ bp_locations.push_back (&loc);
/* See if we need to "upgrade" a software breakpoint to a hardware
breakpoint. Do this before deciding whether locations are
bp_location_range breakpoint::locations () const
{
- return bp_location_range
- (bp_location_pointer_iterator (m_locations.begin ()),
- bp_location_pointer_iterator (m_locations.end ()));
+ return bp_location_range (m_locations.begin (), m_locations.end ());
}
struct bp_location *
static bool
all_locations_are_pending (struct breakpoint *b, struct program_space *pspace)
{
- for (bp_location *loc : b->locations ())
+ for (bp_location &loc : b->locations ())
if ((pspace == NULL
- || loc->pspace == pspace)
- && !loc->shlib_disabled
- && !loc->pspace->executing_startup)
+ || loc.pspace == pspace)
+ && !loc.shlib_disabled
+ && !loc.pspace->executing_startup)
return false;
return true;
}
htab_up htab (htab_create_alloc (13, htab_hash_string, htab_eq_string, NULL,
xcalloc, xfree));
- for (const bp_location *l : locs)
+ for (const bp_location &l : locs)
{
const char **slot;
- const char *name = l->function_name.get ();
+ const char *name = l.function_name.get ();
/* Allow for some names to be NULL, ignore them. */
if (name == NULL)
for (; a_iter != a.end () && b_iter != b.end (); ++a_iter, ++b_iter)
{
- if (a_iter->address != (*b_iter)->address)
+ if (a_iter->address != b_iter->address)
return false;
- if (a_iter->shlib_disabled != (*b_iter)->shlib_disabled)
+ if (a_iter->shlib_disabled != b_iter->shlib_disabled)
return false;
- if (a_iter->enabled != (*b_iter)->enabled)
+ if (a_iter->enabled != b_iter->enabled)
return false;
- if (a_iter->disabled_by_cond != (*b_iter)->disabled_by_cond)
+ if (a_iter->disabled_by_cond != b_iter->disabled_by_cond)
return false;
}
{
if (have_ambiguous_names)
{
- for (bp_location *l : b->locations ())
+ for (bp_location &l : b->locations ())
{
/* Ignore software vs hardware location type at
this point, because with "set breakpoint
As mentioned above, this is an heuristic and in
practice should give the correct answer often
enough. */
- if (breakpoint_locations_match (&e, l, true))
+ if (breakpoint_locations_match (&e, &l, true))
{
- l->enabled = e.enabled;
- l->disabled_by_cond = e.disabled_by_cond;
+ l.enabled = e.enabled;
+ l.disabled_by_cond = e.disabled_by_cond;
break;
}
}
}
else
{
- for (bp_location *l : b->locations ())
- if (l->function_name
+ for (bp_location &l : b->locations ())
+ if (l.function_name
&& strcmp (e.function_name.get (),
- l->function_name.get ()) == 0)
+ l.function_name.get ()) == 0)
{
- l->enabled = e.enabled;
- l->disabled_by_cond = e.disabled_by_cond;
+ l.enabled = e.enabled;
+ l.disabled_by_cond = e.disabled_by_cond;
break;
}
}
error (_("Bad breakpoint location number '%d'"), loc_num);
int n = 0;
- for (bp_location *loc : b->locations ())
+ for (bp_location &loc : b->locations ())
if (++n == loc_num)
- return loc;
+ return &loc;
error (_("Bad breakpoint location number '%d'"), loc_num);
}
{
/* Locations use 1-based indexing. */
int loc_num = 1;
- for (bp_location *it : loc->owner->locations ())
+ for (bp_location &it : loc->owner->locations ())
{
- if (it == loc)
+ if (&it == loc)
return loc_num;
loc_num++;
}
if (target_supports_enable_disable_tracepoint ()
&& current_trace_status ()->running && is_tracepoint (bpt))
{
- for (bp_location *location : bpt->locations ())
- target_disable_tracepoint (location);
+ for (bp_location &location : bpt->locations ())
+ target_disable_tracepoint (&location);
}
update_global_location_list (UGLL_DONT_INSERT);
if (target_supports_enable_disable_tracepoint ()
&& current_trace_status ()->running && is_tracepoint (bpt))
{
- for (bp_location *location : bpt->locations ())
- target_enable_tracepoint (location);
+ for (bp_location &location : bpt->locations ())
+ target_enable_tracepoint (&location);
}
bpt->disposition = disposition;
if (wp->val_valid && wp->val != nullptr)
{
- for (bp_location *loc : bp->locations ())
- if (loc->loc_type == bp_loc_hardware_watchpoint
- && loc->address + loc->length > addr
- && addr + len > loc->address)
+ for (bp_location &loc : bp->locations ())
+ if (loc.loc_type == bp_loc_hardware_watchpoint
+ && loc.address + loc.length > addr
+ && addr + len > loc.address)
{
wp->val = NULL;
wp->val_valid = false;
const address_space *aspace,
CORE_ADDR pc)
{
- for (bp_location *loc : bp->locations ())
- if (loc->inserted
- && breakpoint_location_address_match (loc, aspace, pc))
+ for (bp_location &loc : bp->locations ())
+ if (loc.inserted
+ && breakpoint_location_address_match (&loc, aspace, pc))
return 1;
return 0;
{
int n = 1;
- for (bp_location *loc : tp->locations ())
+ for (bp_location &loc : tp->locations ())
{
- if (!loc->enabled)
+ if (!loc.enabled)
fp.printf ("disable $bpnum.%d\n", n);
n++;
if (!is_non_inline_function (b))
continue;
- for (bp_location *bl : b->locations ())
+ for (bp_location &bl : b->locations ())
{
- if (!bl->shlib_disabled
- && bpstat_check_location (bl, aspace, pc, ws))
+ if (!bl.shlib_disabled
+ && bpstat_check_location (&bl, aspace, pc, ws))
return 1;
}
}
/* else fall thru, treat p as an expression and parse it! */
}
tmp_p = p;
- for (bp_location *loc : t->locations ())
+ for (bp_location &loc : t->locations ())
{
p = tmp_p;
- expression_up exp = parse_exp_1 (&p, loc->address,
- block_for_pc (loc->address),
+ expression_up exp = parse_exp_1 (&p, loc.address,
+ block_for_pc (loc.address),
PARSER_COMMA_TERMINATES);
if (exp->first_opcode () == OP_VAR_VALUE)
/* We have something to collect, make sure that the expr to
bytecode translator can handle it and that it's not too
long. */
- agent_expr_up aexpr = gen_trace_for_expr (loc->address,
+ agent_expr_up aexpr = gen_trace_for_expr (loc.address,
exp.get (),
trace_string);
p = skip_spaces (p);
tmp_p = p;
- for (bp_location *loc : t->locations ())
+ for (bp_location &loc : t->locations ())
{
p = tmp_p;
/* Only expressions are allowed for this action. */
- expression_up exp = parse_exp_1 (&p, loc->address,
- block_for_pc (loc->address),
+ expression_up exp = parse_exp_1 (&p, loc.address,
+ block_for_pc (loc.address),
PARSER_COMMA_TERMINATES);
/* We have something to evaluate, make sure that the expr to
bytecode translator can handle it and that it's not too
long. */
- agent_expr_up aexpr = gen_eval_for_expr (loc->address, exp.get ());
+ agent_expr_up aexpr = gen_eval_for_expr (loc.address, exp.get ());
finalize_tracepoint_aexpr (aexpr.get ());
}
}
else
{
- for (bp_location *loc1 : b->locations ())
+ for (bp_location &loc1 : b->locations ())
{
- if (loc1->shlib_disabled)
+ if (loc1.shlib_disabled)
{
has_pending_p = 1;
break;
int bp_location_downloaded = 0;
/* Clear `inserted' flag. */
- for (bp_location *loc : b->locations ())
- loc->inserted = 0;
+ for (bp_location &loc : b->locations ())
+ loc.inserted = 0;
if ((b->type == bp_fast_tracepoint
? !may_insert_fast_tracepoints
t->number_on_target = 0;
- for (bp_location *loc : b->locations ())
+ for (bp_location &loc : b->locations ())
{
/* Since tracepoint locations are never duplicated, `inserted'
flag should be zero. */
- gdb_assert (!loc->inserted);
+ gdb_assert (!loc.inserted);
- target_download_tracepoint (loc);
+ target_download_tracepoint (&loc);
- loc->inserted = 1;
+ loc.inserted = 1;
bp_location_downloaded = 1;
}
t->number_on_target = b->number;
- for (bp_location *loc : b->locations ())
- if (loc->probe.prob != NULL)
- loc->probe.prob->set_semaphore (loc->probe.objfile,
- loc->gdbarch);
+ for (bp_location &loc : b->locations ())
+ if (loc.probe.prob != NULL)
+ loc.probe.prob->set_semaphore (loc.probe.objfile, loc.gdbarch);
if (bp_location_downloaded)
gdb::observers::breakpoint_modified.notify (b);
: !may_insert_tracepoints))
continue;
- for (bp_location *loc : t->locations ())
+ for (bp_location &loc : t->locations ())
{
/* GDB can be totally absent in some disconnected trace scenarios,
but we don't really care if this semaphore goes out of sync.
That's why we are decrementing it here, but not taking care
in other places. */
- if (loc->probe.prob != NULL)
- loc->probe.prob->clear_semaphore (loc->probe.objfile,
- loc->gdbarch);
+ if (loc.probe.prob != NULL)
+ loc.probe.prob->clear_semaphore (loc.probe.objfile, loc.gdbarch);
}
}
locations, assume it is a direct hit rather than a while-stepping
frame. (FIXME this is not reliable, should record each frame's
type.) */
- for (bp_location *tloc : t->locations ())
- if (tloc->address == regcache_read_pc (regcache))
+ for (bp_location &tloc : t->locations ())
+ if (tloc.address == regcache_read_pc (regcache))
{
*stepping_frame_p = 0;
- return tloc;
+ return &tloc;
}
/* If this is a stepping frame, we don't know which location
)
{
/* Scan the locations for an address match. */
- for (bp_location *loc : b->locations ())
- {
- if (loc->address == utp->addr)
- return loc;
- }
+ for (bp_location &loc : b->locations ())
+ if (loc.address == utp->addr)
+ return &loc;
}
}
return NULL;