Remove "noerror" parameter from some TUI functions

A few TUI functions take a "noerror" parameter.  This is only checked
in one spot: in tui_set_source_content, if noerror is false, and if an
error occurs, then the function will call print_sys_errmsg.

This seems misguided to me, so this patch removes that code and this
parameter.

gdb/ChangeLog
2019-08-16  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.h (tui_update_source_window)
	(tui_update_source_window_as_is): Remove "noerror" parameter.
	* tui/tui-winsource.c (tui_update_source_window)
	(tui_update_source_window_as_is): Remove "noerror" parameter.
	(tui_update_source_windows_with_addr)
	(tui_update_source_windows_with_line)
	(tui_source_window_base::rerender)
	(tui_source_window_base::refill): Update.
	* tui/tui-source.h (tui_set_source_content)
	(tui_show_symtab_source): Remove "noerror" parameter.
	* tui/tui-source.c (tui_set_source_content): Remove "noerror"
	parameter.
	(tui_show_symtab_source): Likewise.
	(tui_source_window::maybe_update): Update.
	* tui/tui-disasm.c (tui_show_disassem)
	(tui_show_disassem_and_update_source)
	(tui_disasm_window::do_scroll_vertical)
	(tui_disasm_window::maybe_update): Update.
This commit is contained in:
Tom Tromey 2019-07-11 18:19:28 -06:00
parent 2d83e710a1
commit 20149b6b20
6 changed files with 43 additions and 41 deletions

View File

@ -1,3 +1,24 @@
2019-08-16 Tom Tromey <tom@tromey.com>
* tui/tui-winsource.h (tui_update_source_window)
(tui_update_source_window_as_is): Remove "noerror" parameter.
* tui/tui-winsource.c (tui_update_source_window)
(tui_update_source_window_as_is): Remove "noerror" parameter.
(tui_update_source_windows_with_addr)
(tui_update_source_windows_with_line)
(tui_source_window_base::rerender)
(tui_source_window_base::refill): Update.
* tui/tui-source.h (tui_set_source_content)
(tui_show_symtab_source): Remove "noerror" parameter.
* tui/tui-source.c (tui_set_source_content): Remove "noerror"
parameter.
(tui_show_symtab_source): Likewise.
(tui_source_window::maybe_update): Update.
* tui/tui-disasm.c (tui_show_disassem)
(tui_show_disassem_and_update_source)
(tui_disasm_window::do_scroll_vertical)
(tui_disasm_window::maybe_update): Update.
2019-08-16 Tom Tromey <tom@tromey.com>
* tui/tui.c (tui_is_window_visible): Update.

View File

@ -257,7 +257,7 @@ tui_show_disassem (struct gdbarch *gdbarch, CORE_ADDR start_addr)
val.loa = LOA_ADDRESS;
val.u.addr = start_addr;
tui_update_source_window (TUI_DISASM_WIN, gdbarch, s, val, FALSE);
tui_update_source_window (TUI_DISASM_WIN, gdbarch, s, val);
/* If the focus was in the src win, put it in the asm win, if the
source view isn't split. */
@ -285,7 +285,7 @@ tui_show_disassem_and_update_source (struct gdbarch *gdbarch,
sal = find_pc_line (start_addr, 0);
val.loa = LOA_LINE;
val.u.line_no = sal.line;
tui_update_source_window (TUI_SRC_WIN, gdbarch, sal.symtab, val, TRUE);
tui_update_source_window (TUI_SRC_WIN, gdbarch, sal.symtab, val);
if (sal.symtab)
{
set_current_source_symtab_and_line (sal);
@ -368,7 +368,7 @@ tui_disasm_window::do_scroll_vertical (int num_to_scroll)
val.loa = LOA_ADDRESS;
val.u.addr = tui_find_disassembly_address (gdbarch, pc, num_to_scroll);
tui_update_source_window_as_is (this, gdbarch,
NULL, val, FALSE);
NULL, val);
}
}
@ -420,7 +420,7 @@ tui_disasm_window::maybe_update (struct frame_info *fi, symtab_and_line sal,
a.u.addr = low;
if (!addr_is_displayed (addr))
tui_update_source_window (this, get_frame_arch (fi),
sal.symtab, a, TRUE);
sal.symtab, a);
else
{
a.u.addr = addr;

View File

@ -125,8 +125,7 @@ copy_source_line (const char **ptr, int line_no, int first_col,
enum tui_status
tui_set_source_content (tui_source_window_base *win_info,
struct symtab *s,
int line_no,
int noerror)
int line_no)
{
enum tui_status ret = TUI_FAILURE;
@ -143,17 +142,7 @@ tui_set_source_content (tui_source_window_base *win_info,
std::string srclines;
if (!g_source_cache.get_source_lines (s, line_no, line_no + nlines,
&srclines))
{
if (!noerror)
{
const char *filename = symtab_to_filename_for_display (s);
char *name = (char *) alloca (strlen (filename) + 100);
sprintf (name, "%s:%d", filename, line_no);
print_sys_errmsg (name, errno);
}
ret = TUI_FAILURE;
}
ret = TUI_FAILURE;
else
{
int cur_line_no, cur_line;
@ -213,11 +202,10 @@ tui_set_source_content (tui_source_window_base *win_info,
void
tui_show_symtab_source (tui_source_window_base *win_info,
struct gdbarch *gdbarch, struct symtab *s,
struct tui_line_or_address line,
int noerror)
struct tui_line_or_address line)
{
win_info->horizontal_offset = 0;
tui_update_source_window_as_is (win_info, gdbarch, s, line, noerror);
tui_update_source_window_as_is (win_info, gdbarch, s, line);
}
@ -330,7 +318,7 @@ tui_source_window::maybe_update (struct frame_info *fi, symtab_and_line sal,
if (!(source_already_displayed
&& line_is_displayed (line_no)))
tui_update_source_window (this, get_frame_arch (fi),
sal.symtab, l, TRUE);
sal.symtab, l);
else
{
l.u.line_no = line_no;

View File

@ -74,10 +74,9 @@ private:
extern enum tui_status tui_set_source_content (tui_source_window_base *,
struct symtab *,
int, int);
int);
extern void tui_show_symtab_source (tui_source_window_base *,
struct gdbarch *, struct symtab *,
struct tui_line_or_address,
int);
struct tui_line_or_address);
#endif /* TUI_TUI_SOURCE_H */

View File

@ -73,11 +73,10 @@ void
tui_update_source_window (struct tui_source_window_base *win_info,
struct gdbarch *gdbarch,
struct symtab *s,
struct tui_line_or_address line_or_addr,
int noerror)
struct tui_line_or_address line_or_addr)
{
win_info->horizontal_offset = 0;
tui_update_source_window_as_is (win_info, gdbarch, s, line_or_addr, noerror);
tui_update_source_window_as_is (win_info, gdbarch, s, line_or_addr);
}
@ -87,14 +86,12 @@ void
tui_update_source_window_as_is (struct tui_source_window_base *win_info,
struct gdbarch *gdbarch,
struct symtab *s,
struct tui_line_or_address line_or_addr,
int noerror)
struct tui_line_or_address line_or_addr)
{
enum tui_status ret;
if (win_info->type == SRC_WIN)
ret = tui_set_source_content (win_info, s, line_or_addr.u.line_no,
noerror);
ret = tui_set_source_content (win_info, s, line_or_addr.u.line_no);
else
ret = tui_set_disassem_content (win_info, gdbarch, line_or_addr.u.addr);
@ -147,7 +144,7 @@ tui_update_source_windows_with_addr (struct gdbarch *gdbarch, CORE_ADDR addr)
sal = find_pc_line (addr, 0);
l.loa = LOA_LINE;
l.u.line_no = sal.line;
tui_show_symtab_source (TUI_SRC_WIN, gdbarch, sal.symtab, l, FALSE);
tui_show_symtab_source (TUI_SRC_WIN, gdbarch, sal.symtab, l);
break;
}
}
@ -182,7 +179,7 @@ tui_update_source_windows_with_line (struct symtab *s, int line)
default:
l.loa = LOA_LINE;
l.u.line_no = line;
tui_show_symtab_source (TUI_SRC_WIN, gdbarch, s, l, FALSE);
tui_show_symtab_source (TUI_SRC_WIN, gdbarch, s, l);
if (tui_current_layout () == SRC_DISASSEM_COMMAND)
{
find_line_pc (s, line, &pc);
@ -330,7 +327,7 @@ tui_source_window_base::rerender ()
line_or_addr = start_line_or_addr;
tui_update_source_window (this, gdbarch,
cursal.symtab, line_or_addr, TRUE);
cursal.symtab, line_or_addr);
}
else if (deprecated_safe_get_selected_frame () != NULL)
{
@ -351,7 +348,7 @@ tui_source_window_base::rerender ()
line.loa = LOA_ADDRESS;
find_line_pc (s, cursal.line, &line.u.addr);
}
tui_update_source_window (this, gdbarch, s, line, TRUE);
tui_update_source_window (this, gdbarch, s, line);
}
else
erase_source_content ();
@ -391,8 +388,7 @@ tui_source_window_base::refill ()
}
tui_update_source_window_as_is (this, gdbarch, s,
content[0].line_or_addr,
FALSE);
content[0].line_or_addr);
}
/* Scroll the source forward or backward horizontally. */

View File

@ -245,12 +245,10 @@ extern bool tui_update_breakpoint_info (struct tui_source_window_base *win,
extern void tui_display_main (void);
extern void tui_update_source_window (struct tui_source_window_base *,
struct gdbarch *, struct symtab *,
struct tui_line_or_address,
int);
struct tui_line_or_address);
extern void tui_update_source_window_as_is (struct tui_source_window_base *,
struct gdbarch *, struct symtab *,
struct tui_line_or_address,
int);
struct tui_line_or_address);
extern void tui_update_source_windows_with_addr (struct gdbarch *, CORE_ADDR);
extern void tui_update_source_windows_with_line (struct symtab *,
int);