fix regressions caused earlier in this branch

This commit is contained in:
Andrew Kelley
2020-03-10 18:54:24 -04:00
parent 18f1fef142
commit cd26d3b0bb
2 changed files with 10 additions and 4 deletions

View File

@@ -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;