mirror of
https://github.com/encounter/objdiff.git
synced 2025-12-10 05:57:42 +00:00
Display correct line numbers for multiple .text sections (#63)
* Support multiple DWARF sequences * Rework DWARF line info parsing - Properly handles multiple sections in DWARF 1 - line_info moved into ObjSection - DWARF 2 parser no longer errors with no .text section - Both parsers properly skip empty sections * Simplify line_info (no Option) --------- Co-authored-by: Luke Street <luke.street@encounterpc.com>
This commit is contained in:
@@ -112,10 +112,7 @@ impl ObjArch for ObjArchMips {
|
||||
}
|
||||
}
|
||||
}
|
||||
let line = obj
|
||||
.line_info
|
||||
.as_ref()
|
||||
.and_then(|map| map.range(..=cur_addr as u64).last().map(|(_, &b)| b));
|
||||
let line = section.line_info.range(..=cur_addr as u64).last().map(|(_, &b)| b);
|
||||
insts.push(ObjIns {
|
||||
address: cur_addr as u64,
|
||||
size: 4,
|
||||
|
||||
@@ -133,10 +133,7 @@ impl ObjArch for ObjArchPpc {
|
||||
}
|
||||
|
||||
ops.push(ins.op as u16);
|
||||
let line = obj
|
||||
.line_info
|
||||
.as_ref()
|
||||
.and_then(|map| map.range(..=cur_addr as u64).last().map(|(_, &b)| b));
|
||||
let line = section.line_info.range(..=cur_addr as u64).last().map(|(_, &b)| b);
|
||||
insts.push(ObjIns {
|
||||
address: cur_addr as u64,
|
||||
size: 4,
|
||||
|
||||
@@ -74,6 +74,7 @@ impl ObjArch for ObjArchX86 {
|
||||
.relocations
|
||||
.iter()
|
||||
.find(|r| r.address >= address && r.address < address + instruction.len() as u64);
|
||||
let line = section.line_info.range(..=address).last().map(|(_, &b)| b);
|
||||
output.ins = ObjIns {
|
||||
address,
|
||||
size: instruction.len() as u8,
|
||||
@@ -82,7 +83,7 @@ impl ObjArch for ObjArchX86 {
|
||||
args: vec![],
|
||||
reloc: reloc.cloned(),
|
||||
branch_dest: None,
|
||||
line: obj.line_info.as_ref().and_then(|m| m.get(&address).cloned()),
|
||||
line,
|
||||
formatted: String::new(),
|
||||
orig: None,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user