debug: Correct version check in debug_line parser

Version 3 is similar to version 2 plus more opcodes.
This commit is contained in:
LemonBoy 2020-03-22 22:47:28 +01:00 committed by Andrew Kelley
parent 6a89751025
commit 9d19d9008e

View File

@ -717,8 +717,7 @@ pub const DwarfInfo = struct {
const next_offset = unit_length + (if (is_64) @as(usize, 12) else @as(usize, 4));
const version = try in.readInt(u16, di.endian);
// TODO support 3 and 5
if (version != 2 and version != 4) return error.InvalidDebugInfo;
if (version < 2 or version > 4) return error.InvalidDebugInfo;
const prologue_length = if (is_64) try in.readInt(u64, di.endian) else try in.readInt(u32, di.endian);
const prog_start_offset = (try seekable.getPos()) + prologue_length;