cache path and line number

This commit is contained in:
Jeremy 2023-11-07 00:05:32 -05:00
parent 9096531e23
commit 6d62936c7b
No known key found for this signature in database
GPG Key ID: BE03111EB7ED6E2E

View File

@ -571,16 +571,22 @@ namespace libdwarf {
// If the vector has been empty this can happen
if(table_it != line_entries.end()) {
Dwarf_Line line = table_it->line;
if(!table_it->line_number) {
Dwarf_Unsigned line_number = 0;
VERIFY(wrap(dwarf_lineno, line, &line_number) == DW_DLV_OK);
frame.line = static_cast<std::uint_least32_t>(line_number);
table_it->line_number = static_cast<std::uint_least32_t>(line_number);
}
frame.line = table_it->line_number.unwrap();
if(!table_it->path) {
char* filename = nullptr;
VERIFY(wrap(dwarf_linesrc, line, &filename) == DW_DLV_OK);
auto wrapper = raii_wrap(
filename,
[this] (char* str) { if(str) dwarf_dealloc(dbg, str, DW_DLA_STRING); }
);
frame.filename = filename;
table_it->path = filename;
}
frame.filename = table_it->path.unwrap();
}
} else {
Dwarf_Line_Context line_context = table_info.line_context;