1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 23:37:36 +00:00

LibDebug: Handle DWARF 4 address ranges

The format of the address range section is different between DWARF
version 4 and version 5. This meant that we parsed programs compiled
with `-gdwarf-4` incorrectly.
This commit is contained in:
Daniel Bertalan 2021-12-05 08:45:05 +01:00 committed by Brian Gianforcaro
parent 7546295abe
commit 815f15f82c
5 changed files with 70 additions and 14 deletions

View file

@ -14,17 +14,18 @@
namespace Debug::Dwarf {
class AddressRanges {
AK_MAKE_NONCOPYABLE(AddressRanges);
AK_MAKE_NONMOVABLE(AddressRanges);
struct Range {
FlatPtr start { 0 };
FlatPtr end { 0 };
};
class AddressRangesV5 {
AK_MAKE_NONCOPYABLE(AddressRangesV5);
AK_MAKE_NONMOVABLE(AddressRangesV5);
public:
AddressRanges(ReadonlyBytes range_lists_data, size_t offset, CompilationUnit const& compilation_unit);
AddressRangesV5(ReadonlyBytes range_lists_data, size_t offset, CompilationUnit const& compilation_unit);
struct Range {
FlatPtr start { 0 };
FlatPtr end { 0 };
};
void for_each_range(Function<void(Range)>);
private:
@ -32,4 +33,18 @@ private:
CompilationUnit const& m_compilation_unit;
};
class AddressRangesV4 {
AK_MAKE_NONCOPYABLE(AddressRangesV4);
AK_MAKE_NONMOVABLE(AddressRangesV4);
public:
AddressRangesV4(ReadonlyBytes ranges_data, size_t offset, CompilationUnit const&);
void for_each_range(Function<void(Range)>);
private:
InputMemoryStream m_ranges_stream;
CompilationUnit const& m_compilation_unit;
};
}