mirror of
https://github.com/encounter/objdiff.git
synced 2025-07-03 11:45:57 +00:00
Get line info from section; output formatted ins string
This commit is contained in:
parent
8862d95b26
commit
5d42c24dc1
@ -54,9 +54,6 @@ impl ObjArch for ObjArchArm {
|
|||||||
let mut code = §ion.data
|
let mut code = §ion.data
|
||||||
[symbol.section_address as usize..(symbol.section_address + symbol.size) as usize];
|
[symbol.section_address as usize..(symbol.section_address + symbol.size) as usize];
|
||||||
|
|
||||||
let line_info =
|
|
||||||
obj.line_info.as_ref().and_then(|map| map.get(&SectionIndex(section.orig_index)));
|
|
||||||
|
|
||||||
let start_addr = symbol.address as u32;
|
let start_addr = symbol.address as u32;
|
||||||
let end_addr = start_addr + symbol.size as u32;
|
let end_addr = start_addr + symbol.size as u32;
|
||||||
|
|
||||||
@ -96,8 +93,7 @@ impl ObjArch for ObjArchArm {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
let line =
|
let line = section.line_info.range(..=cur_addr as u64).last().map(|(_, &b)| b);
|
||||||
line_info.and_then(|map| map.range(..=cur_addr as u64).last().map(|(_, &b)| b));
|
|
||||||
|
|
||||||
let ins = match mapping {
|
let ins = match mapping {
|
||||||
MappingSymbol::Arm => {
|
MappingSymbol::Arm => {
|
||||||
@ -136,7 +132,8 @@ impl ObjArch for ObjArchArm {
|
|||||||
reloc: reloc.cloned(),
|
reloc: reloc.cloned(),
|
||||||
branch_dest,
|
branch_dest,
|
||||||
line,
|
line,
|
||||||
orig: Some(parsed_ins.to_string()),
|
formatted: parsed_ins.to_string(),
|
||||||
|
orig: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MappingSymbol::Thumb => {
|
MappingSymbol::Thumb => {
|
||||||
@ -194,7 +191,8 @@ impl ObjArch for ObjArchArm {
|
|||||||
reloc: reloc.cloned(),
|
reloc: reloc.cloned(),
|
||||||
branch_dest,
|
branch_dest,
|
||||||
line,
|
line,
|
||||||
orig: Some(parsed_ins.to_string()),
|
formatted: parsed_ins.to_string(),
|
||||||
|
orig: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MappingSymbol::Data => {
|
MappingSymbol::Data => {
|
||||||
@ -222,6 +220,7 @@ impl ObjArch for ObjArchArm {
|
|||||||
reloc: reloc.cloned(),
|
reloc: reloc.cloned(),
|
||||||
branch_dest: None,
|
branch_dest: None,
|
||||||
line,
|
line,
|
||||||
|
formatted: format!(".word {data:#x}"),
|
||||||
orig: None,
|
orig: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user