feat: add crash stack snapshots and context menu annotations

This commit is contained in:
daniel committed 2026-08-12 18:30:08 +02:00
1 parent 3ef98a9fd5
commit 7f2d4b693f
8 files changed
+71 -1

No files matched your search

+15
View File
@@ -127,6 +127,21 @@ namespace Hal {
rep.stackPointer = regs->SP;
rep.stackSegment = regs->SS;
// An indirect CALL pushes its real continuation address before a
// bad target faults on instruction fetch. Preserve a small stack
// snapshot while the dying process address space is still active;
// stackWords[0] will usually identify the caller even when RIP is
// corrupted data and cannot itself be symbolicated.
constexpr uint64_t snapshotBytes =
CrashReport::StackSnapshotWords * sizeof(uint64_t);
if (Memory::VMM::Paging::IsUserRangeAccessible(
proc->pml4Phys, regs->SP, snapshotBytes, false)) {
auto* userStack = (const volatile uint64_t*)regs->SP;
for (int word = 0; word < CrashReport::StackSnapshotWords; word++)
rep.stackWords[word] = userStack[word];
rep.stackWordCount = CrashReport::StackSnapshotWords;
}
if (i == 0x0E) {
// Page fault: read CR2 for faulting address
asm volatile("mov %%cr2, %0" : "=r"(rep.faultingAddress));