if (find_pc_partial_function (block_addr, NULL, &prologue_start,
&prologue_end))
{
- struct symtab_and_line sal = find_pc_line (prologue_start, 0);
+ struct symtab_and_line sal = find_sal_for_pc (prologue_start, 0);
if (sal.line == 0)
{
if (!find_pc_partial_function (pc, NULL, &func_addr, &func_end))
return 0;
- sal = find_pc_line (func_addr, 0);
+ sal = find_sal_for_pc (func_addr, 0);
if (sal.end < func_end)
return sal.end;
CORE_ADDR entrypoint, prologue_end;
if (find_pc_partial_function (block_addr, NULL, &entrypoint, &prologue_end))
{
- struct symtab_and_line sal = find_pc_line (entrypoint, 0);
+ struct symtab_and_line sal = find_sal_for_pc (entrypoint, 0);
CORE_ADDR prev_pc = get_frame_pc (this_frame);
if (sal.line == 0)
/* No line info so use current PC. */
gdb_assert (inferior_thread ()->control.step_resume_breakpoint
== NULL);
- sal = find_pc_line (return_to, 0);
+ sal = find_sal_for_pc (return_to, 0);
sal.pc = return_to;
sal.section = find_pc_overlay (return_to);
sal.explicit_pc = 1;
/* One way to find the end of the prologue (which works well
for unoptimized code) is to do the following:
- struct symtab_and_line sal = find_pc_line (prologue_start, 0);
+ struct symtab_and_line sal = find_sal_for_pc (prologue_start, 0);
if (sal.line == 0)
prologue_end = prev_pc;
{
struct symtab_and_line sal;
- sal = find_pc_line (pc, 0);
+ sal = find_sal_for_pc (pc, 0);
sal.pc = pc;
sal.section = find_pc_overlay (pc);
sal.explicit_pc = 1;
corresponding to the last call to print_frame_info.
Be sure to reinitialize LINE with NOTCURRENT == 0
as the breakpoint line number is inappropriate otherwise.
- find_pc_line would adjust PC, re-set it back. */
+ find_sal_for_pc would adjust PC, re-set it back. */
symtab_and_line sal = get_last_displayed_sal ();
CORE_ADDR pc = sal.pc;
- sal = find_pc_line (pc, 0);
+ sal = find_sal_for_pc (pc, 0);
/* "break" without arguments is equivalent to "break *PC"
where PC is the last displayed codepoint's address. So
for (const static_tracepoint_marker &marker : markers)
{
- symtab_and_line sal = find_pc_line (marker.address, 0);
+ symtab_and_line sal = find_sal_for_pc (marker.address, 0);
sal.pc = marker.address;
sals.push_back (sal);
}
struct symtab_and_line sal2;
struct gdbarch *caller_gdbarch;
- sal2 = find_pc_line (frame_unwind_caller_pc (frame), 0);
+ sal2 = find_sal_for_pc (frame_unwind_caller_pc (frame), 0);
sal2.pc = frame_unwind_caller_pc (frame);
caller_gdbarch = frame_unwind_caller_arch (frame);
"found at previous line number"),
tp->number, tp->static_trace_marker_id.c_str ());
- symtab_and_line sal2 = find_pc_line (tpmarker->address, 0);
+ symtab_and_line sal2 = find_sal_for_pc (tpmarker->address, 0);
sym = find_symbol_for_pc_sect (tpmarker->address, NULL);
uiout->text ("Now in ");
if (sym)
= add_to_breakpoint_chain (std::move (b));
}
- sal = find_pc_line (pc, 0);
+ sal = find_sal_for_pc (pc, 0);
sal.pc = pc;
sal.section = find_pc_overlay (pc);
sal.explicit_pc = 1;
if (par_state->expression_context_block)
macro_scope
- = sal_macro_scope (find_pc_line (par_state->expression_context_pc, 0));
+ = sal_macro_scope (find_sal_for_pc (par_state->expression_context_pc, 0));
else
macro_scope = default_macro_scope ();
if (!macro_scope.is_valid ())
selected frame, and finding the line associated to it. */
frame_info_ptr frame = get_selected_frame (nullptr);
CORE_ADDR curr_pc = get_frame_pc (frame);
- cursal = find_pc_line (curr_pc, 0);
+ cursal = find_sal_for_pc (curr_pc, 0);
if (cursal.symtab == nullptr)
error
macro_scope scope;
if (block != NULL)
- scope = sal_macro_scope (find_pc_line (pc, 0));
+ scope = sal_macro_scope (find_sal_for_pc (pc, 0));
else
scope = default_macro_scope ();
if (!scope.is_valid ())
/* Due to a GCC bug, we need to know the boundaries of the current block
to know if a certain using directive is valid. */
- symtab_and_line boundary_sal = find_pc_line (block->end () - 1, 0);
+ symtab_and_line boundary_sal = find_sal_for_pc (block->end () - 1, 0);
/* Go through the using directives. If any of them add new names to
the namespace we're searching in, see if we can find a match by
should the first assembly instruction of the first source line. */
if (find_pc_partial_function (pc, NULL, &func_addr, &func_end))
{
- sal = find_pc_line (func_addr, 0);
+ sal = find_sal_for_pc (func_addr, 0);
if (sal.end > 0 && sal.end < func_end)
return sal.end;
}
{
mle[newlines].line = le[i].line;
mle[newlines].start_pc = le[i].pc (objfile);
- sal = find_pc_line (le[i].pc (objfile), 0);
+ sal = find_sal_for_pc (le[i].pc (objfile), 0);
mle[newlines].end_pc = sal.end;
newlines++;
}
/* The prologue may be empty, but there may still be a line number entry
for the opening brace which is distinct from the first line of code.
- If the prologue has been eliminated find_pc_line may return the source
+ If the prologue has been eliminated find_sal_for_pc may return the source
line after the opening brace. We still want to print this opening brace.
first_le is used to implement this. */
struct symtab_and_line sal;
int length;
- sal = find_pc_line (pc, 0);
+ sal = find_sal_for_pc (pc, 0);
length = gdb_insn_length (gdbarch, pc);
pc += length;
int end_preceding_line_to_display = 0;
int new_source_line = 0;
- sal = find_pc_line (pc, 0);
+ sal = find_sal_for_pc (pc, 0);
if (sal.symtab != last_symtab)
{
if (b_return == b)
{
- /* No need to call find_pc_line for symbols resolving as this is only
+ /* No need to call find_sal_for_pc for symbols resolving as this is only
a helper breakpoint never shown to the user. */
symtab_and_line sal;
return {};
notcurrent = (*pc != get_frame_address_in_block (frame));
- return find_pc_line (*pc, notcurrent);
+ return find_sal_for_pc (*pc, notcurrent);
}
/* Per "frame.h", return the ``address'' of the frame. Code should
{
struct symtab_and_line sal;
- sal = find_pc_line (func_addr, 0);
+ sal = find_sal_for_pc (func_addr, 0);
if (sal.line != 0 && sal.end < func_end)
{
/* Don't use line number debug info for assembly source files. */
if ((sym != NULL) && sym->language () != language_asm)
{
- sal = find_pc_line (func_addr, 0);
+ sal = find_sal_for_pc (func_addr, 0);
if (sal.end && sal.end < func_end)
{
/* Found a line number, use it as end of prologue. */
{
CORE_ADDR pc = (CORE_ADDR) pc_ull;
- sal = find_pc_line (pc, 0);
+ sal = find_sal_for_pc (pc, 0);
}
catch (const gdb_exception &except)
{
struct h8300_frame_cache cache;
/* Found a function. */
- sal = find_pc_line (func_addr, 0);
+ sal = find_sal_for_pc (func_addr, 0);
if (sal.end && sal.end < func_end)
/* Found a line number, use it as end of prologue. */
return sal.end;
return 0;
/* Get the line associated with FUNC_ADDR. */
- sal = find_pc_line (func_addr, 0);
+ sal = find_sal_for_pc (func_addr, 0);
/* There are only two cases to consider. First, the end of the source line
is within the function bounds. In that case we return the end of the
/* Start off not trusting the limit. */
*trust_limit = 0;
- prologue_sal = find_pc_line (pc, 0);
+ prologue_sal = find_sal_for_pc (pc, 0);
if (prologue_sal.line != 0)
{
int i;
{
struct symtab_and_line sal;
- sal = find_pc_line (addr, 0);
+ sal = find_sal_for_pc (addr, 0);
if (sal.line == 0)
break;
if (sal.line <= prologue_sal.line
if (execution_direction == EXEC_REVERSE)
{
- symtab_and_line sal = find_pc_line (pc, 0);
+ symtab_and_line sal = find_sal_for_pc (pc, 0);
symtab_and_line sal_start
- = find_pc_line (tp->control.step_range_start, 0);
+ = find_sal_for_pc (tp->control.step_range_start, 0);
if (sal.line == sal_start.line)
/* Executing in reverse, the step_range_start address is in
}
else
{
- sal = find_pc_line (pc, 0);
+ sal = find_sal_for_pc (pc, 0);
tp->control.step_range_start = func->value_block ()->entry_pc ();
tp->control.step_range_end = sal.end;
if (find_pc_partial_function (pc, nullptr, &func_addr, nullptr) == 0)
error (_("Cannot find bounds of current function"));
- sal = find_pc_line (func_addr, 0);
+ sal = find_sal_for_pc (func_addr, 0);
alt_entry_point = sal.pc;
entry_point = alt_entry_point;
struct symtab_and_line sal;
struct thread_info *tp = inferior_thread ();
- sal = find_pc_line (get_frame_pc (frame), 0);
+ sal = find_sal_for_pc (get_frame_pc (frame), 0);
sal.pc = get_frame_pc (frame);
sm->breakpoint = set_momentary_breakpoint (gdbarch, sal,
{
struct symtab_and_line tmp_sal;
- tmp_sal = find_pc_line (ecs->stop_func_start, 0);
+ tmp_sal = find_sal_for_pc (ecs->stop_func_start, 0);
if (tmp_sal.line != 0
&& !function_name_is_marked_for_skip (ecs->stop_func_name,
tmp_sal)
stack of inlined frames, even if GDB actually believes that it is in a
more outer frame. This is checked for below by calls to
inline_skipped_frames. */
- stop_pc_sal = find_pc_line (ecs->event_thread->stop_pc (), 0);
+ stop_pc_sal = find_sal_for_pc (ecs->event_thread->stop_pc (), 0);
/* NOTE: tausq/2004-05-24: This if block used to be done before all
the trampoline processing logic, however, there are some trampolines
ecs->stop_func_start
= gdbarch_skip_prologue_noexcept (gdbarch, ecs->stop_func_start);
- symtab_and_line stop_func_sal = find_pc_line (ecs->stop_func_start, 0);
+ symtab_and_line stop_func_sal = find_sal_for_pc (ecs->stop_func_start, 0);
/* Use the step_resume_break to step until the end of the prologue,
even if that involves jumps (as it seems to on the vax under
4.2). */
ecs->stop_func_start
= gdbarch_skip_prologue_noexcept (gdbarch, ecs->stop_func_start);
- stop_func_sal = find_pc_line (ecs->event_thread->stop_pc (), 0);
+ stop_func_sal = find_sal_for_pc (ecs->event_thread->stop_pc (), 0);
/* OK, we're just going to keep stepping here. */
if (stop_func_sal.pc == ecs->event_thread->stop_pc ())
static struct symtab_and_line
find_last_line_symbol (CORE_ADDR start, CORE_ADDR end, int notcurrent)
{
- struct symtab_and_line sal = find_pc_line (start, notcurrent);
+ struct symtab_and_line sal = find_sal_for_pc (start, notcurrent);
struct symtab_and_line best_sal = sal;
if (sal.pc == 0 || sal.line == 0 || sal.end == 0)
{
if (sal.line && sal.line <= best_sal.line)
best_sal = sal;
- sal = find_pc_line (sal.end, notcurrent);
+ sal = find_sal_for_pc (sal.end, notcurrent);
}
while (sal.pc && sal.pc < end);
struct iq2000_frame_cache cache;
/* Found a function. */
- sal = find_pc_line (func_addr, 0);
+ sal = find_sal_for_pc (func_addr, 0);
if (sal.end && sal.end < func_end)
/* Found a line number, use it as end of prologue. */
return sal.end;
convert_address_location_to_sals (struct linespec_state *self,
CORE_ADDR address)
{
- symtab_and_line sal = find_pc_line (address, 0);
+ symtab_and_line sal = find_sal_for_pc (address, 0);
sal.pc = address;
sal.section = find_pc_overlay (address);
sal.explicit_pc = 1;
: fi.pc);
uiout->field_core_addr ("addr", get_current_arch (), pc);
- symtab_and_line sal = find_pc_line (pc, 0);
+ symtab_and_line sal = find_sal_for_pc (pc, 0);
if (sal.symtab)
{
uiout->text (", file ");
if (find_pc_partial_function (block_addr, NULL, &prologue_start,
&prologue_end))
{
- struct symtab_and_line sal = find_pc_line (prologue_start, 0);
+ struct symtab_and_line sal = find_sal_for_pc (prologue_start, 0);
if (sal.line == 0)
{
if (find_pc_partial_function (pc, NULL, &func_addr, &func_end))
{
- sal = find_pc_line (func_addr, 0);
+ sal = find_sal_for_pc (func_addr, 0);
if (sal.line != 0 && sal.end <= func_end)
{
first source line. */
if (find_pc_partial_function (pc, NULL, &func_addr, &func_end))
{
- sal = find_pc_line (func_addr, 0);
+ sal = find_sal_for_pc (func_addr, 0);
if (sal.end && sal.end < func_end)
return sal.end;
}
/* If there's a selected frame, use its PC. */
frame = deprecated_safe_get_selected_frame ();
if (frame && (pc = get_frame_pc_if_available (frame)))
- sal = find_pc_line (*pc, 0);
+ sal = find_sal_for_pc (*pc, 0);
/* Fall back to the current listing position. */
else
Always analyze the prologue. */
if (find_pc_partial_function (start_pc, NULL, &func_start, &func_end))
{
- sal = find_pc_line (func_start, 0);
+ sal = find_sal_for_pc (func_start, 0);
if (sal.end < func_end
&& start_pc <= sal.end)
files. */
if (sym && sym->language () != language_asm)
{
- sal = find_pc_line (func_addr, 0);
+ sal = find_sal_for_pc (func_addr, 0);
if (sal.end && sal.end < func_end)
{
/* Found a line number, use it as end of
try
{
CORE_ADDR curr_pc = get_frame_pc (get_selected_frame (nullptr));
- symtab_and_line curr_sal = find_pc_line (curr_pc, 0);
+ symtab_and_line curr_sal = find_sal_for_pc (curr_pc, 0);
return (decl_line <= curr_sal.line)
|| (decl_line >= boundary);
}
if (0 != prologue_end)
{
- struct symtab_and_line prologue_sal = find_pc_line (start_pc, 0);
+ struct symtab_and_line prologue_sal = find_sal_for_pc (start_pc, 0);
struct compunit_symtab *compunit
= prologue_sal.symtab->compunit ();
const char *debug_format = compunit->debugformat ();
set_current_program_space (self->pspace);
- sal = find_pc_line (pc, 0);
+ sal = find_sal_for_pc (pc, 0);
result = symtab_and_line_to_sal_object (sal);
}
catch (const gdb_exception &except)
try
{
- result = symtab_and_line_to_sal_object (find_pc_line (insn->pc, 0));
+ result = symtab_and_line_to_sal_object (find_sal_for_pc (insn->pc, 0));
}
catch (const gdb_exception &except)
{
{
struct symtab_and_line sal;
- sal = find_pc_line (insn.pc, 0);
+ sal = find_sal_for_pc (insn.pc, 0);
if (sal.symtab != symtab || sal.line == 0)
continue;
bookmark &b = all_bookmarks.emplace_back ();
b.number = ++bookmark_count;
b.pc = regcache_read_pc (regcache);
- b.sal = find_pc_line (b.pc, 0);
+ b.sal = find_sal_for_pc (b.pc, 0);
b.sal.pspace = get_frame_program_space (get_current_frame ());
b.opaque_data.reset (bookmark_id);
associated with the prologue. */
if ((pc - orig_pc) > 8)
{
- struct symtab_and_line prologue_sal = find_pc_line (orig_pc, 0);
- struct symtab_and_line this_sal = find_pc_line (pc, 0);
+ struct symtab_and_line prologue_sal = find_sal_for_pc (orig_pc, 0);
+ struct symtab_and_line this_sal = find_sal_for_pc (pc, 0);
if ((prologue_sal.line == 0)
|| (prologue_sal.line != this_sal.line))
using the debugging information. */
if (find_pc_partial_function (start_pc, NULL, &func_start, &func_end))
{
- sal = find_pc_line (func_start, 0);
+ sal = find_sal_for_pc (func_start, 0);
if (sal.end < func_end
&& start_pc <= sal.end)
internal_error (_("Infinite recursion detected in find_pc_sect_line;"
"please file a bug report"));
- return find_pc_line (mfunsym.value_address (), 0);
+ return find_sal_for_pc (mfunsym.value_address (), 0);
}
}
/* Backward compatibility (no section). */
struct symtab_and_line
-find_pc_line (CORE_ADDR pc, int notcurrent)
+find_sal_for_pc (CORE_ADDR pc, int notcurrent)
{
struct obj_section *section;
std::optional<CORE_ADDR>
find_line_range_start (CORE_ADDR pc)
{
- struct symtab_and_line current_sal = find_pc_line (pc, 0);
+ struct symtab_and_line current_sal = find_sal_for_pc (pc, 0);
if (current_sal.line == 0)
return {};
- struct symtab_and_line prev_sal = find_pc_line (current_sal.pc - 1, 0);
+ struct symtab_and_line prev_sal = find_sal_for_pc (current_sal.pc - 1, 0);
/* If the previous entry is for a different line, that means we are already
at the entry with the start PC for this line. */
{
prev_pc = prev_sal.pc;
- prev_sal = find_pc_line (prev_pc - 1, 0);
+ prev_sal = find_sal_for_pc (prev_pc - 1, 0);
/* Did we notice a line change? If so, we are done searching. */
if (!sal_line_symtab_matches_p (prev_sal, current_sal))
{
struct symtab_and_line sal;
- /* This always passes zero for NOTCURRENT to find_pc_line.
+ /* This always passes zero for NOTCURRENT to find_sal_for_pc.
There are currently no callers that ever pass non-zero. */
- sal = find_pc_line (pc, 0);
+ sal = find_sal_for_pc (pc, 0);
return sal.symtab;
}
\f
{
struct symtab_and_line sal;
- sal = find_pc_line (pc, 0);
+ sal = find_sal_for_pc (pc, 0);
*startptr = sal.pc;
*endptr = sal.end;
return sal.symtab != 0;
if (!find_pc_partial_function (func_addr, nullptr, &start_pc, &end_pc))
return {};
- const struct symtab_and_line prologue_sal = find_pc_line (start_pc, 0);
+ const struct symtab_and_line prologue_sal = find_sal_for_pc (start_pc, 0);
if (prologue_sal.symtab != nullptr
&& prologue_sal.symtab->language () != language_asm)
{
find_pc_partial_function (func_addr, NULL, &start_pc, &end_pc);
start_pc += gdbarch_deprecated_function_start_offset (gdbarch);
- prologue_sal = find_pc_line (start_pc, 0);
+ prologue_sal = find_sal_for_pc (start_pc, 0);
if (prologue_sal.line != 0)
{
/* For languages other than assembly, treat two consecutive line
{
struct symtab_and_line sal;
- sal = find_pc_line (prologue_sal.end, 0);
+ sal = find_sal_for_pc (prologue_sal.end, 0);
if (sal.line == 0)
break;
/* Assume that a consecutive SAL for the same (or larger)
The lines of a function can be described by several line tables in case
there are different files involved. There's a corner case where a
function epilogue is in a different file than a function start, and using
- start_pc as argument to find_pc_line will mean we won't find the
+ start_pc as argument to find_sal_for_pc will mean we won't find the
epilogue. Instead, use "end_pc - 1" to maximize our chances of picking
the line table containing an epilogue. */
- const struct symtab_and_line sal = find_pc_line (end_pc - 1, 0);
+ const struct symtab_and_line sal = find_sal_for_pc (end_pc - 1, 0);
if (sal.symtab != nullptr && sal.symtab->language () != language_asm)
{
struct objfile *objfile = sal.symtab->compunit ()->objfile ();
This can happen when the linetable doesn't describe the full
extent of the function. This can be triggered with:
- compiler-generated debug info, in the cornercase that the pc
- with which we call find_pc_line resides in a different file
+ with which we call find_sal_for_pc resides in a different file
than unrel_end, or
- invalid dwarf assembly debug info.
In the former case, there's no point in iterating further, simply
/* Given a pc value, return line number it is in. Second arg nonzero means
if pc is on the boundary use the previous statement's line number. */
-extern struct symtab_and_line find_pc_line (CORE_ADDR, int);
+extern struct symtab_and_line find_sal_for_pc (CORE_ADDR, int);
/* Same function, but specify a section as well as an address. */
extern std::optional<CORE_ADDR> find_line_range_start (CORE_ADDR pc);
-/* Wrapper around find_pc_line to just return the symtab. */
+/* Wrapper around find_sal_for_pc to just return the symtab. */
extern struct symtab *find_pc_line_symtab (CORE_ADDR);
if (trace_frame != NULL
&& (trace_pc = get_frame_pc_if_available (trace_frame)))
{
- traceframe_sal = find_pc_line (*trace_pc, 0);
+ traceframe_sal = find_sal_for_pc (*trace_pc, 0);
traceframe_fun = find_symbol_for_pc (*trace_pc);
/* Save linenumber as "$trace_line", a debugger variable visible to
symtab_and_line sal;
if (args == 0 || *args == 0)
{
- sal = find_pc_line (get_frame_pc (get_current_frame ()), 0);
+ sal = find_sal_for_pc (get_frame_pc (get_current_frame ()), 0);
}
else
{
print_address (get_current_arch (), start_pc, gdb_stdout);
gdb_stdout->wrap_here (2);
gdb_printf (" but contains no code.\n");
- sal = find_pc_line (start_pc, 0);
+ sal = find_sal_for_pc (start_pc, 0);
if (sal.line > 0
&& find_line_pc_range (sal, &start_pc, &end_pc)
&& start_pc != end_pc)
uiout->field_core_addr ("addr", marker.gdbarch, marker.address);
- sal = find_pc_line (marker.address, 0);
+ sal = find_sal_for_pc (marker.address, 0);
sym = find_symbol_for_pc_sect (marker.address, NULL);
if (sym)
{
{
struct symtab_and_line sal {};
if (addr != 0)
- sal = find_pc_line (addr, 0);
+ sal = find_sal_for_pc (addr, 0);
maybe_update (gdbarch, sal);
}
{
struct symtab_and_line sal {};
if (addr != 0)
- sal = find_pc_line (addr, 0);
+ sal = find_sal_for_pc (addr, 0);
for (struct tui_source_window_base *win_info : tui_source_windows ())
win_info->update_source_window (gdbarch, sal);
{
frame_info_ptr fi = deprecated_safe_get_selected_frame ();
if (fi != nullptr)
- sal = find_pc_line (get_frame_pc (fi), 0);
+ sal = find_sal_for_pc (get_frame_pc (fi), 0);
}
}
{
struct symtab_and_line sal;
- sal = find_pc_line (func_addr, 0);
+ sal = find_sal_for_pc (func_addr, 0);
if (sal.line != 0 && sal.end < func_end)
return sal.end;
/* Don't use line number debug info for assembly source files. */
if (sym && sym->language () != language_asm)
{
- sal = find_pc_line (func_addr, 0);
+ sal = find_sal_for_pc (func_addr, 0);
if (sal.end && sal.end < func_end)
{
/* Found a line number, use it as end of prologue. */
end_pc = 0;
/* Find out, if we have an information about the prologue from DWARF. */
- prologue_sal = find_pc_line (start, 0);
+ prologue_sal = find_sal_for_pc (start, 0);
if (prologue_sal.line != 0) /* Found debug info. */
body_pc = prologue_sal.end;
/* Try to find first body line from debug info. */
- prologue_sal = find_pc_line (start_pc, 0);
+ prologue_sal = find_sal_for_pc (start_pc, 0);
if (prologue_sal.line != 0) /* Found debug info. */
{
/* In Call0, it is possible to have a function with only one instruction
if (prologue_end != 0)
{
- struct symtab_and_line prologue_sal = find_pc_line (func_addr, 0);
+ struct symtab_and_line prologue_sal = find_sal_for_pc (func_addr, 0);
struct compunit_symtab *compunit = prologue_sal.symtab->compunit ();
const char *debug_format = compunit->debugformat ();