diff --git a/examples/dwarfdump.rs b/examples/dwarfdump.rs index b9d0b822b..a16968a9b 100644 --- a/examples/dwarfdump.rs +++ b/examples/dwarfdump.rs @@ -837,7 +837,18 @@ where let out = io::stdout(); writeln!(&mut BufWriter::new(out.lock()), "\n.debug_info")?; - let units = dwarf.units().collect::>().unwrap(); + let units = match dwarf.units().collect::>() { + Ok(units) => units, + Err(err) => { + writeln_error( + &mut BufWriter::new(out.lock()), + dwarf, + Error::GimliError(err), + "Failed to read unit headers", + )?; + return Ok(()); + } + }; let process_unit = |header: CompilationUnitHeader, buf: &mut Vec| -> Result<()> { writeln!( buf, diff --git a/src/common.rs b/src/common.rs index 8d32bd777..4f35cab3e 100644 --- a/src/common.rs +++ b/src/common.rs @@ -190,7 +190,7 @@ pub enum UnitSectionOffset { } /// An identifier for a DWARF section. -#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Ord, PartialOrd, Hash)] pub enum SectionId { /// The `.debug_abbrev` section. DebugAbbrev,