mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 09:51:57 -05:00
Kernel: Use kernelputstr instead of dbgln when printing backtraces
This will allow us to eventually switch dbgln in the kernel to an allocation-free (although length-bounded) formatter.
This commit is contained in:
parent
0142f33ddc
commit
309d71a66b
2 changed files with 18 additions and 4 deletions
|
@ -18,6 +18,7 @@
|
||||||
#include <Kernel/Scheduler.h>
|
#include <Kernel/Scheduler.h>
|
||||||
#include <Kernel/Sections.h>
|
#include <Kernel/Sections.h>
|
||||||
#include <Kernel/Time/TimeManagement.h>
|
#include <Kernel/Time/TimeManagement.h>
|
||||||
|
#include <Kernel/kstdio.h>
|
||||||
|
|
||||||
// Remove this once SMP is stable and can be enabled by default
|
// Remove this once SMP is stable and can be enabled by default
|
||||||
#define SCHEDULE_ON_ALL_PROCESSORS 0
|
#define SCHEDULE_ON_ALL_PROCESSORS 0
|
||||||
|
@ -595,8 +596,14 @@ void dump_thread_list(bool with_stack_traces)
|
||||||
thread.times_scheduled());
|
thread.times_scheduled());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (with_stack_traces)
|
if (with_stack_traces) {
|
||||||
dbgln("{}", thread.backtrace());
|
auto trace_or_error = thread.backtrace();
|
||||||
|
if (!trace_or_error.is_error()) {
|
||||||
|
auto trace = trace_or_error.release_value();
|
||||||
|
dbgln("Backtrace:");
|
||||||
|
kernelputstr(trace->characters(), trace->length());
|
||||||
|
}
|
||||||
|
}
|
||||||
return IterationDecision::Continue;
|
return IterationDecision::Continue;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include <Kernel/Thread.h>
|
#include <Kernel/Thread.h>
|
||||||
#include <Kernel/ThreadTracer.h>
|
#include <Kernel/ThreadTracer.h>
|
||||||
#include <Kernel/TimerQueue.h>
|
#include <Kernel/TimerQueue.h>
|
||||||
|
#include <Kernel/kstdio.h>
|
||||||
#include <LibC/signal_numbers.h>
|
#include <LibC/signal_numbers.h>
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
@ -501,8 +502,14 @@ void Thread::finalize()
|
||||||
m_join_blocker_set.thread_finalizing();
|
m_join_blocker_set.thread_finalizing();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_dump_backtrace_on_finalization)
|
if (m_dump_backtrace_on_finalization) {
|
||||||
dbgln("{}", backtrace());
|
auto trace_or_error = backtrace();
|
||||||
|
if (!trace_or_error.is_error()) {
|
||||||
|
auto trace = trace_or_error.release_value();
|
||||||
|
dbgln("Backtrace:");
|
||||||
|
kernelputstr(trace->characters(), trace->length());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
drop_thread_count(false);
|
drop_thread_count(false);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue