1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 03:57:43 +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

@ -187,7 +187,7 @@ static Optional<Dwarf::DIE> parse_variable_type_die(const Dwarf::DIE& variable_d
if (!type_die_offset.has_value())
return {};
VERIFY(type_die_offset.value().type == Dwarf::DIE::AttributeValue::Type::DieReference);
VERIFY(type_die_offset.value().type == Dwarf::AttributeValue::Type::DieReference);
auto type_die = variable_die.get_die_at_offset(type_die_offset.value().data.as_u32);
auto type_name = type_die.get_attribute(Dwarf::Attribute::Name);
@ -212,11 +212,11 @@ static void parse_variable_location(const Dwarf::DIE& variable_die, DebugInfo::V
return;
switch (location_info.value().type) {
case Dwarf::DIE::AttributeValue::Type::UnsignedNumber:
case Dwarf::AttributeValue::Type::UnsignedNumber:
variable_info.location_type = DebugInfo::VariableInfo::LocationType::Address;
variable_info.location_data.address = location_info.value().data.as_u32;
break;
case Dwarf::DIE::AttributeValue::Type::DwarfExpression: {
case Dwarf::AttributeValue::Type::DwarfExpression: {
auto expression_bytes = ReadonlyBytes { location_info.value().data.as_raw_bytes.bytes, location_info.value().data.as_raw_bytes.length };
auto value = Dwarf::Expression::evaluate(expression_bytes, regs);
@ -253,13 +253,13 @@ OwnPtr<DebugInfo::VariableInfo> DebugInfo::create_variable_info(const Dwarf::DIE
auto constant = variable_die.get_attribute(Dwarf::Attribute::ConstValue);
VERIFY(constant.has_value());
switch (constant.value().type) {
case Dwarf::DIE::AttributeValue::Type::UnsignedNumber:
case Dwarf::AttributeValue::Type::UnsignedNumber:
variable_info->constant_data.as_u32 = constant.value().data.as_u32;
break;
case Dwarf::DIE::AttributeValue::Type::SignedNumber:
case Dwarf::AttributeValue::Type::SignedNumber:
variable_info->constant_data.as_i32 = constant.value().data.as_i32;
break;
case Dwarf::DIE::AttributeValue::Type::String:
case Dwarf::AttributeValue::Type::String:
variable_info->constant_data.as_string = constant.value().data.as_string;
break;
default: