summaryrefslogtreecommitdiff
path: root/rust/examples/dwarf/dwarf_import/src/die_handlers.rs
diff options
context:
space:
mode:
authorKyleMiles <krm504@nyu.edu>2023-08-23 12:53:23 -0400
committerKyleMiles <krm504@nyu.edu>2023-08-25 11:18:38 -0400
commitc0c145ff7286d99edbd4b367bca4e228cae1a3ac (patch)
tree5268b4c86520eb24bc4e0bae732df2173fc7f7b7 /rust/examples/dwarf/dwarf_import/src/die_handlers.rs
parent7849cda3f9be3ba7da2abb0e7f4d9f201b43fa50 (diff)
DWARF Import : More optimizations
Diffstat (limited to 'rust/examples/dwarf/dwarf_import/src/die_handlers.rs')
-rw-r--r--rust/examples/dwarf/dwarf_import/src/die_handlers.rs14
1 files changed, 9 insertions, 5 deletions
diff --git a/rust/examples/dwarf/dwarf_import/src/die_handlers.rs b/rust/examples/dwarf/dwarf_import/src/die_handlers.rs
index 39e25669..531dfa3e 100644
--- a/rust/examples/dwarf/dwarf_import/src/die_handlers.rs
+++ b/rust/examples/dwarf/dwarf_import/src/die_handlers.rs
@@ -29,6 +29,7 @@ pub fn handle_base_type<R: Reader<Offset = usize>>(
dwarf: &Dwarf<R>,
unit: &Unit<R>,
entry: &DebuggingInformationEntry<R>,
+ debug_info_builder: &mut DebugInfoBuilder,
) -> Option<Ref<Type>> {
// All base types have:
// DW_AT_name
@@ -40,7 +41,9 @@ pub fn handle_base_type<R: Reader<Offset = usize>>(
// * = Optional
// TODO : By spec base types need to have a name, what if it's spec non-conforming?
- let name = get_name(dwarf, unit, entry).expect("DW_TAG_base does not have name attribute");
+ let name = debug_info_builder
+ .get_name(dwarf, unit, entry)
+ .expect("DW_TAG_base does not have name attribute");
let size = get_size_as_usize(entry).expect("DW_TAG_base does not have size attribute");
match entry.attr_value(constants::DW_AT_encoding) {
Ok(Some(Encoding(encoding))) => {
@@ -76,6 +79,7 @@ pub fn handle_enum<R: Reader<Offset = usize>>(
dwarf: &Dwarf<R>,
unit: &Unit<R>,
entry: &DebuggingInformationEntry<R>,
+ debug_info_builder: &mut DebugInfoBuilder,
) -> Option<Ref<Type>> {
// All base types have:
// DW_AT_byte_size
@@ -110,9 +114,9 @@ pub fn handle_enum<R: Reader<Offset = usize>>(
let mut children = tree.root().unwrap().children();
while let Ok(Some(child)) = children.next() {
if child.entry().tag() == constants::DW_TAG_enumerator {
- let name =
- get_name(dwarf, unit, child.entry()) // TODO : Might need to recover the full name here
- .expect("DW_TAG_enumeration_type does not have name attribute");
+ let name = debug_info_builder
+ .get_name(dwarf, unit, child.entry())
+ .expect("DW_TAG_enumeration_type does not have name attribute");
let value = get_attr_as_u64(
&child
.entry()
@@ -312,7 +316,7 @@ pub fn handle_function<R: Reader<Offset = usize>>(
if let (Some(child_uid), Some(name)) = {
(
get_type(dwarf, unit, child.entry(), debug_info_builder),
- get_name(dwarf, unit, child.entry()),
+ debug_info_builder.get_name(dwarf, unit, child.entry()),
)
} {
let child_type = debug_info_builder.get_type(child_uid).unwrap().1;