Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/gpl3/gdb/dist/gdb/tui Don't core dump when the wind...



details:   https://anonhg.NetBSD.org/src/rev/c22d54d3a011
branches:  trunk
changeset: 358210:c22d54d3a011
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Dec 17 17:49:04 2017 +0000

description:
Don't core dump when the window is too small
XXX: feed upstream

diffstat:

 external/gpl3/gdb/dist/gdb/tui/tui-data.c       |   3 ++
 external/gpl3/gdb/dist/gdb/tui/tui-wingeneral.c |  31 +++++++++++++-----------
 external/gpl3/gdb/dist/gdb/tui/tui-winsource.c  |   6 ++++
 3 files changed, 26 insertions(+), 14 deletions(-)

diffs (89 lines):

diff -r 0a5af30c1af9 -r c22d54d3a011 external/gpl3/gdb/dist/gdb/tui/tui-data.c
--- a/external/gpl3/gdb/dist/gdb/tui/tui-data.c Sun Dec 17 17:18:34 2017 +0000
+++ b/external/gpl3/gdb/dist/gdb/tui/tui-data.c Sun Dec 17 17:49:04 2017 +0000
@@ -576,6 +576,9 @@
   struct tui_win_element *element_block_ptr;
   int i;
 
+  if (num_elements <= 0)
+    return NULL;
+
   content = XNEWVEC (struct tui_win_element *, num_elements);
 
   /*
diff -r 0a5af30c1af9 -r c22d54d3a011 external/gpl3/gdb/dist/gdb/tui/tui-wingeneral.c
--- a/external/gpl3/gdb/dist/gdb/tui/tui-wingeneral.c   Sun Dec 17 17:18:34 2017 +0000
+++ b/external/gpl3/gdb/dist/gdb/tui/tui-wingeneral.c   Sun Dec 17 17:49:04 2017 +0000
@@ -247,32 +247,35 @@
   make_all_visible (0);
 }
 
+static void
+tui_refresh_wi(struct tui_gen_win_info *wi)
+{
+  if (wi == NULL || wi->handle == NULL || !wi->is_visible)
+    return;
+
+  touchwin (wi->handle);
+  tui_refresh_win (wi);
+}
+
 /* Function to refresh all the windows currently displayed.  */
 
 void
 tui_refresh_all (struct tui_win_info **list)
 {
   int type;
-  struct tui_gen_win_info *locator = tui_locator_win_info_ptr ();
 
   for (type = SRC_WIN; (type < MAX_MAJOR_WINDOWS); type++)
     {
-      if (list[type] && list[type]->generic.is_visible)
+      if (!list[type] || !list[type]->generic.is_visible)
+       continue;
+      if (type == SRC_WIN || type == DISASSEM_WIN)
        {
-         if (type == SRC_WIN || type == DISASSEM_WIN)
-           {
-             touchwin (list[type]->detail.source_info.execution_info->handle);
-             tui_refresh_win (list[type]->detail.source_info.execution_info);
-           }
-         touchwin (list[type]->generic.handle);
-         tui_refresh_win (&list[type]->generic);
+         tui_refresh_wi (list[type]->detail.source_info.execution_info);
        }
+      tui_refresh_wi (&list[type]->generic);
     }
-  if (locator->is_visible)
-    {
-      touchwin (locator->handle);
-      tui_refresh_win (locator);
-    }
+
+  tui_refresh_wi (tui_locator_win_info_ptr ());
 }
 
 
diff -r 0a5af30c1af9 -r c22d54d3a011 external/gpl3/gdb/dist/gdb/tui/tui-winsource.c
--- a/external/gpl3/gdb/dist/gdb/tui/tui-winsource.c    Sun Dec 17 17:18:34 2017 +0000
+++ b/external/gpl3/gdb/dist/gdb/tui/tui-winsource.c    Sun Dec 17 17:49:04 2017 +0000
@@ -559,6 +559,9 @@
     = win_info->detail.source_info.execution_info;
   int cur_line;
 
+  if (exec_info->handle == NULL)
+    return;
+
   werase (exec_info->handle);
   tui_refresh_win (exec_info);
   for (cur_line = 1; (cur_line <= exec_info->content_size); cur_line++)
@@ -578,6 +581,9 @@
   struct tui_gen_win_info *exec_info
     = win_info->detail.source_info.execution_info;
 
+  if (exec_info->handle == NULL)
+    return;
+
   werase (exec_info->handle);
   tui_refresh_win (exec_info);
 }



Home | Main Index | Thread Index | Old Index