From 20149b6b207ac8c2bcde6f272607109f566168a9 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Thu, 11 Jul 2019 18:19:28 -0600 Subject: 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 * 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. --- gdb/tui/tui-disasm.c | 8 ++++---- gdb/tui/tui-source.c | 22 +++++----------------- gdb/tui/tui-source.h | 5 ++--- gdb/tui/tui-winsource.c | 22 +++++++++------------- gdb/tui/tui-winsource.h | 6 ++---- 5 files changed, 22 insertions(+), 41 deletions(-) (limited to 'gdb/tui') diff --git a/gdb/tui/tui-disasm.c b/gdb/tui/tui-disasm.c index 3ebe303..621832f 100644 --- a/gdb/tui/tui-disasm.c +++ b/gdb/tui/tui-disasm.c @@ -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; diff --git a/gdb/tui/tui-source.c b/gdb/tui/tui-source.c index c86af84..db83fb0 100644 --- a/gdb/tui/tui-source.c +++ b/gdb/tui/tui-source.c @@ -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; diff --git a/gdb/tui/tui-source.h b/gdb/tui/tui-source.h index 2926777..1d7af2a 100644 --- a/gdb/tui/tui-source.h +++ b/gdb/tui/tui-source.h @@ -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 */ diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c index b6ce652..94ab8c0 100644 --- a/gdb/tui/tui-winsource.c +++ b/gdb/tui/tui-winsource.c @@ -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. */ diff --git a/gdb/tui/tui-winsource.h b/gdb/tui/tui-winsource.h index a4167f5..dfd4a00 100644 --- a/gdb/tui/tui-winsource.h +++ b/gdb/tui/tui-winsource.h @@ -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); -- cgit v1.1