From 88285ca7d9ac11c99b01a44d3525acb82d35e1de Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Sat, 5 Jul 2025 04:15:20 +0000 Subject: kernel/amd64: Add support for coredumps To make debugging userland program crashes easier, this commit introduces coredumps that store the last known process state into a temporary /tmp/core.X file (where X is the PID of the faulting process). Signed-off-by: Ian Moffett --- sys/arch/amd64/amd64/trap.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'sys/arch/amd64') diff --git a/sys/arch/amd64/amd64/trap.c b/sys/arch/amd64/amd64/trap.c index c57b5d2..37efad4 100644 --- a/sys/arch/amd64/amd64/trap.c +++ b/sys/arch/amd64/amd64/trap.c @@ -127,6 +127,7 @@ static void trap_user(struct trapframe *tf) { struct proc *td = this_td(); + uintptr_t fault_addr; sigset_t sigset; sigemptyset(&sigset); @@ -148,6 +149,9 @@ trap_user(struct trapframe *tf) break; } + fault_addr = pf_faultaddr(); + proc_coredump(td, fault_addr); + /* * Send the signal then flush the signal queue right * away as these types of events are critical. -- cgit v1.2.3