Commit 6edf3d3b authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

ntdll: Print a warning for thread rename exceptions.

parent ac14ce8c
...@@ -160,6 +160,10 @@ NTSTATUS WINAPI KiUserExceptionDispatcher( EXCEPTION_RECORD *rec, CONTEXT *conte ...@@ -160,6 +160,10 @@ NTSTATUS WINAPI KiUserExceptionDispatcher( EXCEPTION_RECORD *rec, CONTEXT *conte
rec->ExceptionAddress, rec->ExceptionAddress,
(char*)rec->ExceptionInformation[0], rec->ExceptionInformation[1] ); (char*)rec->ExceptionInformation[0], rec->ExceptionInformation[1] );
} }
else if (rec->ExceptionCode == EXCEPTION_WINE_NAME_THREAD && rec->ExceptionInformation[0] == 0x1000)
{
WARN( "Thread %04x renamed to %s\n", (DWORD)rec->ExceptionInformation[2], debugstr_a((char *)rec->ExceptionInformation[1]) );
}
else else
{ {
TRACE( " r0=%08x r1=%08x r2=%08x r3=%08x r4=%08x r5=%08x\n", TRACE( " r0=%08x r1=%08x r2=%08x r3=%08x r4=%08x r5=%08x\n",
......
...@@ -501,6 +501,10 @@ NTSTATUS WINAPI KiUserExceptionDispatcher( EXCEPTION_RECORD *rec, CONTEXT *conte ...@@ -501,6 +501,10 @@ NTSTATUS WINAPI KiUserExceptionDispatcher( EXCEPTION_RECORD *rec, CONTEXT *conte
rec->ExceptionAddress, rec->ExceptionAddress,
(char*)rec->ExceptionInformation[0], rec->ExceptionInformation[1] ); (char*)rec->ExceptionInformation[0], rec->ExceptionInformation[1] );
} }
else if (rec->ExceptionCode == EXCEPTION_WINE_NAME_THREAD && rec->ExceptionInformation[0] == 0x1000)
{
WARN( "Thread %04x renamed to %s\n", (DWORD)rec->ExceptionInformation[2], debugstr_a((char *)rec->ExceptionInformation[1]) );
}
else else
{ {
TRACE(" x0=%016lx x1=%016lx x2=%016lx x3=%016lx\n", TRACE(" x0=%016lx x1=%016lx x2=%016lx x3=%016lx\n",
......
...@@ -192,6 +192,10 @@ NTSTATUS WINAPI dispatch_exception( EXCEPTION_RECORD *rec, CONTEXT *context ) ...@@ -192,6 +192,10 @@ NTSTATUS WINAPI dispatch_exception( EXCEPTION_RECORD *rec, CONTEXT *context )
rec->ExceptionAddress, rec->ExceptionAddress,
(char*)rec->ExceptionInformation[0], rec->ExceptionInformation[1] ); (char*)rec->ExceptionInformation[0], rec->ExceptionInformation[1] );
} }
else if (rec->ExceptionCode == EXCEPTION_WINE_NAME_THREAD && rec->ExceptionInformation[0] == 0x1000)
{
WARN( "Thread %04x renamed to %s\n", (DWORD)rec->ExceptionInformation[2], debugstr_a((char *)rec->ExceptionInformation[1]) );
}
else else
{ {
TRACE(" eax=%08x ebx=%08x ecx=%08x edx=%08x esi=%08x edi=%08x\n", TRACE(" eax=%08x ebx=%08x ecx=%08x edx=%08x esi=%08x edi=%08x\n",
......
...@@ -538,6 +538,10 @@ NTSTATUS WINAPI dispatch_exception( EXCEPTION_RECORD *rec, CONTEXT *context ) ...@@ -538,6 +538,10 @@ NTSTATUS WINAPI dispatch_exception( EXCEPTION_RECORD *rec, CONTEXT *context )
rec->ExceptionAddress, rec->ExceptionAddress,
(char*)rec->ExceptionInformation[0], rec->ExceptionInformation[1] ); (char*)rec->ExceptionInformation[0], rec->ExceptionInformation[1] );
} }
else if (rec->ExceptionCode == EXCEPTION_WINE_NAME_THREAD && rec->ExceptionInformation[0] == 0x1000)
{
WARN( "Thread %04x renamed to %s\n", (DWORD)rec->ExceptionInformation[2], debugstr_a((char *)rec->ExceptionInformation[1]) );
}
else else
{ {
TRACE(" rax=%016lx rbx=%016lx rcx=%016lx rdx=%016lx\n", TRACE(" rax=%016lx rbx=%016lx rcx=%016lx rdx=%016lx\n",
......
...@@ -302,6 +302,12 @@ static inline EXCEPTION_REGISTRATION_RECORD *__wine_get_frame(void) ...@@ -302,6 +302,12 @@ static inline EXCEPTION_REGISTRATION_RECORD *__wine_get_frame(void)
#define EXCEPTION_WINE_STUB 0x80000100 /* stub entry point called */ #define EXCEPTION_WINE_STUB 0x80000100 /* stub entry point called */
#define EXCEPTION_WINE_ASSERTION 0x80000101 /* assertion failed */ #define EXCEPTION_WINE_ASSERTION 0x80000101 /* assertion failed */
/* Wine extension; Windows doesn't have a name for this code. This is an
undocumented exception understood by MS VC debugger, allowing the program
to name a particular thread. Search google.com or deja.com for "0x406d1388"
for more info. */
#define EXCEPTION_WINE_NAME_THREAD 0x406D1388
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
......
...@@ -155,12 +155,6 @@ struct dbg_breakpoint ...@@ -155,12 +155,6 @@ struct dbg_breakpoint
#define CXX_EXCEPTION 0xe06d7363 #define CXX_EXCEPTION 0xe06d7363
#define CXX_FRAME_MAGIC 0x19930520 #define CXX_FRAME_MAGIC 0x19930520
/* Wine extension; Windows doesn't have a name for this code. This is an
undocumented exception understood by MS VC debugger, allowing the program
to name a particular thread. Search google.com or deja.com for "0x406d1388"
for more info. */
#define EXCEPTION_NAME_THREAD 0x406D1388
/* Helper structure */ /* Helper structure */
typedef struct tagTHREADNAME_INFO typedef struct tagTHREADNAME_INFO
{ {
......
...@@ -63,6 +63,7 @@ ...@@ -63,6 +63,7 @@
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "tlhelp32.h" #include "tlhelp32.h"
#include "wine/exception.h"
#include "wine/debug.h" #include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(winedbg); WINE_DEFAULT_DEBUG_CHANNEL(winedbg);
...@@ -349,7 +350,7 @@ static unsigned char signal_from_debug_event(DEBUG_EVENT* de) ...@@ -349,7 +350,7 @@ static unsigned char signal_from_debug_event(DEBUG_EVENT* de)
return SIGALRM; return SIGALRM;
/* should not be here */ /* should not be here */
case EXCEPTION_INVALID_HANDLE: case EXCEPTION_INVALID_HANDLE:
case EXCEPTION_NAME_THREAD: case EXCEPTION_WINE_NAME_THREAD:
return SIGTRAP; return SIGTRAP;
default: default:
ERR("Unknown exception code 0x%08x\n", ec); ERR("Unknown exception code 0x%08x\n", ec);
...@@ -363,7 +364,7 @@ static BOOL handle_exception(struct gdb_context* gdbctx, EXCEPTION_DEBUG_INFO* e ...@@ -363,7 +364,7 @@ static BOOL handle_exception(struct gdb_context* gdbctx, EXCEPTION_DEBUG_INFO* e
switch (rec->ExceptionCode) switch (rec->ExceptionCode)
{ {
case EXCEPTION_NAME_THREAD: case EXCEPTION_WINE_NAME_THREAD:
{ {
const THREADNAME_INFO *threadname = (const THREADNAME_INFO *)rec->ExceptionInformation; const THREADNAME_INFO *threadname = (const THREADNAME_INFO *)rec->ExceptionInformation;
struct dbg_thread *thread; struct dbg_thread *thread;
......
...@@ -246,7 +246,7 @@ static DWORD dbg_handle_exception(const EXCEPTION_RECORD* rec, BOOL first_chance ...@@ -246,7 +246,7 @@ static DWORD dbg_handle_exception(const EXCEPTION_RECORD* rec, BOOL first_chance
case EXCEPTION_SINGLE_STEP: case EXCEPTION_SINGLE_STEP:
is_debug = TRUE; is_debug = TRUE;
break; break;
case EXCEPTION_NAME_THREAD: case EXCEPTION_WINE_NAME_THREAD:
pThreadName = (const THREADNAME_INFO*)(rec->ExceptionInformation); pThreadName = (const THREADNAME_INFO*)(rec->ExceptionInformation);
if (pThreadName->dwThreadID == -1) if (pThreadName->dwThreadID == -1)
pThread = dbg_curr_thread; pThread = dbg_curr_thread;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment