mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-29 06:02:07 +03:00
Kernel: Simplify dump_backtrace() API for clients.
It makes no sense that clients had to worry about whether or not KSyms were loaded.
This commit is contained in:
parent
7a2da54c07
commit
2f4e7edee5
Notes:
sideshowbarker
2024-07-19 14:07:00 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/2f4e7edee58
@ -125,11 +125,11 @@ static void load_ksyms_from_data(const ByteBuffer& buffer)
|
||||
}
|
||||
}
|
||||
|
||||
void dump_backtrace(bool use_ksyms)
|
||||
void dump_backtrace()
|
||||
{
|
||||
dword ebp;
|
||||
asm volatile("movl %%ebp, %%eax":"=a"(ebp));
|
||||
dump_backtrace_impl(ebp, use_ksyms);
|
||||
dump_backtrace_impl(ebp, ksyms_ready);
|
||||
}
|
||||
|
||||
void init_ksyms()
|
||||
|
@ -16,4 +16,4 @@ extern bool ksyms_ready;
|
||||
extern dword ksym_lowest_address;
|
||||
extern dword ksym_highest_address;
|
||||
|
||||
void dump_backtrace(bool use_ksyms);
|
||||
void dump_backtrace();
|
||||
|
@ -53,7 +53,7 @@ private:
|
||||
{
|
||||
if (!are_interrupts_enabled()) {
|
||||
kprintf("Interrupts disabled when trying to take Lock{%s}\n", m_name);
|
||||
dump_backtrace(ksyms_ready);
|
||||
dump_backtrace();
|
||||
hang();
|
||||
}
|
||||
ASSERT(!Scheduler::is_active());
|
||||
|
@ -642,7 +642,7 @@ void Process::sys$exit(int status)
|
||||
kprintf("sys$exit: %s(%u) exit with status %d\n", name().characters(), pid(), status);
|
||||
#endif
|
||||
|
||||
dump_backtrace(ksyms_ready);
|
||||
dump_backtrace();
|
||||
|
||||
m_termination_status = status;
|
||||
m_termination_signal = 0;
|
||||
|
@ -281,7 +281,7 @@ void exception_14_handler(RegisterDumpWithExceptionCode& regs)
|
||||
regs.exception_code & 2 ? "write" : "read",
|
||||
faultAddress);
|
||||
dump(regs);
|
||||
dump_backtrace(ksyms_ready);
|
||||
dump_backtrace();
|
||||
current->process().crash();
|
||||
} else if (response == PageFaultResponse::Continue) {
|
||||
#ifdef PAGE_FAULT_DEBUG
|
||||
@ -491,8 +491,7 @@ void __assertion_failed(const char* msg, const char* file, unsigned line, const
|
||||
{
|
||||
asm volatile("cli");
|
||||
kprintf("ASSERTION FAILED: %s\n%s:%u in %s\n", msg, file, line, func);
|
||||
extern void dump_backtrace(bool);
|
||||
dump_backtrace(true);
|
||||
dump_backtrace();
|
||||
asm volatile("hlt");
|
||||
for (;;);
|
||||
}
|
||||
|
@ -99,14 +99,14 @@ void* kmalloc_impl(size_t size)
|
||||
|
||||
if (g_dump_kmalloc_stacks && ksyms_ready) {
|
||||
dbgprintf("kmalloc(%u)\n", size);
|
||||
dump_backtrace(true);
|
||||
dump_backtrace();
|
||||
}
|
||||
|
||||
// We need space for the allocation_t structure at the head of the block.
|
||||
size_t real_size = size + sizeof(allocation_t);
|
||||
|
||||
if (sum_free < real_size) {
|
||||
dump_backtrace(ksyms_ready);
|
||||
dump_backtrace();
|
||||
kprintf("%s(%u) kmalloc(): PANIC! Out of memory (sucks, dude)\nsum_free=%u, real_size=%u\n", current->process().name().characters(), current->pid(), sum_free, real_size);
|
||||
hang();
|
||||
}
|
||||
@ -160,7 +160,7 @@ void* kmalloc_impl(size_t size)
|
||||
}
|
||||
|
||||
kprintf("%s(%u) kmalloc(): PANIC! Out of memory (no suitable block for size %u)\n", current->process().name().characters(), current->pid(), size);
|
||||
dump_backtrace(ksyms_ready);
|
||||
dump_backtrace();
|
||||
hang();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user