1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 15:48:12 +00:00

Kernel: Generate a coredump file when a process crashes

When a process crashes, we generate a coredump file and write it in
/tmp/coredumps/.

The coredump file is an ELF file of type ET_CORE.
It contains a segment for every userspace memory region of the process,
and an additional PT_NOTE segment that contains the registers state for
each thread, and a additional data about memory regions
(e.g their name).
This commit is contained in:
Itamar 2020-11-06 10:09:51 +02:00 committed by Andreas Kling
parent efe4da57df
commit b4842d33bb
11 changed files with 427 additions and 1 deletions

View file

@ -119,6 +119,7 @@ class Process
friend class InlineLinkedListNode<Process>;
friend class Thread;
friend class CoreDump;
public:
inline static Process* current()
@ -162,6 +163,8 @@ public:
bool is_profiling() const { return m_profiling; }
void set_profiling(bool profiling) { m_profiling = profiling; }
bool should_core_dump() const { return m_should_dump_core; }
void set_dump_core(bool dump_core) { m_should_dump_core = dump_core; }
KBuffer backtrace() const;
@ -616,6 +619,7 @@ private:
bool m_dead { false };
bool m_profiling { false };
Atomic<bool> m_is_stopped { false };
bool m_should_dump_core { false };
RefPtr<Custody> m_executable;
RefPtr<Custody> m_cwd;