1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 06:47:35 +00:00

Profiler: Cache parsed DWARF debug information in disassembly view

This changes browsing through disassembled functions in Profiler from a
painfully sluggish experience into quite a swift one. It's especially
true for profiling the kernel, as it has more than 10 megabytes of DWARF
data to churn through.
This commit is contained in:
Daniel Bertalan 2021-10-26 18:34:33 +02:00 committed by Andreas Kling
parent 8e1f882ac9
commit b883652a83
5 changed files with 19 additions and 4 deletions

View file

@ -54,7 +54,7 @@ DisassemblyModel::DisassemblyModel(Profile& profile, ProfileNode& node)
, m_node(node)
{
FlatPtr base_address = 0;
OwnPtr<Debug::DebugInfo> debug_info;
const Debug::DebugInfo* debug_info;
const ELF::Image* elf;
if (auto maybe_kernel_base = Symbolication::kernel_base(); maybe_kernel_base.has_value() && m_node.address() >= *maybe_kernel_base) {
if (!g_kernel_debuginfo_object.has_value())
@ -63,7 +63,9 @@ DisassemblyModel::DisassemblyModel(Profile& profile, ProfileNode& node)
elf = try_load_kernel_binary();
if (elf == nullptr)
return;
debug_info = make<Debug::DebugInfo>(g_kernel_debuginfo_object->elf, String::empty(), base_address);
if (g_kernel_debug_info == nullptr)
g_kernel_debug_info = make<Debug::DebugInfo>(g_kernel_debuginfo_object->elf, String::empty(), base_address);
debug_info = g_kernel_debug_info.ptr();
} else {
auto& process = node.process();
auto library_data = process.library_metadata.library_containing(node.address());
@ -73,7 +75,7 @@ DisassemblyModel::DisassemblyModel(Profile& profile, ProfileNode& node)
}
base_address = library_data->base;
elf = &library_data->object->elf;
debug_info = make<Debug::DebugInfo>(library_data->object->elf, String::empty(), base_address);
debug_info = &library_data->load_debug_info(base_address);
}
VERIFY(elf != nullptr);