diff options
author | Andreas Kling <kling@serenityos.org> | 2021-09-21 18:15:43 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-09-21 20:52:29 +0200 |
commit | 4f224b15eda19b654c6245ab3736c1edc71bb6c7 (patch) | |
tree | cb08cb9f62d05749135d191b890701cc964551bb /Userland/Applications | |
parent | 38b02001514226a689e5b53d8f1a78c15e7a784e (diff) | |
download | serenity-4f224b15eda19b654c6245ab3736c1edc71bb6c7.zip |
CrashDaemon+CrashReporter: Streamline crash reporting a little bit
Before this patch, this is what would happen after something crashed:
1. CrashDaemon finds a new coredump in /tmp
2. CrashDaemon compresses the new coredump (gzip)
3. CrashDaemon parses the uncompressed coredump and prints a backtrace
4. CrashDaemon launches CrashReporter
5. CrashReporter parses the uncompressed coredump (again)
6. CrashReporter unlinks the uncompressed coredump
7. CrashReporter displays a GUI
This was taking quite a long time when dealing with large programs
crashing (like Browser's WebContent processes.)
The new flow:
1. CrashDaemon finds a new coredump in /tmp
2. CrashDaemon mmap()'s the (uncompressed) coredump
3. CrashDaemon launches CrashReporter
4. CrashDaemon goes to sleep for 3 seconds (hack alert!)
5. CrashReporter parses the (uncompressed) coredump
6. CrashReporter unlinks the (uncompressed) coredump
7. CrashReporter displays a GUI
8. CrashDaemon wakes up (after step 4)
9. CrashDaemon compresses the coredump (gzip)
TL;DR: we no longer parse the coredumps twice, and we also prioritize
launching the CrashReporter GUI immediately when a new coredump shows
up, instead of compressing and parsing it in CrashDaemon first.
The net effect of this is that you get a backtrace on screen much
sooner. That's pretty nice. :^)
Diffstat (limited to 'Userland/Applications')
-rw-r--r-- | Userland/Applications/CrashReporter/main.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Userland/Applications/CrashReporter/main.cpp b/Userland/Applications/CrashReporter/main.cpp index cde7062ad3..01c4c04903 100644 --- a/Userland/Applications/CrashReporter/main.cpp +++ b/Userland/Applications/CrashReporter/main.cpp @@ -38,9 +38,12 @@ struct TitleAndText { static TitleAndText build_backtrace(Coredump::Reader const& coredump, ELF::Core::ThreadInfo const& thread_info, size_t thread_index) { + auto timer = Core::ElapsedTimer::start_new(); Coredump::Backtrace backtrace(coredump, thread_info); auto metadata = coredump.metadata(); + dbgln("Generating backtrace took {} ms", timer.elapsed()); + StringBuilder builder; auto prepend_metadata = [&](auto& key, StringView fmt) { @@ -73,6 +76,11 @@ static TitleAndText build_backtrace(Coredump::Reader const& coredump, ELF::Core: builder.append(entry.to_string()); } + dbgln("--- Backtrace for thread #{} (TID {}) ---", thread_index, thread_info.tid); + for (auto& entry : backtrace.entries()) { + dbgln("{}", entry.to_string(true)); + } + return { String::formatted("Thread #{} (TID {})", thread_index, thread_info.tid), builder.build() |