mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
[DRWTSN32] Implement arm context reading
CORE-17605 CORE-17604
This commit is contained in:
parent
f028ca5b08
commit
1f44552d36
4 changed files with 51 additions and 19 deletions
|
@ -2,7 +2,7 @@
|
|||
* PROJECT: Dr. Watson crash reporter
|
||||
* LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
|
||||
* PURPOSE: Debug loop
|
||||
* COPYRIGHT: Copyright 2017 Mark Jansen (mark.jansen@reactos.org)
|
||||
* COPYRIGHT: Copyright 2017 Mark Jansen <mark.jansen@reactos.org>
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* PROJECT: Dr. Watson crash reporter
|
||||
* LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
|
||||
* PURPOSE: Entrypoint / main print function
|
||||
* COPYRIGHT: Copyright 2017 Mark Jansen (mark.jansen@reactos.org)
|
||||
* COPYRIGHT: Copyright 2017 Mark Jansen <mark.jansen@reactos.org>
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
|
@ -62,10 +62,15 @@ static void PrintThread(FILE* output, DumpData& data, DWORD tid, ThreadData& thr
|
|||
xfprintf(output, "eax:%p ebx:%p ecx:%p edx:%p esi:%p edi:%p" NEWLINE,
|
||||
ctx.Eax, ctx.Ebx, ctx.Ecx, ctx.Edx, ctx.Esi, ctx.Edi);
|
||||
#elif defined(_M_AMD64)
|
||||
xfprintf(output, "rax:%p rbx:%p rcx:%p rdx:%p rsi:%p rdi:%p" NEWLINE,
|
||||
ctx.Rax, ctx.Rbx, ctx.Rcx, ctx.Rdx, ctx.Rsi, ctx.Rdi);
|
||||
xfprintf(output, "rax:%p rbx:%p rcx:%p rdx:%p rsi:%p rdi:%p rbp:%p rsp:%p" NEWLINE,
|
||||
ctx.Rax, ctx.Rbx, ctx.Rcx, ctx.Rdx, ctx.Rsi, ctx.Rdi, ctx.Rbp, ctx.Rsp);
|
||||
xfprintf(output, "r8:%p r9:%p r10:%p r11:%p r12:%p r13:%p r14:%p r15:%p" NEWLINE,
|
||||
ctx.R8, ctx.R9, ctx.R10, ctx.R11, ctx.R12, ctx.R13, ctx.R14, ctx.R15);
|
||||
#elif defined(_M_ARM)
|
||||
xfprintf(output, "r0:%p r1:%p r2:%p r3:%p r4:%p r5:%p r6:%p" NEWLINE,
|
||||
ctx.R0, ctx.R1, ctx.R2, ctx.R3, ctx.R4, ctx.R5, ctx.R6);
|
||||
xfprintf(output, "r7:%p r8:%p r9:%p r10:%p r11:%p r12:%p" NEWLINE,
|
||||
ctx.R7, ctx.R8, ctx.R9, ctx.R10, ctx.R11, ctx.R12);
|
||||
#else
|
||||
#error Unknown architecture
|
||||
#endif
|
||||
|
@ -79,6 +84,9 @@ static void PrintThread(FILE* output, DumpData& data, DWORD tid, ThreadData& thr
|
|||
#elif defined(_M_AMD64)
|
||||
xfprintf(output, "rip:%p rsp:%p rbp:%p" NEWLINE,
|
||||
ctx.Rip, ctx.Rsp, ctx.Rbp);
|
||||
#elif defined(_M_ARM)
|
||||
xfprintf(output, "sp:%p lr:%p pc:%p cpsr:%p" NEWLINE,
|
||||
ctx.Sp, ctx.Lr, ctx.Pc, ctx.Cpsr);
|
||||
#else
|
||||
#error Unknown architecture
|
||||
#endif
|
||||
|
@ -89,6 +97,16 @@ static void PrintThread(FILE* output, DumpData& data, DWORD tid, ThreadData& thr
|
|||
#if defined(_M_IX86) || defined(_M_AMD64)
|
||||
xfprintf(output, "dr0:%p dr1:%p dr2:%p dr3:%p dr6:%p dr7:%p" NEWLINE,
|
||||
ctx.Dr0, ctx.Dr1, ctx.Dr2, ctx.Dr3, ctx.Dr6, ctx.Dr7);
|
||||
#elif defined(_M_ARM)
|
||||
for (int n = 0; n < ARM_MAX_BREAKPOINTS; ++n)
|
||||
xfprintf(output, "Bvr%d:%p%s", n, ctx.Bvr[n], ((n + 1) == ARM_MAX_BREAKPOINTS) ? NEWLINE : " ");
|
||||
for (int n = 0; n < ARM_MAX_BREAKPOINTS; ++n)
|
||||
xfprintf(output, "Bcr%d:%p%s", n, ctx.Bcr[n], ((n + 1) == ARM_MAX_BREAKPOINTS) ? NEWLINE : " ");
|
||||
|
||||
for (int n = 0; n < ARM_MAX_WATCHPOINTS; ++n)
|
||||
xfprintf(output, "Wvr%d:%p%s", n, ctx.Wvr[n], ((n + 1) == ARM_MAX_WATCHPOINTS) ? NEWLINE : " ");
|
||||
for (int n = 0; n < ARM_MAX_WATCHPOINTS; ++n)
|
||||
xfprintf(output, "Wcr%d:%p%s", n, ctx.Wcr[n], ((n + 1) == ARM_MAX_WATCHPOINTS) ? NEWLINE : " ");
|
||||
#else
|
||||
#error Unknown architecture
|
||||
#endif
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* PROJECT: Dr. Watson crash reporter
|
||||
* LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
|
||||
* PURPOSE: Print a stacktrace
|
||||
* COPYRIGHT: Copyright 2017,2018 Mark Jansen (mark.jansen@reactos.org)
|
||||
* COPYRIGHT: Copyright 2017,2018 Mark Jansen <mark.jansen@reactos.org>
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
|
@ -38,25 +38,37 @@ void PrintStackBacktrace(FILE* output, DumpData& data, ThreadData& thread)
|
|||
DWORD MachineType;
|
||||
STACKFRAME64 StackFrame = { { 0 } };
|
||||
|
||||
#ifdef _M_X64
|
||||
MachineType = IMAGE_FILE_MACHINE_AMD64;
|
||||
StackFrame.AddrPC.Offset = thread.Context.Rip;
|
||||
StackFrame.AddrPC.Mode = AddrModeFlat;
|
||||
StackFrame.AddrStack.Offset = thread.Context.Rsp;
|
||||
StackFrame.AddrStack.Mode = AddrModeFlat;
|
||||
StackFrame.AddrFrame.Offset = thread.Context.Rbp;
|
||||
StackFrame.AddrReturn.Mode = AddrModeFlat;
|
||||
StackFrame.AddrFrame.Mode = AddrModeFlat;
|
||||
#else
|
||||
StackFrame.AddrStack.Mode = AddrModeFlat;
|
||||
StackFrame.AddrBStore.Mode = AddrModeFlat;
|
||||
|
||||
|
||||
#if defined(_M_IX86)
|
||||
MachineType = IMAGE_FILE_MACHINE_I386;
|
||||
StackFrame.AddrPC.Offset = thread.Context.Eip;
|
||||
StackFrame.AddrPC.Mode = AddrModeFlat;
|
||||
StackFrame.AddrStack.Offset = thread.Context.Esp;
|
||||
StackFrame.AddrStack.Mode = AddrModeFlat;
|
||||
StackFrame.AddrFrame.Offset = thread.Context.Ebp;
|
||||
StackFrame.AddrFrame.Mode = AddrModeFlat;
|
||||
#elif defined(_M_AMD64)
|
||||
MachineType = IMAGE_FILE_MACHINE_AMD64;
|
||||
StackFrame.AddrPC.Offset = thread.Context.Rip;
|
||||
StackFrame.AddrStack.Offset = thread.Context.Rsp;
|
||||
StackFrame.AddrFrame.Offset = thread.Context.Rbp;
|
||||
#elif defined(_M_ARM)
|
||||
MachineType = IMAGE_FILE_MACHINE_ARMNT;
|
||||
StackFrame.AddrPC.Offset = thread.Context.Pc;
|
||||
StackFrame.AddrStack.Offset = thread.Context.Sp;
|
||||
StackFrame.AddrFrame.Offset = thread.Context.R11;
|
||||
#elif defined(_M_ARM64)
|
||||
MachineType = IMAGE_FILE_MACHINE_ARM64;
|
||||
StackFrame.AddrPC.Offset = thread.Context.Pc;
|
||||
StackFrame.AddrStack.Offset = thread.Context.Sp;
|
||||
StackFrame.AddrFrame.Offset = thread.Context.u.s.Fp;
|
||||
#else
|
||||
#error "Unknown architecture"
|
||||
#endif
|
||||
|
||||
|
||||
#define STACKWALK_MAX_NAMELEN 512
|
||||
char buf[sizeof(SYMBOL_INFO) + STACKWALK_MAX_NAMELEN] = {0};
|
||||
SYMBOL_INFO* sym = (SYMBOL_INFO *)buf;
|
||||
|
@ -64,7 +76,7 @@ void PrintStackBacktrace(FILE* output, DumpData& data, ThreadData& thread)
|
|||
LONG RecursionDepth = 0;
|
||||
sym->SizeOfStruct = sizeof(sym);
|
||||
|
||||
/* FIXME: dump x bytes at EIP here + disasm it! */
|
||||
/* FIXME: dump x bytes at PC here + disasm it! */
|
||||
|
||||
xfprintf(output, NEWLINE "*----> Stack Back Trace <----*" NEWLINE NEWLINE);
|
||||
bool first = true;
|
||||
|
@ -116,6 +128,8 @@ void PrintStackBacktrace(FILE* output, DumpData& data, ThreadData& thread)
|
|||
ULONG_PTR stackPointer = thread.Context.Esp;
|
||||
#elif defined(_M_AMD64)
|
||||
ULONG_PTR stackPointer = thread.Context.Rsp;
|
||||
#elif defined(_M_ARM) || defined(_M_ARM64)
|
||||
ULONG_PTR stackPointer = thread.Context.Sp;
|
||||
#else
|
||||
#error Unknown architecture
|
||||
#endif
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* PROJECT: Dr. Watson crash reporter
|
||||
* LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
|
||||
* PURPOSE: Output system info
|
||||
* COPYRIGHT: Copyright 2017 Mark Jansen (mark.jansen@reactos.org)
|
||||
* COPYRIGHT: Copyright 2017 Mark Jansen <mark.jansen@reactos.org>
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
|
|
Loading…
Reference in a new issue