Debugger

Eric Pouech eric.pouech at wanadoo.fr
Wed Jul 10 06:56:43 CDT 2002


Max a écrit :
> 
> thanx !!!
> 3 - Starting an app in winedbg (no symbol table for app...), debugger sometimes stops at app entry point
>      (as I guess it should), sometimes before.... Is there a way to make it stop on app entry point, even with
>      no symbols loades ? Or, even better.... there's a known (easy !) way to attach symbols generated by
>      a disassembler (i.e. the best one, IDA) ? I've done it in windoze many times, with IDA+Soft-ICE, and
>      it helps a lot !
the "symbolfile foo" used to load the file foo and add symbol from it
format of file foo is the regular unix format
xxxxxxxx T name
where 
xxxxxxxx	address of symbol
T 		type of symbol
name		string that describes the symbol

I think it should still be working (untested though)
dunno either if symbols generated by IDA and other tools will fit the
format of the file
note also that you may have to relocate the adress depending on the load
address of the module the symbols are for (which, if needed, needs to be
done at the file level)

the attached patch should extent the symbolfile command like:

symbolfile foo 0x12345678
to relocate symbols from foo at address 0x12345678 (assuming address in
foo are relative to the start of the module)

A+
-------------- next part --------------
Name:          wdbg_sym
ChangeLog:     added offset for relocating symbols in symbolfile command
License:       X11
GenDate:       2002/07/10 11:54:38 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.35
diff -u -u -r1.35 debugger.h
--- debugger/debugger.h	13 Jun 2002 21:37:07 -0000	1.35
+++ debugger/debugger.h	10 Jul 2002 11:52:17 -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.57
diff -u -u -r1.57 dbg.y
--- debugger/dbg.y	2 Jun 2002 21:36:08 -0000	1.57
+++ debugger/dbg.y	10 Jul 2002 11:52:04 -0000
@@ -156,7 +156,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		{ if (DEBUG_Attach($2, FALSE)) return 1; }
     | tDETACH tEOL              { DEBUG_ExitMode = EXIT_DETACH; return 1; }
Index: debugger/hash.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/debugger/hash.c,v
retrieving revision 1.30
diff -u -u -r1.30 hash.c
--- debugger/hash.c	31 May 2002 23:06:46 -0000	1.30
+++ debugger/hash.c	10 Jul 2002 11:53:12 -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-devel mailing list