ntdll: Add a helper macro to dump a register context.
This commit is contained in:
parent
2e63272f2f
commit
61564202b5
5 changed files with 72 additions and 102 deletions
|
@ -153,6 +153,44 @@ static inline void ascii_to_unicode( WCHAR *dst, const char *src, size_t len )
|
|||
extern TEB_FLS_DATA *fls_alloc_data(void);
|
||||
extern void heap_thread_detach(void);
|
||||
|
||||
/* register context */
|
||||
|
||||
#ifdef __i386__
|
||||
# define TRACE_CONTEXT(c) do { \
|
||||
TRACE( "eip=%08lx esp=%08lx ebp=%08lx eflags=%08lx\n", (c)->Eip, (c)->Esp, (c)->Ebp, (c)->EFlags );\
|
||||
TRACE( "eax=%08lx ebx=%08lx ecx=%08lx edx=%08lx\n", (c)->Eax, (c)->Ebx, (c)->Ecx, (c)->Edx ); \
|
||||
TRACE( "esi=%08lx edi=%08lx cs=%04x ds=%04x es=%04x fs=%04x gs=%04x ss=%04x\n", \
|
||||
(c)->Esi, (c)->Edi, LOWORD((c)->SegCs), LOWORD((c)->SegDs), LOWORD((c)->SegEs), \
|
||||
LOWORD((c)->SegFs), LOWORD((c)->SegGs), LOWORD((c)->SegSs) ); \
|
||||
} while(0)
|
||||
#elif defined(__x86_64__)
|
||||
# define TRACE_CONTEXT(c) do { \
|
||||
TRACE( "rip=%016I64x rsp=%016I64x rbp=%016I64x eflags=%08lx\n", (c)->Rip, (c)->Rsp, (c)->Rbp, (c)->EFlags ); \
|
||||
TRACE( "rax=%016I64x rbx=%016I64x rcx=%016I64x rdx=%016I64x\n", (c)->Rax, (c)->Rbx, (c)->Rcx, (c)->Rdx ); \
|
||||
TRACE( "rsi=%016I64x rdi=%016I64x r8=%016I64x r9=%016I64x\n", (c)->Rsi, (c)->Rdi, (c)->R8, (c)->R9 ); \
|
||||
TRACE( "r10=%016I64x r11=%016I64x r12=%016I64x r13=%016I64x\n", (c)->R10, (c)->R11, (c)->R12, (c)->R13 ); \
|
||||
TRACE( "r14=%016I64x r15=%016I64x mxcsr=%08lx\n", (c)->R14, (c)->R15, (c)->MxCsr ); \
|
||||
} while(0)
|
||||
#elif defined(__arm__)
|
||||
# define TRACE_CONTEXT(c) do { \
|
||||
TRACE( "pc=%08lx sp=%08lx lr=%08lx ip=%08lx cpsr=%08lx\n", (c)->Pc, (c)->Sp, (c)->Lr, (c)->R12, (c)->Cpsr ); \
|
||||
TRACE( "r0=%08lx r1=%08lx r2=%08lx r3=%08lx r4=%08lx r5=%08lx\n", (c)->R0, (c)->R1, (c)->R2, (c)->R3, (c)->R4, (c)->R5 ); \
|
||||
TRACE( "r6=%08lx r7=%08lx r8=%08lx r9=%08lx r10=%08lx r11=%08lx\n", (c)->R6, (c)->R7, (c)->R8, (c)->R9, (c)->R10, (c)->R11 ); \
|
||||
} while(0)
|
||||
#elif defined(__aarch64__)
|
||||
# define TRACE_CONTEXT(c) do { \
|
||||
TRACE( " pc=%016I64x sp=%016I64x lr=%016I64x fp=%016I64x\n", (c)->Pc, (c)->Sp, (c)->Lr, (c)->Fp ); \
|
||||
TRACE( " x0=%016I64x x1=%016I64x x2=%016I64x x3=%016I64x\n", (c)->X0, (c)->X1, (c)->X2, (c)->X3 ); \
|
||||
TRACE( " x4=%016I64x x5=%016I64x x6=%016I64x x7=%016I64x\n", (c)->X4, (c)->X5, (c)->X6, (c)->X7 ); \
|
||||
TRACE( " x8=%016I64x x9=%016I64x x10=%016I64x x11=%016I64x\n", (c)->X8, (c)->X9, (c)->X10, (c)->X11 ); \
|
||||
TRACE( "x12=%016I64x x13=%016I64x x14=%016I64x x15=%016I64x\n", (c)->X12, (c)->X13, (c)->X14, (c)->X15 ); \
|
||||
TRACE( "x16=%016I64x x17=%016I64x x18=%016I64x x19=%016I64x\n", (c)->X16, (c)->X17, (c)->X18, (c)->X19 ); \
|
||||
TRACE( "x20=%016I64x x21=%016I64x x22=%016I64x x23=%016I64x\n", (c)->X20, (c)->X21, (c)->X22, (c)->X23 ); \
|
||||
TRACE( "x24=%016I64x x25=%016I64x x26=%016I64x x27=%016I64x\n", (c)->X24, (c)->X25, (c)->X26, (c)->X27 ); \
|
||||
TRACE( "x28=%016I64x cpsr=%08lx fpcr=%08lx fpsr=%08lx\n", (c)->X28, (c)->Cpsr, (c)->Fpcr, (c)->Fpsr ); \
|
||||
} while(0)
|
||||
#endif
|
||||
|
||||
#ifdef __arm64ec__
|
||||
|
||||
extern void *__os_arm64x_check_call;
|
||||
|
|
|
@ -446,11 +446,6 @@ NTSTATUS WINAPI dispatch_exception( EXCEPTION_RECORD *rec, CONTEXT *context )
|
|||
NTSTATUS status;
|
||||
DWORD c;
|
||||
|
||||
TRACE( "code=%lx flags=%lx addr=%p pc=%08lx\n",
|
||||
rec->ExceptionCode, rec->ExceptionFlags, rec->ExceptionAddress, context->Pc );
|
||||
for (c = 0; c < rec->NumberParameters; c++)
|
||||
TRACE( " info[%ld]=%08Ix\n", c, rec->ExceptionInformation[c] );
|
||||
|
||||
if (rec->ExceptionCode == EXCEPTION_WINE_STUB)
|
||||
{
|
||||
if (rec->ExceptionInformation[1] >> 16)
|
||||
|
@ -487,14 +482,14 @@ NTSTATUS WINAPI dispatch_exception( EXCEPTION_RECORD *rec, CONTEXT *context )
|
|||
else
|
||||
WARN( "%s exception (code=%lx) raised\n", debugstr_exception_code(rec->ExceptionCode), rec->ExceptionCode );
|
||||
|
||||
TRACE( " r0=%08lx r1=%08lx r2=%08lx r3=%08lx r4=%08lx r5=%08lx\n",
|
||||
context->R0, context->R1, context->R2, context->R3, context->R4, context->R5 );
|
||||
TRACE( " r6=%08lx r7=%08lx r8=%08lx r9=%08lx r10=%08lx r11=%08lx\n",
|
||||
context->R6, context->R7, context->R8, context->R9, context->R10, context->R11 );
|
||||
TRACE( " r12=%08lx sp=%08lx lr=%08lx pc=%08lx cpsr=%08lx\n",
|
||||
context->R12, context->Sp, context->Lr, context->Pc, context->Cpsr );
|
||||
}
|
||||
|
||||
TRACE( "code=%lx flags=%lx addr=%p\n",
|
||||
rec->ExceptionCode, rec->ExceptionFlags, rec->ExceptionAddress );
|
||||
for (c = 0; c < rec->NumberParameters; c++)
|
||||
TRACE( " info[%ld]=%08Ix\n", c, rec->ExceptionInformation[c] );
|
||||
TRACE_CONTEXT( context );
|
||||
|
||||
if (call_vectored_handlers( rec, context ) == EXCEPTION_CONTINUE_EXECUTION)
|
||||
NtContinue( context, FALSE );
|
||||
|
||||
|
@ -730,18 +725,11 @@ void WINAPI RtlUnwindEx( PVOID end_frame, PVOID target_ip, EXCEPTION_RECORD *rec
|
|||
|
||||
rec->ExceptionFlags |= EH_UNWINDING | (end_frame ? 0 : EH_EXIT_UNWIND);
|
||||
|
||||
TRACE( "code=%lx flags=%lx end_frame=%p target_ip=%p pc=%08lx\n",
|
||||
rec->ExceptionCode, rec->ExceptionFlags, end_frame, target_ip, context->Pc );
|
||||
TRACE( "code=%lx flags=%lx end_frame=%p target_ip=%p\n",
|
||||
rec->ExceptionCode, rec->ExceptionFlags, end_frame, target_ip );
|
||||
for (i = 0; i < min( EXCEPTION_MAXIMUM_PARAMETERS, rec->NumberParameters ); i++)
|
||||
TRACE( " info[%ld]=%08Ix\n", i, rec->ExceptionInformation[i] );
|
||||
TRACE(" r0=%08lx r1=%08lx r2=%08lx r3=%08lx\n",
|
||||
context->R0, context->R1, context->R2, context->R3 );
|
||||
TRACE(" r4=%08lx r5=%08lx r6=%08lx r7=%08lx\n",
|
||||
context->R4, context->R5, context->R6, context->R7 );
|
||||
TRACE(" r8=%08lx r9=%08lx r10=%08lx r11=%08lx\n",
|
||||
context->R8, context->R9, context->R10, context->R11 );
|
||||
TRACE(" r12=%08lx sp=%08lx lr=%08lx pc=%08lx\n",
|
||||
context->R12, context->Sp, context->Lr, context->Pc );
|
||||
TRACE_CONTEXT( context );
|
||||
|
||||
dispatch.TargetPc = (ULONG_PTR)target_ip;
|
||||
dispatch.ContextRecord = context;
|
||||
|
|
|
@ -446,11 +446,6 @@ NTSTATUS WINAPI dispatch_exception( EXCEPTION_RECORD *rec, CONTEXT *context )
|
|||
NTSTATUS status;
|
||||
DWORD c;
|
||||
|
||||
TRACE( "code=%lx flags=%lx addr=%p pc=%016I64x\n",
|
||||
rec->ExceptionCode, rec->ExceptionFlags, rec->ExceptionAddress, context->Pc );
|
||||
for (c = 0; c < rec->NumberParameters; c++)
|
||||
TRACE( " info[%ld]=%016I64x\n", c, rec->ExceptionInformation[c] );
|
||||
|
||||
if (rec->ExceptionCode == EXCEPTION_WINE_STUB)
|
||||
{
|
||||
if (rec->ExceptionInformation[1] >> 16)
|
||||
|
@ -486,25 +481,14 @@ NTSTATUS WINAPI dispatch_exception( EXCEPTION_RECORD *rec, CONTEXT *context )
|
|||
ERR( "%s exception (code=%lx) raised\n", debugstr_exception_code(rec->ExceptionCode), rec->ExceptionCode );
|
||||
else
|
||||
WARN( "%s exception (code=%lx) raised\n", debugstr_exception_code(rec->ExceptionCode), rec->ExceptionCode );
|
||||
|
||||
TRACE(" x0=%016I64x x1=%016I64x x2=%016I64x x3=%016I64x\n",
|
||||
context->X0, context->X1, context->X2, context->X3 );
|
||||
TRACE(" x4=%016I64x x5=%016I64x x6=%016I64x x7=%016I64x\n",
|
||||
context->X4, context->X5, context->X6, context->X7 );
|
||||
TRACE(" x8=%016I64x x9=%016I64x x10=%016I64x x11=%016I64x\n",
|
||||
context->X8, context->X9, context->X10, context->X11 );
|
||||
TRACE(" x12=%016I64x x13=%016I64x x14=%016I64x x15=%016I64x\n",
|
||||
context->X12, context->X13, context->X14, context->X15 );
|
||||
TRACE(" x16=%016I64x x17=%016I64x x18=%016I64x x19=%016I64x\n",
|
||||
context->X16, context->X17, context->X18, context->X19 );
|
||||
TRACE(" x20=%016I64x x21=%016I64x x22=%016I64x x23=%016I64x\n",
|
||||
context->X20, context->X21, context->X22, context->X23 );
|
||||
TRACE(" x24=%016I64x x25=%016I64x x26=%016I64x x27=%016I64x\n",
|
||||
context->X24, context->X25, context->X26, context->X27 );
|
||||
TRACE(" x28=%016I64x fp=%016I64x lr=%016I64x sp=%016I64x\n",
|
||||
context->X28, context->Fp, context->Lr, context->Sp );
|
||||
}
|
||||
|
||||
TRACE( "code=%lx flags=%lx addr=%p\n",
|
||||
rec->ExceptionCode, rec->ExceptionFlags, rec->ExceptionAddress );
|
||||
for (c = 0; c < rec->NumberParameters; c++)
|
||||
TRACE( " info[%ld]=%016I64x\n", c, rec->ExceptionInformation[c] );
|
||||
TRACE_CONTEXT( context );
|
||||
|
||||
if (call_vectored_handlers( rec, context ) == EXCEPTION_CONTINUE_EXECUTION)
|
||||
NtContinue( context, FALSE );
|
||||
|
||||
|
@ -736,26 +720,11 @@ void WINAPI RtlUnwindEx( PVOID end_frame, PVOID target_ip, EXCEPTION_RECORD *rec
|
|||
|
||||
rec->ExceptionFlags |= EH_UNWINDING | (end_frame ? 0 : EH_EXIT_UNWIND);
|
||||
|
||||
TRACE( "code=%lx flags=%lx end_frame=%p target_ip=%p pc=%016I64x\n",
|
||||
rec->ExceptionCode, rec->ExceptionFlags, end_frame, target_ip, context->Pc );
|
||||
TRACE( "code=%lx flags=%lx end_frame=%p target_ip=%p\n",
|
||||
rec->ExceptionCode, rec->ExceptionFlags, end_frame, target_ip );
|
||||
for (i = 0; i < min( EXCEPTION_MAXIMUM_PARAMETERS, rec->NumberParameters ); i++)
|
||||
TRACE( " info[%ld]=%016I64x\n", i, rec->ExceptionInformation[i] );
|
||||
TRACE(" x0=%016I64x x1=%016I64x x2=%016I64x x3=%016I64x\n",
|
||||
context->X0, context->X1, context->X2, context->X3 );
|
||||
TRACE(" x4=%016I64x x5=%016I64x x6=%016I64x x7=%016I64x\n",
|
||||
context->X4, context->X5, context->X6, context->X7 );
|
||||
TRACE(" x8=%016I64x x9=%016I64x x10=%016I64x x11=%016I64x\n",
|
||||
context->X8, context->X9, context->X10, context->X11 );
|
||||
TRACE(" x12=%016I64x x13=%016I64x x14=%016I64x x15=%016I64x\n",
|
||||
context->X12, context->X13, context->X14, context->X15 );
|
||||
TRACE(" x16=%016I64x x17=%016I64x x18=%016I64x x19=%016I64x\n",
|
||||
context->X16, context->X17, context->X18, context->X19 );
|
||||
TRACE(" x20=%016I64x x21=%016I64x x22=%016I64x x23=%016I64x\n",
|
||||
context->X20, context->X21, context->X22, context->X23 );
|
||||
TRACE(" x24=%016I64x x25=%016I64x x26=%016I64x x27=%016I64x\n",
|
||||
context->X24, context->X25, context->X26, context->X27 );
|
||||
TRACE(" x28=%016I64x fp=%016I64x lr=%016I64x sp=%016I64x\n",
|
||||
context->X28, context->Fp, context->Lr, context->Sp );
|
||||
TRACE_CONTEXT( context );
|
||||
|
||||
dispatch.TargetPc = (ULONG64)target_ip;
|
||||
dispatch.ContextRecord = context;
|
||||
|
|
|
@ -200,11 +200,6 @@ NTSTATUS WINAPI dispatch_exception( EXCEPTION_RECORD *rec, CONTEXT *context )
|
|||
NTSTATUS status;
|
||||
DWORD c;
|
||||
|
||||
TRACE( "code=%lx flags=%lx addr=%p ip=%08lx\n",
|
||||
rec->ExceptionCode, rec->ExceptionFlags, rec->ExceptionAddress, context->Eip );
|
||||
for (c = 0; c < rec->NumberParameters; c++)
|
||||
TRACE( " info[%ld]=%08Ix\n", c, rec->ExceptionInformation[c] );
|
||||
|
||||
if (rec->ExceptionCode == EXCEPTION_WINE_STUB)
|
||||
{
|
||||
if (rec->ExceptionInformation[1] >> 16)
|
||||
|
@ -240,15 +235,14 @@ NTSTATUS WINAPI dispatch_exception( EXCEPTION_RECORD *rec, CONTEXT *context )
|
|||
ERR( "%s exception (code=%lx) raised\n", debugstr_exception_code(rec->ExceptionCode), rec->ExceptionCode );
|
||||
else
|
||||
WARN( "%s exception (code=%lx) raised\n", debugstr_exception_code(rec->ExceptionCode), rec->ExceptionCode );
|
||||
|
||||
TRACE(" eax=%08lx ebx=%08lx ecx=%08lx edx=%08lx esi=%08lx edi=%08lx\n",
|
||||
context->Eax, context->Ebx, context->Ecx,
|
||||
context->Edx, context->Esi, context->Edi );
|
||||
TRACE(" ebp=%08lx esp=%08lx cs=%04lx ss=%04lx ds=%04lx es=%04lx fs=%04lx gs=%04lx flags=%08lx\n",
|
||||
context->Ebp, context->Esp, context->SegCs, context->SegSs, context->SegDs,
|
||||
context->SegEs, context->SegFs, context->SegGs, context->EFlags );
|
||||
}
|
||||
|
||||
TRACE( "code=%lx flags=%lx addr=%p\n",
|
||||
rec->ExceptionCode, rec->ExceptionFlags, rec->ExceptionAddress );
|
||||
for (c = 0; c < rec->NumberParameters; c++)
|
||||
TRACE( " info[%ld]=%08Ix\n", c, rec->ExceptionInformation[c] );
|
||||
TRACE_CONTEXT( context );
|
||||
|
||||
if (call_vectored_handlers( rec, context ) == EXCEPTION_CONTINUE_EXECUTION)
|
||||
NtContinue( context, FALSE );
|
||||
|
||||
|
@ -409,11 +403,7 @@ void WINAPI __regs_RtlUnwind( EXCEPTION_REGISTRATION_RECORD* pEndFrame, PVOID ta
|
|||
pRecord->ExceptionFlags |= EH_UNWINDING | (pEndFrame ? 0 : EH_EXIT_UNWIND);
|
||||
|
||||
TRACE( "code=%lx flags=%lx\n", pRecord->ExceptionCode, pRecord->ExceptionFlags );
|
||||
TRACE( "eax=%08lx ebx=%08lx ecx=%08lx edx=%08lx esi=%08lx edi=%08lx\n",
|
||||
context->Eax, context->Ebx, context->Ecx, context->Edx, context->Esi, context->Edi );
|
||||
TRACE( "ebp=%08lx esp=%08lx eip=%08lx cs=%04x ds=%04x fs=%04x gs=%04x flags=%08lx\n",
|
||||
context->Ebp, context->Esp, context->Eip, LOWORD(context->SegCs), LOWORD(context->SegDs),
|
||||
LOWORD(context->SegFs), LOWORD(context->SegGs), context->EFlags );
|
||||
TRACE_CONTEXT( context );
|
||||
|
||||
/* get chain of exception frames */
|
||||
frame = NtCurrentTeb()->Tib.ExceptionList;
|
||||
|
|
|
@ -364,11 +364,6 @@ NTSTATUS WINAPI dispatch_exception( EXCEPTION_RECORD *rec, CONTEXT *context )
|
|||
NTSTATUS status;
|
||||
DWORD c;
|
||||
|
||||
TRACE( "code=%lx flags=%lx addr=%p ip=%Ix\n",
|
||||
rec->ExceptionCode, rec->ExceptionFlags, rec->ExceptionAddress, context->Rip );
|
||||
for (c = 0; c < min( EXCEPTION_MAXIMUM_PARAMETERS, rec->NumberParameters ); c++)
|
||||
TRACE( " info[%ld]=%016I64x\n", c, rec->ExceptionInformation[c] );
|
||||
|
||||
if (rec->ExceptionCode == EXCEPTION_WINE_STUB)
|
||||
{
|
||||
if (rec->ExceptionInformation[1] >> 16)
|
||||
|
@ -404,17 +399,14 @@ NTSTATUS WINAPI dispatch_exception( EXCEPTION_RECORD *rec, CONTEXT *context )
|
|||
ERR( "%s exception (code=%lx) raised\n", debugstr_exception_code(rec->ExceptionCode), rec->ExceptionCode );
|
||||
else
|
||||
WARN( "%s exception (code=%lx) raised\n", debugstr_exception_code(rec->ExceptionCode), rec->ExceptionCode );
|
||||
|
||||
TRACE( " rax=%016I64x rbx=%016I64x rcx=%016I64x rdx=%016I64x\n",
|
||||
context->Rax, context->Rbx, context->Rcx, context->Rdx );
|
||||
TRACE( " rsi=%016I64x rdi=%016I64x rbp=%016I64x rsp=%016I64x\n",
|
||||
context->Rsi, context->Rdi, context->Rbp, context->Rsp );
|
||||
TRACE( " r8=%016I64x r9=%016I64x r10=%016I64x r11=%016I64x\n",
|
||||
context->R8, context->R9, context->R10, context->R11 );
|
||||
TRACE( " r12=%016I64x r13=%016I64x r14=%016I64x r15=%016I64x\n",
|
||||
context->R12, context->R13, context->R14, context->R15 );
|
||||
}
|
||||
|
||||
TRACE( "code=%lx flags=%lx addr=%p\n",
|
||||
rec->ExceptionCode, rec->ExceptionFlags, rec->ExceptionAddress );
|
||||
for (c = 0; c < min( EXCEPTION_MAXIMUM_PARAMETERS, rec->NumberParameters ); c++)
|
||||
TRACE( " info[%ld]=%016I64x\n", c, rec->ExceptionInformation[c] );
|
||||
TRACE_CONTEXT( context );
|
||||
|
||||
if (call_vectored_handlers( rec, context ) == EXCEPTION_CONTINUE_EXECUTION)
|
||||
NtContinue( context, FALSE );
|
||||
|
||||
|
@ -881,18 +873,11 @@ void WINAPI RtlUnwindEx( PVOID end_frame, PVOID target_ip, EXCEPTION_RECORD *rec
|
|||
|
||||
rec->ExceptionFlags |= EH_UNWINDING | (end_frame ? 0 : EH_EXIT_UNWIND);
|
||||
|
||||
TRACE( "code=%lx flags=%lx end_frame=%p target_ip=%p rip=%016I64x\n",
|
||||
rec->ExceptionCode, rec->ExceptionFlags, end_frame, target_ip, context->Rip );
|
||||
TRACE( "code=%lx flags=%lx end_frame=%p target_ip=%p\n",
|
||||
rec->ExceptionCode, rec->ExceptionFlags, end_frame, target_ip );
|
||||
for (i = 0; i < min( EXCEPTION_MAXIMUM_PARAMETERS, rec->NumberParameters ); i++)
|
||||
TRACE( " info[%ld]=%016I64x\n", i, rec->ExceptionInformation[i] );
|
||||
TRACE(" rax=%016I64x rbx=%016I64x rcx=%016I64x rdx=%016I64x\n",
|
||||
context->Rax, context->Rbx, context->Rcx, context->Rdx );
|
||||
TRACE(" rsi=%016I64x rdi=%016I64x rbp=%016I64x rsp=%016I64x\n",
|
||||
context->Rsi, context->Rdi, context->Rbp, context->Rsp );
|
||||
TRACE(" r8=%016I64x r9=%016I64x r10=%016I64x r11=%016I64x\n",
|
||||
context->R8, context->R9, context->R10, context->R11 );
|
||||
TRACE(" r12=%016I64x r13=%016I64x r14=%016I64x r15=%016I64x\n",
|
||||
context->R12, context->R13, context->R14, context->R15 );
|
||||
TRACE_CONTEXT( context );
|
||||
|
||||
dispatch.EstablisherFrame = context->Rsp;
|
||||
dispatch.TargetIp = (ULONG64)target_ip;
|
||||
|
|
Loading…
Add table
Reference in a new issue