WineDbg and symfile

Eric Pouech eric.pouech at wanadoo.fr
Sun Jul 21 03:33:55 CDT 2002


this patch allows to extend the symbolfile command and pass after the
pathname of the symbol file to be loaded an offset for relocating the
addresses

A+
-------------- next part --------------
Name:          wdbg_sym
ChangeLog:     added offset for relocating symbols in symbolfile command
License:       X11
GenDate:       2002/07/21 08:29:17 UTC
ModifiedFiles: debugger/debugger.h debugger/dbg.y debugger/hash.c
AddedFiles:    
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/debugger/debugger.h,v
retrieving revision 1.36
diff -u -u -r1.36 debugger.h
--- debugger/debugger.h	20 Jul 2002 20:18:17 -0000	1.36
+++ debugger/debugger.h	21 Jul 2002 06:09:53 -0000
@@ -358,7 +358,7 @@
 					     struct name_hash ** rtn,
 					     unsigned int ebp,
 					     struct list_id * source);
-extern void DEBUG_ReadSymbolTable( const char * filename );
+extern void DEBUG_ReadSymbolTable( const char * filename, unsigned long offset );
 extern void DEBUG_AddLineNumber( struct name_hash * func, int line_num,
 				 unsigned long offset );
 extern struct wine_locals *
Index: debugger/dbg.y
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/debugger/dbg.y,v
retrieving revision 1.58
diff -u -u -r1.58 dbg.y
--- debugger/dbg.y	20 Jul 2002 20:18:17 -0000	1.58
+++ debugger/dbg.y	21 Jul 2002 06:15:08 -0000
@@ -145,7 +145,8 @@
     | tUNDISPLAY tEOL          	{ DEBUG_DelDisplay( -1 ); }
     | tCOND tNUM tEOL          	{ DEBUG_AddBPCondition($2, NULL); }
     | tCOND tNUM expr tEOL	{ DEBUG_AddBPCondition($2, $3); }
-    | tSYMBOLFILE pathname tEOL	{ DEBUG_ReadSymbolTable($2); }
+    | tSYMBOLFILE pathname tEOL	{ DEBUG_ReadSymbolTable($2, 0); }
+    | tSYMBOLFILE pathname tNUM tEOL	{ DEBUG_ReadSymbolTable($2, $3); }
     | tWHATIS expr_addr tEOL	{ DEBUG_PrintType(&$2); DEBUG_FreeExprMem(); }
     | tATTACH tNUM tEOL		{ DEBUG_Attach($2, FALSE); }
     | tDETACH tEOL              { return DEBUG_Detach(); /* FIXME: we shouldn't return, but since we cannot simply clean the symbol table, exit debugger for now */ }
Index: debugger/hash.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/debugger/hash.c,v
retrieving revision 1.31
diff -u -u -r1.31 hash.c
--- debugger/hash.c	20 Jul 2002 20:18:17 -0000	1.31
+++ debugger/hash.c	21 Jul 2002 06:09:53 -0000
@@ -797,7 +797,7 @@
  *
  * Read a symbol file into the hash table.
  */
-void DEBUG_ReadSymbolTable( const char* filename )
+void DEBUG_ReadSymbolTable( const char* filename, unsigned long offset )
 {
     FILE * symbolfile;
     DBG_VALUE value;
@@ -839,7 +839,12 @@
         if (!(*cpnt) || *cpnt == '\n') continue;
 
         if (sscanf(buffer, "%lx %c %s", &value.addr.off, &type, name) == 3)
+        {
+           if (value.addr.off + offset < value.addr.off)
+              DEBUG_Printf( DBG_CHN_WARN, "Address wrap around\n");
+           value.addr.off += offset;
 	   DEBUG_AddSymbol( name, &value, NULL, SYM_WINE );
+        }
     }
     fclose(symbolfile);
 }


More information about the wine-patches mailing list