Change set_locator_info to take a symtab_and_line

This changes set_locator_info to take a symtab_and_line, rather than
the individual components.

gdb/ChangeLog
2019-12-20  Tom Tromey  <tom@tromey.com>

	* tui/tui-stack.h (struct tui_locator_window) <set_locator_info>:
	Take a symtab_and_line.
	* tui/tui-stack.c (tui_locator_window::set_locator_info): Take a
	symtab_and_line.
	(tui_show_frame_info): Update.

Change-Id: Icb58d67e6c5bdc034eede9e5bbe8c1d1e633fbb5
This commit is contained in:
Tom Tromey 2019-11-13 15:41:08 -07:00
parent ae4393e22c
commit 0ab92974ab
3 changed files with 32 additions and 38 deletions

View File

@ -1,3 +1,11 @@
2019-12-20 Tom Tromey <tom@tromey.com>
* tui/tui-stack.h (struct tui_locator_window) <set_locator_info>:
Take a symtab_and_line.
* tui/tui-stack.c (tui_locator_window::set_locator_info): Take a
symtab_and_line.
(tui_show_frame_info): Update.
2019-12-20 Tom Tromey <tom@tromey.com> 2019-12-20 Tom Tromey <tom@tromey.com>
* tui/tui-stack.c (tui_show_frame_info): Don't call * tui/tui-stack.c (tui_show_frame_info): Don't call

View File

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

View File

@ -54,9 +54,8 @@ struct tui_locator_window : public tui_gen_win_info
Returns true if any of the locator's fields were actually Returns true if any of the locator's fields were actually
changed, and false otherwise. */ changed, and false otherwise. */
bool set_locator_info (struct gdbarch *gdbarch, bool set_locator_info (struct gdbarch *gdbarch,
const char *fullname, const struct symtab_and_line &sal,
const char *procname, const char *procname);
int lineno, CORE_ADDR addr);
/* Set the full_name portion of the locator. */ /* Set the full_name portion of the locator. */
void set_locator_fullname (const char *fullname); void set_locator_fullname (const char *fullname);