diff options
author | Ian Moffett <ian@osmora.org> | 2025-07-05 04:15:20 +0000 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2025-07-05 04:15:20 +0000 |
commit | 88285ca7d9ac11c99b01a44d3525acb82d35e1de (patch) | |
tree | cd21b0bf1e0e8e226925cf12b66da13032668ab9 /sys/arch | |
parent | 68e404c22776f547158aa8f1a88f29c757167591 (diff) |
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 <ian@osmora.org>
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/amd64/amd64/trap.c | 4 |
1 files changed, 4 insertions, 0 deletions
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. |