made the debugger start a bit more robust

eric pouech eric.pouech at wanadoo.fr
Fri Apr 13 15:41:08 CDT 2001


A+
-- 
---------------
Eric Pouech (http://perso.wanadoo.fr/eric.pouech/)
"The future will be better tomorrow", Vice President Dan Quayle
-------------- next part --------------
Name: wdbg_start
ChangeLog: Enhanced robustness at startup
GenDate: 2001/04/13 20:26:34 UTC
ModifiedFiles: debugger/winedbg.c
AddedFiles: 
===================================================================
RCS file: /usr/share/cvs/cvsroot/wine/wine/debugger/winedbg.c,v
retrieving revision 1.30
diff -u -u -r1.30 winedbg.c
--- debugger/winedbg.c	2001/04/09 18:31:47	1.30
+++ debugger/winedbg.c	2001/04/13 15:12:31
@@ -221,6 +221,7 @@
     t->wait_for_first_exception = 0;
     t->dbg_exec_mode = EXEC_CONT;
     t->dbg_exec_count = 0;
+    sprintf(t->name, "%08lx", tid);
 
     p->num_threads++;
     t->next = p->threads;
@@ -860,21 +861,24 @@
     }
 
     DEBUG_Printf(DBG_CHN_MESG, "WineDbg starting... ");
-
+	
     if (argc == 3) {
 	HANDLE	hEvent;
 	DWORD	pid;
 
 	if ((pid = atoi(argv[1])) != 0 && (hEvent = (HANDLE)atoi(argv[2])) != 0) {
-	    BOOL	ret = DEBUG_Attach(pid, TRUE);
-
-	    SetEvent(hEvent);
-            CloseHandle(hEvent);
-	    if (!ret) {
+	    if (!DEBUG_Attach(pid, TRUE)) {
 		DEBUG_Printf(DBG_CHN_ERR, "Can't attach process %ld: %ld\n", 
 			     DEBUG_CurrPid, GetLastError());
+		/* don't care about result */
+		SetEvent(hEvent);
 		goto leave;
 	    }
+	    if (!SetEvent(hEvent)) {
+		DEBUG_Printf(DBG_CHN_ERR, "Invalid event handle: %ld\n", hEvent);
+		goto leave;
+	    }
+            CloseHandle(hEvent);
 	    DEBUG_CurrPid = pid;
 	}
     }


More information about the wine-patches mailing list