summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-04-04 19:25:40 +0200
committerAndreas Kling <kling@serenityos.org>2021-04-04 20:13:55 +0200
commite238435c4fdb3d556452badb9767790b4652f295 (patch)
treea6ae2524d1def0191586f62f94ed2e5114622d09 /Userland
parent66a27f37dba278df4ebd8fc286af5eb6d2f0f586 (diff)
downloadserenity-e238435c4fdb3d556452badb9767790b4652f295.zip
CrashReporter: Only create coredump metadata hash map once
We were rebuilding the metadata map a bunch of times on startup.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Applications/CrashReporter/main.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/Userland/Applications/CrashReporter/main.cpp b/Userland/Applications/CrashReporter/main.cpp
index 14f0e7bf68..f5e1c899d5 100644
--- a/Userland/Applications/CrashReporter/main.cpp
+++ b/Userland/Applications/CrashReporter/main.cpp
@@ -59,11 +59,12 @@ struct TitleAndText {
static TitleAndText build_backtrace(const CoreDump::Reader& coredump, const ELF::Core::ThreadInfo& thread_info, size_t thread_index)
{
CoreDump::Backtrace backtrace(coredump, thread_info);
+ auto metadata = coredump.metadata();
StringBuilder builder;
auto prepend_metadata = [&](auto& key, StringView fmt) {
- auto maybe_value = coredump.metadata().get(key);
+ auto maybe_value = metadata.get(key);
if (!maybe_value.has_value() || maybe_value.value().is_empty())
return;
builder.appendff(fmt, maybe_value.value());
@@ -73,9 +74,9 @@ static TitleAndText build_backtrace(const CoreDump::Reader& coredump, const ELF:
auto& backtrace_entries = backtrace.entries();
- if (coredump.metadata().contains("assertion"))
+ if (metadata.contains("assertion"))
prepend_metadata("assertion", "ASSERTION FAILED: {}");
- else if (coredump.metadata().contains("pledge_violation"))
+ else if (metadata.contains("pledge_violation"))
prepend_metadata("pledge_violation", "Has not pledged {}");
auto first_entry = true;