UserspaceEmulator: Don't print backtrace offsets if we have file/line

File/line is way more interesting than offsets, so let's only do the
offsets if we don't have file/line information.
This commit is contained in:
Andreas Kling 2020-08-01 09:49:03 +02:00
parent 80eef2c014
commit dff8305138
Notes: sideshowbarker 2024-07-19 04:24:58 +09:00

View file

@ -225,9 +225,11 @@ void Emulator::dump_backtrace(const Vector<FlatPtr>& backtrace)
u32 offset = 0; u32 offset = 0;
String symbol = m_elf->symbolicate(address, &offset); String symbol = m_elf->symbolicate(address, &offset);
auto source_position = m_debug_info->get_source_position(address); auto source_position = m_debug_info->get_source_position(address);
report("==%d== %#08x %s +%#x", getpid(), address, symbol.characters(), offset); report("==%d== %#08x %s", getpid(), address, symbol.characters());
if (source_position.has_value()) if (source_position.has_value())
report(" (\033[34;1m%s\033[0m:%zu)", LexicalPath(source_position.value().file_path).basename().characters(), source_position.value().line_number); report(" (\033[34;1m%s\033[0m:%zu)", LexicalPath(source_position.value().file_path).basename().characters(), source_position.value().line_number);
else
report(" +%#x", offset);
report("\n"); report("\n");
} }
} }