Remove "noerror" parameter from some TUI functions
authorTom Tromey <tom@tromey.com>
Fri, 12 Jul 2019 00:19:28 +0000 (18:19 -0600)
committerTom Tromey <tom@tromey.com>
Fri, 16 Aug 2019 17:28:34 +0000 (11:28 -0600)
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.

gdb/ChangeLog
gdb/tui/tui-disasm.c
gdb/tui/tui-source.c
gdb/tui/tui-source.h
gdb/tui/tui-winsource.c
gdb/tui/tui-winsource.h

index 34b10ed7608a221febc7760ae689c2dc343e8725..6d6707c89f0048a14d34708912e1e26af8e1b682 100644 (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.
index 3ebe303f75191e9048912a52f218e32bc08a4811..621832ff92a614896975aba163b20c4ba6ae8b75 100644 (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;
index c86af84423ea3cf0fe251eb10767f3c8122a1482..db83fb01138534d3b9985cc9ac533df9adc7dd22 100644 (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;
index 2926777ab3fc08a7b32b6c316e13b077305c76a2..1d7af2aad83064c92220e4b740e33be5432bd5ba 100644 (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 */
index b6ce652d09d77b8b36f96acf0f03c83d43bf294c..94ab8c09f6721c906974537ecc3e63b486cfa130 100644 (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.  */
index a4167f50d7a4d8d8cca14b09569d481f5b402222..dfd4a0002a82707b4039871529528f741bc3af7d 100644 (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);