ntdll: Print a warning for thread rename exceptions.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Rémi Bernon 2021-02-05 10:21:28 +01:00 committed by Alexandre Julliard
parent ac14ce8c79
commit 6edf3d3b09
8 changed files with 26 additions and 9 deletions

View file

@ -160,6 +160,10 @@ NTSTATUS WINAPI KiUserExceptionDispatcher( EXCEPTION_RECORD *rec, CONTEXT *conte
rec->ExceptionAddress,
(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
{
TRACE( " r0=%08x r1=%08x r2=%08x r3=%08x r4=%08x r5=%08x\n",

View file

@ -501,6 +501,10 @@ NTSTATUS WINAPI KiUserExceptionDispatcher( EXCEPTION_RECORD *rec, CONTEXT *conte
rec->ExceptionAddress,
(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
{
TRACE(" x0=%016lx x1=%016lx x2=%016lx x3=%016lx\n",

View file

@ -192,6 +192,10 @@ NTSTATUS WINAPI dispatch_exception( EXCEPTION_RECORD *rec, CONTEXT *context )
rec->ExceptionAddress,
(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
{
TRACE(" eax=%08x ebx=%08x ecx=%08x edx=%08x esi=%08x edi=%08x\n",

View file

@ -538,6 +538,10 @@ NTSTATUS WINAPI dispatch_exception( EXCEPTION_RECORD *rec, CONTEXT *context )
rec->ExceptionAddress,
(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
{
TRACE(" rax=%016lx rbx=%016lx rcx=%016lx rdx=%016lx\n",

View file

@ -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_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
}
#endif

View file

@ -155,12 +155,6 @@ struct dbg_breakpoint
#define CXX_EXCEPTION 0xe06d7363
#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 */
typedef struct tagTHREADNAME_INFO
{

View file

@ -63,6 +63,7 @@
#include "windef.h"
#include "winbase.h"
#include "tlhelp32.h"
#include "wine/exception.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(winedbg);
@ -349,7 +350,7 @@ static unsigned char signal_from_debug_event(DEBUG_EVENT* de)
return SIGALRM;
/* should not be here */
case EXCEPTION_INVALID_HANDLE:
case EXCEPTION_NAME_THREAD:
case EXCEPTION_WINE_NAME_THREAD:
return SIGTRAP;
default:
ERR("Unknown exception code 0x%08x\n", ec);
@ -363,7 +364,7 @@ static BOOL handle_exception(struct gdb_context* gdbctx, EXCEPTION_DEBUG_INFO* e
switch (rec->ExceptionCode)
{
case EXCEPTION_NAME_THREAD:
case EXCEPTION_WINE_NAME_THREAD:
{
const THREADNAME_INFO *threadname = (const THREADNAME_INFO *)rec->ExceptionInformation;
struct dbg_thread *thread;

View file

@ -246,7 +246,7 @@ static DWORD dbg_handle_exception(const EXCEPTION_RECORD* rec, BOOL first_chance
case EXCEPTION_SINGLE_STEP:
is_debug = TRUE;
break;
case EXCEPTION_NAME_THREAD:
case EXCEPTION_WINE_NAME_THREAD:
pThreadName = (const THREADNAME_INFO*)(rec->ExceptionInformation);
if (pThreadName->dwThreadID == -1)
pThread = dbg_curr_thread;