mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 22:47:44 +00:00
Kernel+LibELF+LibCoreDump+CrashReporter: Use JSON for ProcessInfo
This is in preparation of adding (much) more process information to coredumps. As we can only have one null-terminated char[] of arbitrary length in each struct it's now a single JSON blob, which is a great fit: easily extensible in the future and allows for key/value pairs and even nested objects, which will be used e.g. for the process environment, for example.
This commit is contained in:
parent
7ad9b116f7
commit
568cde5e23
5 changed files with 72 additions and 21 deletions
|
@ -50,9 +50,14 @@ struct [[gnu::packed]] NotesEntry {
|
|||
|
||||
struct [[gnu::packed]] ProcessInfo {
|
||||
NotesEntryHeader header;
|
||||
int pid;
|
||||
u8 termination_signal;
|
||||
char executable_path[]; // Null terminated
|
||||
// Information is stored as JSON blob to allow arbitrary
|
||||
// number and length of strings/objects/arrays.
|
||||
//
|
||||
// Keys:
|
||||
// - "pid" (int)
|
||||
// - "termination_signal" (u8)
|
||||
// - "executable_path" (String)
|
||||
char json_data[]; // Null terminated
|
||||
};
|
||||
|
||||
struct [[gnu::packed]] ThreadInfo {
|
||||
|
@ -81,6 +86,11 @@ struct [[gnu::packed]] MemoryRegionInfo {
|
|||
|
||||
struct [[gnu::packed]] Metadata {
|
||||
NotesEntryHeader header;
|
||||
// Arbitrary metadata, set via SC_set_coredump_metadata.
|
||||
// Limited to 16 entries and 16 KiB keys/values by the kernel.
|
||||
//
|
||||
// Well-known keys:
|
||||
// - "assertion": Used by LibC's __assertion_failed() to store assertion info
|
||||
char json_data[]; // Null terminated
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue