1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 23:28:11 +00:00

LibDebug: Implement symbolication for x86_64

This commit is contained in:
Gunnar Beutner 2021-07-13 18:16:36 +02:00 committed by Andreas Kling
parent 567fa4b2f0
commit 2c41e89d08
9 changed files with 33 additions and 43 deletions

View file

@ -25,6 +25,7 @@ struct AttributeValue {
} type;
union {
FlatPtr as_addr;
u32 as_u32;
i32 as_i32;
u64 as_u64;

View file

@ -47,7 +47,7 @@ void DwarfInfo::populate_compilation_units()
debug_info_stream >> compilation_unit_header;
VERIFY(compilation_unit_header.common.version <= 5);
VERIFY(compilation_unit_header.address_size() == sizeof(u32));
VERIFY(compilation_unit_header.address_size() == sizeof(FlatPtr));
u32 length_after_header = compilation_unit_header.length() - (compilation_unit_header.header_size() - offsetof(CompilationUnitHeader, common.version));
@ -102,11 +102,11 @@ AttributeValue DwarfInfo::get_attribute_value(AttributeDataForm form, ssize_t im
break;
}
case AttributeDataForm::Addr: {
u32 address;
FlatPtr address;
debug_info_stream >> address;
VERIFY(!debug_info_stream.has_any_error());
value.type = AttributeValue::Type::UnsignedNumber;
value.data.as_u32 = address;
value.data.as_addr = address;
break;
}
case AttributeDataForm::SData: {
@ -250,7 +250,6 @@ void DwarfInfo::build_cached_dies() const
if (!start.has_value() || !end.has_value())
return {};
VERIFY(sizeof(FlatPtr) == sizeof(u32));
VERIFY(start->type == Dwarf::AttributeValue::Type::UnsignedNumber);
// DW_AT_high_pc attribute can have different meanings depending on the attribute form.
@ -258,7 +257,7 @@ void DwarfInfo::build_cached_dies() const
uint32_t range_end = 0;
if (end->form == Dwarf::AttributeDataForm::Addr)
range_end = end->data.as_u32;
range_end = end->data.as_addr;
else
range_end = start->data.as_u32 + end->data.as_u32;

View file

@ -22,6 +22,7 @@ enum class Type {
struct Value {
Type type;
union {
FlatPtr as_addr;
u32 as_u32;
} data { 0 };
};

View file

@ -174,7 +174,7 @@ void LineProgram::handle_extended_opcode()
break;
}
default:
dbgln_if(DWARF_DEBUG, "offset: {:p}", m_stream.offset());
dbgln("Encountered unknown sub opcode {} at stream offset {:p}", sub_opcode, m_stream.offset());
VERIFY_NOT_REACHED();
}
}

View file

@ -109,7 +109,7 @@ public:
explicit LineProgram(DwarfInfo& dwarf_info, InputMemoryStream& stream);
struct LineInfo {
u32 address { 0 };
FlatPtr address { 0 };
FlyString file;
size_t line { 0 };
};
@ -176,7 +176,7 @@ private:
Vector<FileEntry> m_source_files;
// The registers of the "line program" virtual machine
u32 m_address { 0 };
FlatPtr m_address { 0 };
size_t m_line { 0 };
size_t m_file_index { 0 };
bool m_is_statement { false };