1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 06:58:11 +00:00

Kernel: Dump backtrace to debugger for DefaultSignalAction::DumpCore.

This makes assertion failures generate backtraces again. Sorry to everyone
who suffered from the lack of backtraces lately. :^)

We share code with the /proc/PID/stack implementation. You can now get the
current backtrace for a Thread via Thread::backtrace(), and all the traces
for a Process via Process::backtrace().
This commit is contained in:
Andreas Kling 2019-07-25 21:02:19 +02:00
parent a599317624
commit 4316fa8123
5 changed files with 62 additions and 32 deletions

View file

@ -1279,6 +1279,7 @@ int Process::sys$kill(pid_t pid, int signal)
ASSERT(pid != -1);
}
if (pid == m_pid) {
// FIXME: If we ignore this signal anyway, we don't need to block here, right?
current->send_signal(signal, this);
(void)current->block<Thread::SemiPermanentBlocker>(Thread::SemiPermanentBlocker::Reason::Signal);
return 0;
@ -2752,3 +2753,14 @@ int Process::sys$dbgputstr(const u8* characters, int length)
IO::out8(0xe9, characters[i]);
return 0;
}
String Process::backtrace(ProcessInspectionHandle& handle) const
{
StringBuilder builder;
for_each_thread([&](Thread& thread) {
builder.appendf("Thread %d:\n", thread.tid());
builder.append(thread.backtrace(handle));
return IterationDecision::Continue;
});
return builder.to_string();
}