aboutsummaryrefslogtreecommitdiff
path: root/lib/std/debug.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2020-03-10 18:54:24 -0400
committerAndrew Kelley <andrew@ziglang.org>2020-03-10 18:54:24 -0400
commitcd26d3b0bb2b32f1daf1d3d46bb53731dd54afec (patch)
treefa12591e49d082485f7e31a9df17daf37507c075 /lib/std/debug.zig
parent18f1fef1426cb0405c733890b2e1d8d48627e4fe (diff)
downloadzig-cd26d3b0bb2b32f1daf1d3d46bb53731dd54afec.tar.gz
zig-cd26d3b0bb2b32f1daf1d3d46bb53731dd54afec.zip
fix regressions caused earlier in this branch
Diffstat (limited to 'lib/std/debug.zig')
-rw-r--r--lib/std/debug.zig11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/std/debug.zig b/lib/std/debug.zig
index 5c56490519..b27b1caa68 100644
--- a/lib/std/debug.zig
+++ b/lib/std/debug.zig
@@ -825,8 +825,15 @@ pub fn openElfDebugInfo(allocator: *mem.Allocator, elf_file_path: []const u8) !M
const shoff = hdr.e_shoff;
const str_section_off = shoff + @as(u64, hdr.e_shentsize) * @as(u64, hdr.e_shstrndx);
- const header_strings = mapped_mem[str_section_off..str_section_off + hdr.e_shentsize];
- const shdrs = @ptrCast([*]const elf.Shdr, @alignCast(@alignOf(elf.Shdr), &mapped_mem[shoff]))[0..hdr.e_shnum];
+ const str_shdr = @ptrCast(
+ *const elf.Shdr,
+ @alignCast(@alignOf(elf.Shdr), &mapped_mem[str_section_off]),
+ );
+ const header_strings = mapped_mem[str_shdr.sh_offset .. str_shdr.sh_offset + str_shdr.sh_size];
+ const shdrs = @ptrCast(
+ [*]const elf.Shdr,
+ @alignCast(@alignOf(elf.Shdr), &mapped_mem[shoff]),
+ )[0..hdr.e_shnum];
var opt_debug_info: ?[]const u8 = null;
var opt_debug_abbrev: ?[]const u8 = null;