Debugger Woes

Eric Pouech pouech-eric at wanadoo.fr
Sat Jan 3 05:03:50 CST 2004


Robert Shearman a écrit :
> After the automatic glibc detection changes the Wine debugger stopped
> loading symbols correctly, making it harder to debug programs. I only
> recently noticed this due to lack of disk space and not compiling and
> installing the whole tree on a cvs update.
We should no longer fall back to load wine if WINELOADER is not set.
The point is that is that it's not very easy to know which loader we 
actually use for the debuggee, so WINELOADER is an easy workaround.
I've attached an uglier solution... Alexandre will not like it :-/
A+
-------------- next part --------------
Name:          wd_wine
ChangeLog:     no longer load symbols from wine
License:       X11
GenDate:       2004/01/03 11:01:53 UTC
ModifiedFiles: programs/winedbg/winedbg.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/programs/winedbg/winedbg.c,v
retrieving revision 1.17
diff -u -u -r1.17 winedbg.c
--- programs/winedbg/winedbg.c	15 Dec 2003 19:53:08 -0000	1.17
+++ programs/winedbg/winedbg.c	3 Jan 2004 11:01:49 -0000
@@ -674,8 +674,9 @@
 
 static	BOOL	DEBUG_HandleDebugEvent(DEBUG_EVENT* de)
 {
-    char		buffer[256];
-    DWORD cont = DBG_CONTINUE;
+    char	buffer[256];
+    DWORD       cont = DBG_CONTINUE;
+    const char* ptr;
 
     DEBUG_CurrPid = de->dwProcessId;
     DEBUG_CurrTid = de->dwThreadId;
@@ -787,19 +788,22 @@
         DEBUG_InitCurrThread();
 
         /* module is either PE, NE or ELF module (for WineLib), but all
-         * are loaded with wine, so load its symbols, then the main module
+         * are loaded with WINELOADER, so load its symbols (if possible)
+         * otherwise, assume debugger & debuggee use the same wine loader
          */
-        do
+        if (!(ptr = getenv("WINELOADER"))) ptr = __wine_main_argv[-1];
+        if (DEBUG_ReadExecutableDbgInfo(ptr) != DIL_ERROR)
         {
-            char*   ptr = getenv("WINELOADER");
-
-            if (!ptr || DEBUG_ReadExecutableDbgInfo( ptr ) == DIL_ERROR)
-                DEBUG_ReadExecutableDbgInfo( "wine" );
-        } while (0);
-
-        DEBUG_LoadModule32(DEBUG_CurrProcess->imageName, de->u.CreateProcessInfo.hFile,
-                           de->u.CreateProcessInfo.lpBaseOfImage);
-
+            /* then load the main module's symbols */
+            DEBUG_LoadModule32(DEBUG_CurrProcess->imageName, de->u.CreateProcessInfo.hFile,
+                               de->u.CreateProcessInfo.lpBaseOfImage);
+        }
+        else
+        {
+            DEBUG_DelThread(DEBUG_CurrProcess->threads);
+            DEBUG_DelProcess(DEBUG_CurrProcess);
+            DEBUG_Printf("Couldn't load process\n");
+        }
         break;
 
     case EXIT_THREAD_DEBUG_EVENT:


More information about the wine-devel mailing list