Просмотр исходного кода

Kernel: Simplify dump_backtrace() API for clients.

It makes no sense that clients had to worry about whether or not KSyms
were loaded.
Andreas Kling 6 лет назад
Родитель
Сommit
2f4e7edee5
6 измененных файлов с 10 добавлено и 11 удалено
  1. 2 2
      Kernel/KSyms.cpp
  2. 1 1
      Kernel/KSyms.h
  3. 1 1
      Kernel/Lock.h
  4. 1 1
      Kernel/Process.cpp
  5. 2 3
      Kernel/i386.cpp
  6. 3 3
      Kernel/kmalloc.cpp

+ 2 - 2
Kernel/KSyms.cpp

@@ -125,11 +125,11 @@ static void load_ksyms_from_data(const ByteBuffer& buffer)
     }
     }
 }
 }
 
 
-void dump_backtrace(bool use_ksyms)
+void dump_backtrace()
 {
 {
     dword ebp;
     dword ebp;
     asm volatile("movl %%ebp, %%eax":"=a"(ebp));
     asm volatile("movl %%ebp, %%eax":"=a"(ebp));
-    dump_backtrace_impl(ebp, use_ksyms);
+    dump_backtrace_impl(ebp, ksyms_ready);
 }
 }
 
 
 void init_ksyms()
 void init_ksyms()

+ 1 - 1
Kernel/KSyms.h

@@ -16,4 +16,4 @@ extern bool ksyms_ready;
 extern dword ksym_lowest_address;
 extern dword ksym_lowest_address;
 extern dword ksym_highest_address;
 extern dword ksym_highest_address;
 
 
-void dump_backtrace(bool use_ksyms);
+void dump_backtrace();

+ 1 - 1
Kernel/Lock.h

@@ -53,7 +53,7 @@ private:
 {
 {
     if (!are_interrupts_enabled()) {
     if (!are_interrupts_enabled()) {
         kprintf("Interrupts disabled when trying to take Lock{%s}\n", m_name);
         kprintf("Interrupts disabled when trying to take Lock{%s}\n", m_name);
-        dump_backtrace(ksyms_ready);
+        dump_backtrace();
         hang();
         hang();
     }
     }
     ASSERT(!Scheduler::is_active());
     ASSERT(!Scheduler::is_active());

+ 1 - 1
Kernel/Process.cpp

@@ -642,7 +642,7 @@ void Process::sys$exit(int status)
     kprintf("sys$exit: %s(%u) exit with status %d\n", name().characters(), pid(), status);
     kprintf("sys$exit: %s(%u) exit with status %d\n", name().characters(), pid(), status);
 #endif
 #endif
 
 
-    dump_backtrace(ksyms_ready);
+    dump_backtrace();
 
 
     m_termination_status = status;
     m_termination_status = status;
     m_termination_signal = 0;
     m_termination_signal = 0;

+ 2 - 3
Kernel/i386.cpp

@@ -281,7 +281,7 @@ void exception_14_handler(RegisterDumpWithExceptionCode& regs)
             regs.exception_code & 2 ? "write" : "read",
             regs.exception_code & 2 ? "write" : "read",
             faultAddress);
             faultAddress);
         dump(regs);
         dump(regs);
-        dump_backtrace(ksyms_ready);
+        dump_backtrace();
         current->process().crash();
         current->process().crash();
     } else if (response == PageFaultResponse::Continue) {
     } else if (response == PageFaultResponse::Continue) {
 #ifdef PAGE_FAULT_DEBUG
 #ifdef PAGE_FAULT_DEBUG
@@ -491,8 +491,7 @@ void __assertion_failed(const char* msg, const char* file, unsigned line, const
 {
 {
     asm volatile("cli");
     asm volatile("cli");
     kprintf("ASSERTION FAILED: %s\n%s:%u in %s\n", msg, file, line, func);
     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");
     asm volatile("hlt");
     for (;;);
     for (;;);
 }
 }

+ 3 - 3
Kernel/kmalloc.cpp

@@ -99,14 +99,14 @@ void* kmalloc_impl(size_t size)
 
 
     if (g_dump_kmalloc_stacks && ksyms_ready) {
     if (g_dump_kmalloc_stacks && ksyms_ready) {
         dbgprintf("kmalloc(%u)\n", size);
         dbgprintf("kmalloc(%u)\n", size);
-        dump_backtrace(true);
+        dump_backtrace();
     }
     }
 
 
     // We need space for the allocation_t structure at the head of the block.
     // We need space for the allocation_t structure at the head of the block.
     size_t real_size = size + sizeof(allocation_t);
     size_t real_size = size + sizeof(allocation_t);
 
 
     if (sum_free < real_size) {
     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);
         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();
         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);
     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();
     hang();
 }
 }