Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions objdiff-core/src/obj/read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -732,11 +732,11 @@ fn parse_line_info(

/// Parse .line section from DWARF 1.1 format.
fn parse_line_info_dwarf1(obj_file: &object::File, sections: &mut [Section]) -> Result<()> {
if let Some(section) = obj_file.section_by_name(".line") {
let mut text_sections = sections.iter_mut().filter(|s| s.kind == SectionKind::Code);
for section in obj_file.sections().filter(|s| s.name().is_ok_and(|n| n == ".line")) {
let data = section.uncompressed_data()?;
let mut reader: &[u8] = data.as_ref();

let mut text_sections = sections.iter_mut().filter(|s| s.kind == SectionKind::Code);
while !reader.is_empty() {
let mut section_data = reader;
let size = read_u32(obj_file, &mut section_data)? as usize;
Expand Down
22 changes: 22 additions & 0 deletions objdiff-core/tests/arch_mips.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,25 @@ fn ido_mdebug_line_numbers() {
assert_eq!(text_section.line_info.get(&56), Some(&9));
assert_eq!(text_section.line_info.len(), 66);
}

#[test]
#[cfg(feature = "mips")]
fn mwcc_dwarf1_line_numbers_multiple_functions() {
let diff_config = diff::DiffObjConfig::default();
let obj = obj::read::parse(
include_object!("data/mips/mwcc_lines_example.o"),
&diff_config,
diff::DiffSide::Base,
)
.unwrap();

for function_name in ["foo", "bar"] {
let symbol = obj.symbols.iter().find(|s| s.name == function_name).unwrap();
let section_idx = symbol.section.unwrap();
let section = &obj.sections[section_idx];
assert!(
section.line_info.values().any(|line| *line > 0),
"{function_name} should have valid line numbers"
);
}
}
Binary file added objdiff-core/tests/data/mips/mwcc_lines_example.o
Binary file not shown.
Loading