1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:57:44 +00:00

LibDebug: Move get_attribute_value to the DwarfInfo class

This commit is contained in:
Gunnar Beutner 2021-04-28 20:12:21 +02:00 committed by Andreas Kling
parent d9ee2c6a89
commit ea6fdad88b
5 changed files with 189 additions and 187 deletions

View file

@ -16,6 +16,32 @@
namespace Debug::Dwarf {
struct AttributeValue {
enum class Type : u8 {
UnsignedNumber,
SignedNumber,
LongUnsignedNumber,
String,
DieReference, // Reference to another DIE in the same compilation unit
Boolean,
DwarfExpression,
SecOffset,
RawBytes,
} type;
union {
u32 as_u32;
i32 as_i32;
u64 as_u64;
const char* as_string; // points to bytes in the memory mapped elf image
bool as_bool;
struct {
u32 length;
const u8* bytes; // points to bytes in the memory mapped elf image
} as_raw_bytes;
} data {};
};
class DwarfInfo {
public:
explicit DwarfInfo(const ELF::Image&);
@ -27,6 +53,9 @@ public:
template<typename Callback>
void for_each_compilation_unit(Callback) const;
AttributeValue get_attribute_value(AttributeDataForm form,
InputMemoryStream& debug_info_stream, const CompilationUnit* unit = nullptr) const;
private:
void populate_compilation_units();