Handle more CompileUnit attributes in DWARF (#38)
* Handle more DWARF CompileUnit attributes Handle comp_dir and add two unknown attributes * Remove comment about unknown attributes
This commit is contained in:
parent
9a6cb70ff8
commit
2784859c4f
|
@ -199,6 +199,9 @@ where
|
|||
if let Some(producer) = unit.producer {
|
||||
writeln!(w, " Producer: {}", producer)?;
|
||||
}
|
||||
if let Some(comp_dir) = unit.comp_dir {
|
||||
writeln!(w, " Compile directory: {}", comp_dir)?;
|
||||
}
|
||||
if let Some(language) = unit.language {
|
||||
writeln!(w, " Language: {}", language)?;
|
||||
}
|
||||
|
|
|
@ -794,6 +794,7 @@ impl Display for Language {
|
|||
pub struct CompileUnit {
|
||||
pub name: String,
|
||||
pub producer: Option<String>,
|
||||
pub comp_dir: Option<String>,
|
||||
pub language: Option<Language>,
|
||||
pub start_address: Option<u32>,
|
||||
pub end_address: Option<u32>,
|
||||
|
@ -2536,6 +2537,7 @@ pub fn process_compile_unit(tag: &Tag) -> Result<CompileUnit> {
|
|||
|
||||
let mut name = None;
|
||||
let mut producer = None;
|
||||
let mut comp_dir = None;
|
||||
let mut language = None;
|
||||
let mut start_address = None;
|
||||
let mut end_address = None;
|
||||
|
@ -2544,6 +2546,7 @@ pub fn process_compile_unit(tag: &Tag) -> Result<CompileUnit> {
|
|||
(AttributeKind::Sibling, _) => {}
|
||||
(AttributeKind::Name, AttributeValue::String(s)) => name = Some(s.clone()),
|
||||
(AttributeKind::Producer, AttributeValue::String(s)) => producer = Some(s.clone()),
|
||||
(AttributeKind::CompDir, AttributeValue::String(s)) => comp_dir = Some(s.clone()),
|
||||
(AttributeKind::Language, &AttributeValue::Data4(value)) => {
|
||||
language = Some(Language::try_from_primitive(value)?)
|
||||
}
|
||||
|
@ -2552,6 +2555,12 @@ pub fn process_compile_unit(tag: &Tag) -> Result<CompileUnit> {
|
|||
(AttributeKind::StmtList, AttributeValue::Data4(_)) => {
|
||||
// TODO .line support
|
||||
}
|
||||
(AttributeKind::Unknown800, AttributeValue::Data4(_)) => {
|
||||
// TODO Unknown800 support
|
||||
}
|
||||
(AttributeKind::Unknown801, AttributeValue::Data4(_)) => {
|
||||
// TODO Unknown801 support
|
||||
}
|
||||
_ => {
|
||||
bail!("Unhandled CompileUnit attribute {:?}", attr);
|
||||
}
|
||||
|
@ -2559,7 +2568,7 @@ pub fn process_compile_unit(tag: &Tag) -> Result<CompileUnit> {
|
|||
}
|
||||
|
||||
let name = name.ok_or_else(|| anyhow!("CompileUnit without Name: {:?}", tag))?;
|
||||
Ok(CompileUnit { name, producer, language, start_address, end_address })
|
||||
Ok(CompileUnit { name, producer, comp_dir, language, start_address, end_address })
|
||||
}
|
||||
|
||||
pub fn process_overlay_branch(tag: &Tag) -> Result<OverlayBranch> {
|
||||
|
|
Loading…
Reference in New Issue