More verbose output when unhandled exception occurs
Uwe Bonnes
bon at elektron.ikp.physik.tu-darmstadt.de
Wed Nov 2 07:54:26 CST 2005
Changelog:
dlls/kernel/except.c: start_debugger
Decode and print the exception for the WARN message
The WARN is often posted (google gives about 13.600 hits for
"wine: Unhandled exception"). The cause of the exception should be printed
in that context too...
--
Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
Index: wine/dlls/kernel/except.c
===================================================================
RCS file: /home/wine/wine/dlls/kernel/except.c,v
retrieving revision 1.14
diff -u -r1.14 except.c
--- wine/dlls/kernel/except.c 4 Oct 2005 18:14:22 -0000 1.14
+++ wine/dlls/kernel/except.c 2 Nov 2005 13:48:02 -0000
@@ -89,7 +89,7 @@
/*******************************************************************
* format_exception_msg
*/
-static int format_exception_msg( const EXCEPTION_POINTERS *ptr, char *buffer, int size )
+static int format_exception_msg( const EXCEPTION_POINTERS *ptr, char *buffer, int size , int do_ask)
{
const EXCEPTION_RECORD *rec = ptr->ExceptionRecord;
int len,len2;
@@ -159,17 +159,22 @@
}
if ((len<0) || (len>=size))
return -1;
+ if(do_ask)
+ {
#ifdef __i386__
- if (ptr->ContextRecord->SegCs != wine_get_cs())
- len2 = snprintf(buffer+len, size-len,
- " at address 0x%04lx:0x%08lx.\nDo you wish to debug it ?",
- ptr->ContextRecord->SegCs,
- (DWORD)ptr->ExceptionRecord->ExceptionAddress);
- else
+ if (ptr->ContextRecord->SegCs != wine_get_cs())
+ len2 = snprintf(buffer+len, size-len,
+ " at address 0x%04lx:0x%08lx.\nDo you wish to debug it ?",
+ ptr->ContextRecord->SegCs,
+ (DWORD)ptr->ExceptionRecord->ExceptionAddress);
+ else
#endif
- len2 = snprintf(buffer+len, size-len,
- " at address %p.\nDo you wish to debug it ?",
- ptr->ExceptionRecord->ExceptionAddress);
+ len2 = snprintf(buffer+len, size-len,
+ " at address %p.\nDo you wish to debug it ?",
+ ptr->ExceptionRecord->ExceptionAddress);
+ }
+ else
+ len2=0;
if ((len2<0) || (len>=size-len))
return -1;
return len+len2;
@@ -229,6 +234,7 @@
char* format = NULL;
BOOL ret = FALSE;
+ char ebuffer[256];
static const WCHAR AeDebugW[] = {'M','a','c','h','i','n','e','\\',
'S','o','f','t','w','a','r','e','\\',
'M','i','c','r','o','s','o','f','t','\\',
@@ -238,7 +244,8 @@
static const WCHAR DebuggerW[] = {'D','e','b','u','g','g','e','r',0};
static const WCHAR AutoW[] = {'A','u','t','o',0};
- MESSAGE("wine: Unhandled exception (thread %04lx), starting debugger...\n", GetCurrentThreadId());
+ format_exception_msg( epointers, ebuffer, sizeof(ebuffer) , FALSE);
+ MESSAGE("wine: Unhandled exception:\"%s\" (thread %04lx), starting debugger...\n", ebuffer, GetCurrentThreadId());
attr.Length = sizeof(attr);
attr.RootDirectory = 0;
@@ -322,7 +329,7 @@
if (pMessageBoxA)
{
char buffer[256];
- format_exception_msg( epointers, buffer, sizeof(buffer) );
+ format_exception_msg( epointers, buffer, sizeof(buffer) , TRUE);
if (pMessageBoxA( 0, buffer, "Exception raised", MB_YESNO | MB_ICONHAND ) == IDNO)
{
TRACE("Killing process\n");
More information about the wine-patches
mailing list