mirror of https://github.com/encounter/objdiff.git
Fix read error on objects with no .text section (#67)
* Fix read error on objects with no .text section * Fix read error on DWARF 1.1 objects * Revert DWARF 1 changes --------- Co-authored-by: Luke Street <luke@street.dev>
This commit is contained in:
parent
fc54e93681
commit
a5a6a3928e
|
@ -328,15 +328,10 @@ fn line_info(obj_file: &File<'_>, sections: &mut [ObjSection]) -> Result<()> {
|
|||
if let Some(program) = unit.line_program.clone() {
|
||||
let mut text_sections =
|
||||
obj_file.sections().filter(|s| s.kind() == SectionKind::Text);
|
||||
let section_index = text_sections
|
||||
.next()
|
||||
.ok_or_else(|| anyhow!("Next text section not found for line info"))?
|
||||
.index()
|
||||
.0;
|
||||
let mut lines = sections
|
||||
.iter_mut()
|
||||
.find(|s| s.orig_index == section_index)
|
||||
.map(|s| &mut s.line_info);
|
||||
let section_index = text_sections.next().map(|s| s.index().0);
|
||||
let mut lines = section_index.map(|index| {
|
||||
&mut sections.iter_mut().find(|s| s.orig_index == index).unwrap().line_info
|
||||
});
|
||||
|
||||
let mut rows = program.rows();
|
||||
while let Some((_header, row)) = rows.next_row()? {
|
||||
|
|
Loading…
Reference in New Issue