diff options
Diffstat (limited to 'Kernel')
-rw-r--r-- | Kernel/ELF/ELFImage.h | 2 | ||||
-rw-r--r-- | Kernel/ELF/ELFLoader.h | 2 | ||||
-rw-r--r-- | Kernel/KSyms.cpp | 4 |
3 files changed, 5 insertions, 3 deletions
diff --git a/Kernel/ELF/ELFImage.h b/Kernel/ELF/ELFImage.h index 4574f4d0fd..09c18bef0a 100644 --- a/Kernel/ELF/ELFImage.h +++ b/Kernel/ELF/ELFImage.h @@ -86,7 +86,7 @@ public: unsigned offset() const { return m_section_header.sh_offset; } unsigned size() const { return m_section_header.sh_size; } unsigned entry_size() const { return m_section_header.sh_entsize; } - unsigned entry_count() const { return size() / entry_size(); } + unsigned entry_count() const { return !entry_size() ? 0 : size() / entry_size(); } dword address() const { return m_section_header.sh_addr; } const char* raw_data() const { return m_image.raw_data(m_section_header.sh_offset); } bool is_undefined() const { return m_section_index == SHN_UNDEF; } diff --git a/Kernel/ELF/ELFLoader.h b/Kernel/ELF/ELFLoader.h index 957185b76e..972783a4d1 100644 --- a/Kernel/ELF/ELFLoader.h +++ b/Kernel/ELF/ELFLoader.h @@ -18,6 +18,8 @@ public: char* symbol_ptr(const char* name); LinearAddress entry() const { return m_image.entry(); } + bool has_symbols() const { return m_image.symbol_count(); } + String symbolicate(dword address) const; private: diff --git a/Kernel/KSyms.cpp b/Kernel/KSyms.cpp index 1dc7830a3b..38719cd1bb 100644 --- a/Kernel/KSyms.cpp +++ b/Kernel/KSyms.cpp @@ -115,10 +115,10 @@ static void load_ksyms_from_data(const ByteBuffer& buffer) if (!symbol.address) break; if (!symbol.ksym) { - if (current->process().elf_loader()) { + if (current->process().elf_loader() && current->process().elf_loader()->has_symbols()) { dbgprintf("%p %s\n", symbol.address, current->process().elf_loader()->symbolicate(symbol.address).characters()); } else { - dbgprintf("%p (no ELF loader for process)\n", symbol.address); + dbgprintf("%p (no ELF symbols for process)\n", symbol.address); } continue; } |