1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 18:57:35 +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:
Linus Groh 2021-01-13 23:59:22 +01:00 committed by Andreas Kling
parent 7ad9b116f7
commit 568cde5e23
5 changed files with 72 additions and 21 deletions

View file

@ -44,8 +44,6 @@ public:
static OwnPtr<Reader> create(const String&);
~Reader();
const ELF::Core::ProcessInfo& process_info() const;
template<typename Func>
void for_each_memory_region_info(Func func) const;
@ -66,6 +64,10 @@ public:
const LibraryData* library_containing(FlatPtr address) const;
const Backtrace backtrace() const;
int process_pid() const;
u8 process_termination_signal() const;
String process_executable_path() const;
const HashMap<String, String> metadata() const;
private:
@ -86,6 +88,11 @@ private:
const u8* start { nullptr };
};
// Private as we don't need anyone poking around in this JsonObject
// manually - we know very well what should be included and expose that
// as getters with the appropriate (non-JsonValue) types.
const JsonObject process_info() const;
NonnullRefPtr<MappedFile> m_coredump_file;
ELF::Image m_coredump_image;
ssize_t m_notes_segment_index { -1 };