Kernel: Store coredump metadata properties as KStrings

This patch also replaces the HashMap previously used to store coredump
properties with a plain AK::Array.
This commit is contained in:
Andreas Kling 2021-08-05 23:43:10 +02:00
commit 33adc3a42d
Notes: sideshowbarker 2024-07-18 07:25:41 +09:00
6 changed files with 55 additions and 24 deletions

View file

@ -382,14 +382,14 @@ void page_fault_handler(TrapFrame* trap)
if (current_thread) {
auto& current_process = current_thread->process();
if (current_process.is_user_process()) {
current_process.set_coredump_metadata("fault_address", String::formatted("{:p}", fault_address));
current_process.set_coredump_metadata("fault_type", fault.type() == PageFault::Type::PageNotPresent ? "NotPresent" : "ProtectionViolation");
(void)current_process.try_set_coredump_property("fault_address", String::formatted("{:p}", fault_address));
(void)current_process.try_set_coredump_property("fault_type", fault.type() == PageFault::Type::PageNotPresent ? "NotPresent" : "ProtectionViolation");
String fault_access;
if (fault.is_instruction_fetch())
fault_access = "Execute";
else
fault_access = fault.access() == PageFault::Access::Read ? "Read" : "Write";
current_process.set_coredump_metadata("fault_access", fault_access);
(void)current_process.try_set_coredump_property("fault_access", fault_access);
}
}