breakpoint or a single step breakpoint. */
if (frame_id_p (b->frame_id)
- && !frame_id_eq (b->frame_id, get_stack_frame_id (get_current_frame ())))
+ && b->frame_id != get_stack_frame_id (get_current_frame ()))
{
infrun_debug_printf ("incorrect frame %s not %s, not stopping",
get_stack_frame_id (get_current_frame ()).to_string ().c_str (),
dummy_frame_id_eq (struct dummy_frame_id *id1,
struct dummy_frame_id *id2)
{
- return frame_id_eq (id1->id, id2->id) && id1->thread == id2->thread;
+ return id1->id == id2->id && id1->thread == id2->thread;
}
/* List of dummy_frame destructors. */
pop_dummy_frame_bpt (struct breakpoint *b, struct dummy_frame *dummy)
{
if (b->thread == dummy->id.thread->global_num
- && b->disposition == disp_del && frame_id_eq (b->frame_id, dummy->id.id))
+ && b->disposition == disp_del && b->frame_id == dummy->id.id)
{
while (b->related_breakpoint != b)
delete_breakpoint (b->related_breakpoint);
if (b_return->thread == thread_id
&& b_return->loc->requested_address == prev_pc
- && frame_id_eq (b_return->frame_id, prev_frame_id))
+ && b_return->frame_id == prev_frame_id)
break;
}
{
struct frame_id this_id = get_frame_id (this_frame);
- if (frame_id_eq (this_id, outer_frame_id))
+ if (this_id == outer_frame_id)
return UNWIND_OUTERMOST;
else
return UNWIND_NO_REASON;
}
/* Internal equality function for the hash table. This function
- defers equality operations to frame_id_eq. */
+ defers equality operations to frame_id::operator==. */
static int
frame_addr_hash_eq (const void *a, const void *b)
const struct frame_info *f_entry = (const struct frame_info *) a;
const struct frame_info *f_element = (const struct frame_info *) b;
- return frame_id_eq (f_entry->this_id.value,
- f_element->this_id.value);
+ return f_entry->this_id.value == f_element->this_id.value;
}
/* Internal function to create the frame_stash hash table. 100 seems
}
bool
-frame_id_eq (frame_id l, frame_id r)
+frame_id::operator== (const frame_id &r) const
{
bool eq;
- if (l.stack_status == FID_STACK_INVALID
+ if (stack_status == FID_STACK_INVALID
|| r.stack_status == FID_STACK_INVALID)
/* Like a NaN, if either ID is invalid, the result is false.
Note that a frame ID is invalid iff it is the null frame ID. */
eq = false;
- else if (l.stack_status != r.stack_status || l.stack_addr != r.stack_addr)
+ else if (stack_status != r.stack_status || stack_addr != r.stack_addr)
/* If .stack addresses are different, the frames are different. */
eq = false;
- else if (l.code_addr_p && r.code_addr_p && l.code_addr != r.code_addr)
+ else if (code_addr_p && r.code_addr_p && code_addr != r.code_addr)
/* An invalid code addr is a wild card. If .code addresses are
different, the frames are different. */
eq = false;
- else if (l.special_addr_p && r.special_addr_p
- && l.special_addr != r.special_addr)
+ else if (special_addr_p && r.special_addr_p
+ && special_addr != r.special_addr)
/* An invalid special addr is a wild card (or unused). Otherwise
if special addresses are different, the frames are different. */
eq = false;
- else if (l.artificial_depth != r.artificial_depth)
+ else if (artificial_depth != r.artificial_depth)
/* If artificial depths are different, the frames must be different. */
eq = false;
else
eq = true;
frame_debug_printf ("l=%s, r=%s -> %d",
- l.to_string ().c_str (), r.to_string ().c_str (), eq);
+ to_string ().c_str (), r.to_string ().c_str (), eq);
return eq;
}
return NULL;
/* Check for the sentinel frame. */
- if (frame_id_eq (id, sentinel_frame_id))
+ if (id == sentinel_frame_id)
return sentinel_frame;
/* Try using the frame stash first. Finding it there removes the need
{
struct frame_id self = get_frame_id (frame);
- if (frame_id_eq (id, self))
+ if (id == self)
/* An exact match. */
return frame;
it's highly unlikely the search by level finds the wrong
frame, it's 99.9(9)% of the time (for all practical purposes)
safe. */
- && frame_id_eq (get_frame_id (frame), a_frame_id))
+ && get_frame_id (frame) == a_frame_id)
{
/* Cool, all is fine. */
select_frame (frame);
/* Return a string representation of this frame id. */
std::string to_string () const;
+
+ /* Returns true when this frame_id and R identify the same
+ frame. */
+ bool operator== (const frame_id &r) const;
+
+ /* Inverse of ==. */
+ bool operator!= (const frame_id &r) const
+ {
+ return !(*this == r);
+ }
};
/* Save and restore the currently selected frame. */
TAILCALL_FRAME. */
extern bool frame_id_artificial_p (frame_id l);
-/* Returns true when L and R identify the same frame. */
-extern bool frame_id_eq (frame_id l, frame_id r);
-
/* Frame types. Some are real, some are signal trampolines, and some
are completely artificial (dummy). */
/* Return the per-frame unique identifer. Can be used to relocate a
frame after a frame cache flush (and other similar operations). If
- FI is NULL, return the null_frame_id.
-
- NOTE: kettenis/20040508: These functions return a structure. On
- platforms where structures are returned in static storage (vax,
- m68k), this may trigger compiler bugs in code like:
-
- if (frame_id_eq (get_frame_id (l), get_frame_id (r)))
-
- where the return value from the first get_frame_id (l) gets
- overwritten by the second get_frame_id (r). Please avoid writing
- code like this. Use code like:
-
- struct frame_id id = get_frame_id (l);
- if (frame_id_eq (id, get_frame_id (r)))
-
- instead, since that avoids the bug. */
+ FI is NULL, return the null_frame_id. */
extern struct frame_id get_frame_id (struct frame_info *fi);
extern struct frame_id get_stack_frame_id (struct frame_info *fi);
extern struct frame_id frame_unwind_caller_id (struct frame_info *next_frame);
const frame_smob *a = (const frame_smob *) ap;
const frame_smob *b = (const frame_smob *) bp;
- return (frame_id_eq (a->frame_id, b->frame_id)
+ return (a->frame_id == b->frame_id
&& a->inferior == b->inferior
&& a->inferior != NULL);
}
CORE_ADDR bsp;
libunwind_frame_this_id (this_frame, this_cache, &id);
- if (frame_id_eq (id, outer_frame_id))
+ if (id == outer_frame_id)
{
(*this_id) = outer_frame_id;
return;
struct frame_id id = outer_frame_id;
libunwind_frame_this_id (this_frame, this_cache, &id);
- if (frame_id_eq (id, outer_frame_id))
+ if (id == outer_frame_id)
{
(*this_id) = outer_frame_id;
return;
frame != NULL;
frame = get_prev_frame (frame))
{
- if (frame_id_eq (get_frame_id (frame), step_frame_id))
+ if (get_frame_id (frame) == step_frame_id)
return true;
if (get_frame_type (frame) != INLINE_FRAME)
symtab_and_line sal;
struct symbol *sym;
- if (frame_id_eq (get_frame_id (frame), tp->control.step_frame_id))
+ if (get_frame_id (frame) == tp->control.step_frame_id)
break;
if (get_frame_type (frame) != INLINE_FRAME)
break;
&& (pc_in_thread_step_range (ecs->event_thread->stop_pc (),
ecs->event_thread)
|| ecs->event_thread->control.step_range_end == 1)
- && frame_id_eq (get_stack_frame_id (frame),
- ecs->event_thread->control.step_stack_frame_id)
+ && (get_stack_frame_id (frame)
+ == ecs->event_thread->control.step_stack_frame_id)
&& ecs->event_thread->control.step_resume_breakpoint == NULL)
{
/* The inferior is about to take a signal that will take it
{
struct frame_id current_id
= get_frame_id (get_current_frame ());
- if (frame_id_eq (current_id,
- ecs->event_thread->initiating_frame))
+ if (current_id == ecs->event_thread->initiating_frame)
{
/* Case 2. Fall through. */
}
if (pc_in_thread_step_range (ecs->event_thread->stop_pc (),
ecs->event_thread)
&& (execution_direction != EXEC_REVERSE
- || frame_id_eq (get_frame_id (frame),
- ecs->event_thread->control.step_frame_id)))
+ || get_frame_id (frame) == ecs->event_thread->control.step_frame_id))
{
infrun_debug_printf
("stepping inside range [%s-%s]",
previous frame's ID is sufficient - but it is a common case and
cheaper than checking the previous frame's ID.
- NOTE: frame_id_eq will never report two invalid frame IDs as
+ NOTE: frame_id::operator== will never report two invalid frame IDs as
being equal, so to get into this block, both the current and
previous frame must have valid frame IDs. */
/* The outer_frame_id check is a heuristic to detect stepping
"outermost" function. This could be fixed by marking
outermost frames as !stack_p,code_p,special_p. Then the
initial outermost frame, before sp was valid, would
- have code_addr == &_start. See the comment in frame_id_eq
+ have code_addr == &_start. See the comment in frame_id::operator==
for more. */
- if (!frame_id_eq (get_stack_frame_id (frame),
- ecs->event_thread->control.step_stack_frame_id)
- && (frame_id_eq (frame_unwind_caller_id (get_current_frame ()),
- ecs->event_thread->control.step_stack_frame_id)
- && (!frame_id_eq (ecs->event_thread->control.step_stack_frame_id,
- outer_frame_id)
+ if ((get_stack_frame_id (frame)
+ != ecs->event_thread->control.step_stack_frame_id)
+ && ((frame_unwind_caller_id (get_current_frame ())
+ == ecs->event_thread->control.step_stack_frame_id)
+ && ((ecs->event_thread->control.step_stack_frame_id
+ != outer_frame_id)
|| (ecs->event_thread->control.step_start_function
!= find_pc_function (ecs->event_thread->stop_pc ())))))
{
frame machinery detected some skipped call sites, we have entered
a new inline function. */
- if (frame_id_eq (get_frame_id (get_current_frame ()),
- ecs->event_thread->control.step_frame_id)
+ if ((get_frame_id (get_current_frame ())
+ == ecs->event_thread->control.step_frame_id)
&& inline_skipped_frames (ecs->event_thread))
{
infrun_debug_printf ("stepped into inlined function");
through a more inlined call beyond its call site. */
if (get_frame_type (get_current_frame ()) == INLINE_FRAME
- && !frame_id_eq (get_frame_id (get_current_frame ()),
- ecs->event_thread->control.step_frame_id)
+ && (get_frame_id (get_current_frame ())
+ != ecs->event_thread->control.step_frame_id)
&& stepped_in_from (get_current_frame (),
ecs->event_thread->control.step_frame_id))
{
end_stepping_range (ecs);
return;
}
- else if (frame_id_eq (get_frame_id (get_current_frame ()),
- ecs->event_thread->control.step_frame_id))
+ else if (get_frame_id (get_current_frame ())
+ == ecs->event_thread->control.step_frame_id)
{
/* We are not at the start of a statement, and we have not changed
frame.
should) carry around the function and does (or should) use
that when doing a frame comparison. */
if (tp->control.stop_step
- && frame_id_eq (tp->control.step_frame_id,
- get_frame_id (get_current_frame ()))
+ && (tp->control.step_frame_id
+ == get_frame_id (get_current_frame ()))
&& (tp->control.step_start_function
== find_pc_function (tp->stop_pc ())))
{
fid != NULL;
fid = get_prev_frame (fid))
{
- if (frame_id_eq (id, get_frame_id (fid)))
+ if (id == get_frame_id (fid))
{
struct frame_info *prev_frame;
{
prev_frame = get_prev_frame (fid);
if (!prev_frame
- || !frame_id_eq (id, get_frame_id (prev_frame)))
+ || id != get_frame_id (prev_frame))
break;
fid = prev_frame;
}
reports not-equal, we only do the equality test if we have something
other than the innermost frame selected. */
if (current_frame_level != -1
- && !frame_id_eq (current_frame_id, m_previous_frame_id))
+ && current_frame_id != m_previous_frame_id)
return true;
/* Nothing changed! */
else
{
frame_id = get_frame_id (prev_frame);
- if (frame_id_eq (frame_id, null_frame_id))
+ if (frame_id == null_frame_id)
PyErr_SetString (PyExc_ValueError,
_("Invalid ID for the `frame' object."));
}
frame_object *other_frame = (frame_object *) other;
if (self_frame->frame_id_is_next == other_frame->frame_id_is_next
- && frame_id_eq (self_frame->frame_id, other_frame->frame_id))
+ && self_frame->frame_id == other_frame->frame_id)
result = Py_EQ;
else
result = Py_NE;
frame_id = get_thread_current_frame_id (tp);
/* Check if we need to update any stepping-related frame id's. */
- upd_step_frame_id = frame_id_eq (frame_id,
- tp->control.step_frame_id);
- upd_step_stack_frame_id = frame_id_eq (frame_id,
- tp->control.step_stack_frame_id);
+ upd_step_frame_id = (frame_id == tp->control.step_frame_id);
+ upd_step_stack_frame_id = (frame_id == tp->control.step_stack_frame_id);
/* We start replaying at the end of the branch trace. This corresponds
to the current instruction. */
fid != NULL;
fid = get_prev_frame (fid))
{
- if (frame_id_eq (id, get_frame_id (fid)))
+ if (id == get_frame_id (fid))
{
struct frame_info *prev_frame;
{
prev_frame = get_prev_frame (fid);
if (!prev_frame
- || !frame_id_eq (id, get_frame_id (prev_frame)))
+ || id != get_frame_id (prev_frame))
break;
fid = prev_frame;
}
function and it's arguments) -- otherwise we'll just show the
new source line. */
- if (frame_id_eq (old_frame_id,
- get_frame_id (get_current_frame ())))
+ if (old_frame_id == get_frame_id (get_current_frame ()))
print_what = SRC_LINE;
else
print_what = SRC_AND_LOC;
in this situation. */
if (VALUE_LVAL (new_val) == lval_register
&& value_lazy (new_val)
- && frame_id_eq (VALUE_NEXT_FRAME_ID (new_val), next_frame_id))
+ && VALUE_NEXT_FRAME_ID (new_val) == next_frame_id)
internal_error (__FILE__, __LINE__,
_("infinite loop while fetching a register"));
}