diff --git a/Kernel/CoreDump.cpp b/Kernel/CoreDump.cpp index 120f73f5e0..579bb6fed0 100644 --- a/Kernel/CoreDump.cpp +++ b/Kernel/CoreDump.cpp @@ -242,7 +242,9 @@ ByteBuffer CoreDump::create_notes_threads_data() const ELF::Core::ThreadInfo info {}; info.header.type = ELF::Core::NotesEntryHeader::Type::ThreadInfo; info.tid = thread.tid().value(); - copy_kernel_registers_into_ptrace_registers(info.regs, thread.get_register_dump_from_stack()); + + if (thread.current_trap()) + copy_kernel_registers_into_ptrace_registers(info.regs, thread.get_register_dump_from_stack()); entry_buff.append((void*)&info, sizeof(info)); diff --git a/Kernel/Thread.h b/Kernel/Thread.h index 18516fba3a..aa7ced83a9 100644 --- a/Kernel/Thread.h +++ b/Kernel/Thread.h @@ -1147,6 +1147,7 @@ public: } TrapFrame*& current_trap() { return m_current_trap; } + TrapFrame const* const& current_trap() const { return m_current_trap; } RecursiveSpinLock& get_lock() const { return m_lock; }