mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 03:27:45 +00:00
LibDebug: Implement support for AttributeDataForm::{UData,LineStrP}
This commit is contained in:
parent
d2f0984fef
commit
d0a7547537
2 changed files with 21 additions and 0 deletions
|
@ -16,6 +16,7 @@ DwarfInfo::DwarfInfo(const ELF::Image& elf)
|
||||||
m_debug_info_data = section_data(".debug_info");
|
m_debug_info_data = section_data(".debug_info");
|
||||||
m_abbreviation_data = section_data(".debug_abbrev");
|
m_abbreviation_data = section_data(".debug_abbrev");
|
||||||
m_debug_strings_data = section_data(".debug_str");
|
m_debug_strings_data = section_data(".debug_str");
|
||||||
|
m_debug_line_strings_data = section_data(".debug_line_str");
|
||||||
|
|
||||||
populate_compilation_units();
|
populate_compilation_units();
|
||||||
}
|
}
|
||||||
|
@ -104,6 +105,14 @@ AttributeValue DwarfInfo::get_attribute_value(AttributeDataForm form,
|
||||||
value.data.as_i32 = data;
|
value.data.as_i32 = data;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case AttributeDataForm::UData: {
|
||||||
|
size_t data;
|
||||||
|
debug_info_stream.read_LEB128_unsigned(data);
|
||||||
|
VERIFY(!debug_info_stream.has_any_error());
|
||||||
|
value.type = AttributeValue::Type::UnsignedNumber;
|
||||||
|
value.data.as_u32 = data;
|
||||||
|
break;
|
||||||
|
}
|
||||||
case AttributeDataForm::SecOffset: {
|
case AttributeDataForm::SecOffset: {
|
||||||
u32 data;
|
u32 data;
|
||||||
debug_info_stream >> data;
|
debug_info_stream >> data;
|
||||||
|
@ -191,6 +200,16 @@ AttributeValue DwarfInfo::get_attribute_value(AttributeDataForm form,
|
||||||
assign_raw_bytes_value(length);
|
assign_raw_bytes_value(length);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case AttributeDataForm::LineStrP: {
|
||||||
|
u32 offset;
|
||||||
|
debug_info_stream >> offset;
|
||||||
|
VERIFY(!debug_info_stream.has_any_error());
|
||||||
|
value.type = AttributeValue::Type::String;
|
||||||
|
|
||||||
|
auto strings_data = debug_line_strings_data();
|
||||||
|
value.data.as_string = reinterpret_cast<const char*>(strings_data.data() + offset);
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
dbgln("Unimplemented AttributeDataForm: {}", (u32)form);
|
dbgln("Unimplemented AttributeDataForm: {}", (u32)form);
|
||||||
VERIFY_NOT_REACHED();
|
VERIFY_NOT_REACHED();
|
||||||
|
|
|
@ -49,6 +49,7 @@ public:
|
||||||
ReadonlyBytes debug_info_data() const { return m_debug_info_data; }
|
ReadonlyBytes debug_info_data() const { return m_debug_info_data; }
|
||||||
ReadonlyBytes abbreviation_data() const { return m_abbreviation_data; }
|
ReadonlyBytes abbreviation_data() const { return m_abbreviation_data; }
|
||||||
ReadonlyBytes debug_strings_data() const { return m_debug_strings_data; }
|
ReadonlyBytes debug_strings_data() const { return m_debug_strings_data; }
|
||||||
|
ReadonlyBytes debug_line_strings_data() const { return m_debug_line_strings_data; }
|
||||||
|
|
||||||
template<typename Callback>
|
template<typename Callback>
|
||||||
void for_each_compilation_unit(Callback) const;
|
void for_each_compilation_unit(Callback) const;
|
||||||
|
@ -65,6 +66,7 @@ private:
|
||||||
ReadonlyBytes m_debug_info_data;
|
ReadonlyBytes m_debug_info_data;
|
||||||
ReadonlyBytes m_abbreviation_data;
|
ReadonlyBytes m_abbreviation_data;
|
||||||
ReadonlyBytes m_debug_strings_data;
|
ReadonlyBytes m_debug_strings_data;
|
||||||
|
ReadonlyBytes m_debug_line_strings_data;
|
||||||
|
|
||||||
Vector<Dwarf::CompilationUnit> m_compilation_units;
|
Vector<Dwarf::CompilationUnit> m_compilation_units;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue