bool
tui_locator_window::set_locator_info (struct gdbarch *gdbarch_in,
- const char *fullname,
- const char *procname,
- int lineno,
- CORE_ADDR addr_in)
+ const struct symtab_and_line &sal,
+ const char *procname)
{
bool locator_changed_p = false;
- if (procname == NULL)
- procname = "";
+ gdb_assert (procname != NULL);
- if (fullname == NULL)
- fullname = "";
+ const char *fullname = (sal.symtab == nullptr
+ ? "??"
+ : symtab_to_fullname (sal.symtab));
locator_changed_p |= proc_name != procname;
- locator_changed_p |= lineno != line_no;
- locator_changed_p |= addr_in != addr;
+ locator_changed_p |= sal.line != line_no;
+ locator_changed_p |= sal.pc != addr;
locator_changed_p |= gdbarch_in != gdbarch;
locator_changed_p |= full_name != fullname;
proc_name = procname;
- line_no = lineno;
- addr = addr_in;
+ line_no = sal.line;
+ addr = sal.pc;
gdbarch = gdbarch_in;
set_locator_fullname (fullname);
if (fi)
{
- CORE_ADDR pc;
-
symtab_and_line sal = find_frame_sal (fi);
- const char *fullname = nullptr;
- if (sal.symtab != nullptr)
- fullname = symtab_to_fullname (sal.symtab);
-
- if (get_frame_pc_if_available (fi, &pc))
- locator_changed_p
- = locator->set_locator_info (get_frame_arch (fi),
- (sal.symtab == 0
- ? "??" : fullname),
- tui_get_function_from_frame (fi),
- sal.line,
- pc);
+ const char *func_name;
+ /* find_frame_sal does not always set PC, but we want to ensure
+ that it is available in the SAL. */
+ if (get_frame_pc_if_available (fi, &sal.pc))
+ func_name = tui_get_function_from_frame (fi);
else
- locator_changed_p
- = locator->set_locator_info (get_frame_arch (fi),
- "??", _("<unavailable>"), sal.line, 0);
+ func_name = _("<unavailable>");
+
+ locator_changed_p = locator->set_locator_info (get_frame_arch (fi),
+ sal, func_name);
/* If the locator information has not changed, then frame information has
not changed. If frame information has not changed, then the windows'
if (!locator_changed_p)
return 0;
- /* find_frame_sal does not always set PC, but we want to ensure
- that it is available in the SAL. */
- sal.pc = pc;
-
for (struct tui_source_window_base *win_info : tui_source_windows ())
{
win_info->maybe_update (fi, sal);
}
else
{
- locator_changed_p
- = locator->set_locator_info (NULL, NULL, NULL, 0, (CORE_ADDR) 0);
+ symtab_and_line sal {};
+
+ locator_changed_p = locator->set_locator_info (NULL, sal, "");
if (!locator_changed_p)
return 0;