This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[PATCH]: Fix several crashs in tui


Hi!

I've committed the following patch that fixes several crashes in tui.

	Stephane

2001-07-16  Stephane Carrez  <Stephane.Carrez@worldnet.fr>

	* tuiStack.c: Add missing includes.
	(tuiShowFrameInfo): Don't crash when there is no symbol table 
	associated with the pc.
	* tuiSource.c (_hasBreak): Check for null source file.
	* tuiWin.c (tuiRefreshAll): Check for null winList[type].
	(_tuiSetFocus): Check for null dataWin.
	* tuiGeneralWin.c (refreshAll): Check for null list[type].
Index: tuiGeneralWin.c
===================================================================
RCS file: /cvs/src/src/gdb/tui/tuiGeneralWin.c,v
retrieving revision 1.5
diff -u -p -r1.5 tuiGeneralWin.c
--- tuiGeneralWin.c	2001/07/14 19:31:09	1.5
+++ tuiGeneralWin.c	2001/07/16 21:52:11
@@ -370,7 +370,7 @@ refreshAll (TuiWinInfoPtr * list)
 
   for (type = SRC_WIN; (type < MAX_MAJOR_WINDOWS); type++)
     {
-      if (list[type]->generic.isVisible)
+      if (list[type] && list[type]->generic.isVisible)
 	{
 	  if (type == SRC_WIN || type == DISASSEM_WIN)
 	    {
Index: tuiSource.c
===================================================================
RCS file: /cvs/src/src/gdb/tui/tuiSource.c,v
retrieving revision 1.4
diff -u -p -r1.4 tuiSource.c
--- tuiSource.c	2001/07/14 19:31:09	1.4
+++ tuiSource.c	2001/07/16 21:52:15
@@ -417,8 +417,9 @@ _hasBreak (char *sourceFileName, int lin
        (bp != (struct breakpoint *) NULL &&
 	bpWithBreak == (struct breakpoint *) NULL);
        bp = bp->next)
-    if ((strcmp (sourceFileName, bp->source_file) == 0) &&
-	(lineNo == bp->line_number))
+    if (bp->source_file
+	&& (strcmp (sourceFileName, bp->source_file) == 0)
+	&& (lineNo == bp->line_number))
       bpWithBreak = bp;
 
   return bpWithBreak;
Index: tuiStack.c
===================================================================
RCS file: /cvs/src/src/gdb/tui/tuiStack.c,v
retrieving revision 1.5
diff -u -p -r1.5 tuiStack.c
--- tuiStack.c	2001/07/14 19:31:09	1.5
+++ tuiStack.c	2001/07/16 21:52:15
@@ -23,10 +23,13 @@
 #include "symtab.h"
 #include "breakpoint.h"
 #include "frame.h"
+#include "command.h"
 
 #include "tui.h"
 #include "tuiData.h"
 #include "tuiStack.h"
+#include "tuiGeneralWin.h"
+#include "tuiSource.h"
 #include "tuiSourceWin.h"
 
 
@@ -330,6 +333,9 @@ tuiShowFrameInfo (struct frame_info *fi)
 
 
       s = find_pc_symtab (fi->pc);
+      if (s == 0)
+        return;
+
       sourceAlreadyDisplayed = tuiSourceIsDisplayed (s->filename);
       tuiUpdateLocatorDisplay (fi);
       for (i = 0; i < (sourceWindows ())->count; i++)
Index: tuiWin.c
===================================================================
RCS file: /cvs/src/src/gdb/tui/tuiWin.c,v
retrieving revision 1.5
diff -u -p -r1.5 tuiWin.c
--- tuiWin.c	2001/07/14 19:31:09	1.5
+++ tuiWin.c	2001/07/16 21:52:17
@@ -350,7 +350,7 @@ tuiRefreshAll (void)
   refreshAll (winList);
   for (type = SRC_WIN; type < MAX_MAJOR_WINDOWS; type++)
     {
-      if (winList[type]->generic.isVisible)
+      if (winList[type] && winList[type]->generic.isVisible)
 	{
 	  switch (type)
 	    {
@@ -680,7 +680,7 @@ The window name specified must be valid 
 	  keypad (cmdWin->generic.handle, (winInfo != cmdWin));
 	}
 
-      if (dataWin->generic.isVisible)
+      if (dataWin && dataWin->generic.isVisible)
 	tuiRefreshDataWin ();
       tuiFree (bufPtr);
       printf_filtered ("Focus set to %s window.\n",

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]