aboutsummaryrefslogtreecommitdiff
path: root/std/debug/index.zig
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2018-03-02 16:26:22 -0500
committerAndrew Kelley <superjoe30@gmail.com>2018-03-02 16:26:22 -0500
commit56645c1701b321e9da807dcbf7b8d61e0fc53117 (patch)
treeeb75174ccdb31ce09d488756cf746ec3cd18380e /std/debug/index.zig
parenta217c764db0a1dae539c3b243ebc329350485eb5 (diff)
downloadzig-56645c1701b321e9da807dcbf7b8d61e0fc53117.tar.gz
zig-56645c1701b321e9da807dcbf7b8d61e0fc53117.zip
std.debug.dwarf supports line number version 4
fixes stack traces for llvm6 generated zig programs
Diffstat (limited to 'std/debug/index.zig')
-rw-r--r--std/debug/index.zig11
1 files changed, 9 insertions, 2 deletions
diff --git a/std/debug/index.zig b/std/debug/index.zig
index 8d90a6aa07..b26800677f 100644
--- a/std/debug/index.zig
+++ b/std/debug/index.zig
@@ -791,14 +791,21 @@ fn getLineNumberInfo(st: &ElfStackTrace, compile_unit: &const CompileUnit, targe
}
const version = try in_stream.readInt(st.elf.endian, u16);
- if (version != 2) return error.InvalidDebugInfo;
+ // TODO support 3 and 5
+ if (version != 2 and version != 4) return error.InvalidDebugInfo;
- const prologue_length = try in_stream.readInt(st.elf.endian, u32);
+ const prologue_length = if (is_64) try in_stream.readInt(st.elf.endian, u64)
+ else try in_stream.readInt(st.elf.endian, u32);
const prog_start_offset = (try in_file.getPos()) + prologue_length;
const minimum_instruction_length = try in_stream.readByte();
if (minimum_instruction_length == 0) return error.InvalidDebugInfo;
+ if (version >= 4) {
+ // maximum_operations_per_instruction
+ _ = try in_stream.readByte();
+ }
+
const default_is_stmt = (try in_stream.readByte()) != 0;
const line_base = try in_stream.readByteSigned();