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 CORE_ADDR in tuiDisassem.c and fix crash


Hi!

I've committed the following patch to fix more CORE_ADDR problems and
a crash when disassembling some code that does not have a symbol table.

	Stephane

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

	* tuiDisassem.c (tuiVerticalDisassemScroll): Use CORE_ADDR.
	(tuiVerticalDisassemScroll): Likewise.
	(tuiShowDisassemAndUpdateSource): Check for null symtab to
	prevent a crash.
Index: tuiDisassem.c
===================================================================
RCS file: /cvs/src/src/gdb/tui/tuiDisassem.c,v
retrieving revision 1.6
diff -u -p -r1.6 tuiDisassem.c
--- tuiDisassem.c	2001/07/18 20:59:00	1.6
+++ tuiDisassem.c	2001/07/19 21:51:08
@@ -178,9 +178,14 @@ tuiShowDisassemAndUpdateSource (CORE_ADD
          ** note that it follows what is in the disassembly window and visa-versa
        */
       sal = find_pc_line (startAddr, 0);
-      current_source_symtab = sal.symtab;
-      tuiUpdateSourceWindow (srcWin, sal.symtab, (Opaque) sal.line, TRUE);
-      tuiUpdateLocatorFilename (sal.symtab->filename);
+      tuiUpdateSourceWindow (srcWin, sal.symtab, sal.line, TRUE);
+      if (sal.symtab)
+	{
+	  current_source_symtab = sal.symtab;
+	  tuiUpdateLocatorFilename (sal.symtab->filename);
+	}
+      else
+	tuiUpdateLocatorFilename ("?");
     }
 
   return;
@@ -248,7 +253,7 @@ tuiVerticalDisassemScroll (TuiScrollDire
 {
   if (disassemWin->generic.content != (OpaquePtr) NULL)
     {
-      Opaque pc, lowAddr;
+      CORE_ADDR pc, lowAddr;
       TuiWinContent content;
       struct symtab *s;
 
@@ -259,15 +264,13 @@ tuiVerticalDisassemScroll (TuiScrollDire
 	s = current_source_symtab;
 
       pc = content[0]->whichElement.source.lineOrAddr.addr;
-      if (find_pc_partial_function ((CORE_ADDR) pc,
-				    (char **) NULL,
-				    (CORE_ADDR *) & lowAddr,
-				    (CORE_ADDR) NULL) == 0)
-	error ("No function contains prgram counter for selected frame.\n");
+      if (find_pc_partial_function (pc, (char **) NULL, &lowAddr,
+				    (CORE_ADDR) 0) == 0)
+	error ("No function contains program counter for selected frame.\n");
       else
 	{
 	  register int line = 0;
-	  register Opaque newLow;
+	  register CORE_ADDR newLow;
 	  bfd_byte buffer[4];
 
 	  newLow = pc;

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