Skip to content

Commit

Permalink
Merge pull request gimli-rs#2 from tromey/no-dwarf-1
Browse files Browse the repository at this point in the history
Don't support DWARF 1
  • Loading branch information
fitzgen authored Jun 15, 2016
2 parents 6024c66 + a3c6016 commit 4c8b895
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1004,7 +1004,8 @@ fn test_parse_unit_length_64_incomplete() {
/// Parse the DWARF version from the compilation unit header.
fn parse_version(input: DebugInfoInput) -> ParseResult<DebugInfoInput, u16> {
match le_u16(input.0) {
IResult::Done(rest, val) if 1 <= val && val <= 4 =>
// DWARF 1 was very different, and is obsolete, so isn't supported by this reader.
IResult::Done(rest, val) if 2 <= val && val <= 4 =>
IResult::Done(DebugInfoInput(rest, input.1, input.2), val),

IResult::Done(_, _) =>
Expand Down Expand Up @@ -1046,6 +1047,16 @@ fn test_compilation_unit_version_unknown_version() {
_ =>
assert!(false),
};

let buf = [0x1, 0x0];
let abbrevs = Abbreviations::new();

match parse_version(DebugInfoInput(&buf, &abbrevs, Format::Unknown)) {
IResult::Error(Err::Position(ErrorKind::Custom(Error::UnknownDwarfVersion), _)) =>
assert!(true),
_ =>
assert!(false),
};
}

#[test]
Expand Down

0 comments on commit 4c8b895

Please sign in to comment.