| ... | @@ -825,8 +825,15 @@ pub fn openElfDebugInfo(allocator: *mem.Allocator, elf_file_path: []const u8) !M | ... | @@ -825,8 +825,15 @@ pub fn openElfDebugInfo(allocator: *mem.Allocator, elf_file_path: []const u8) !M |
| 825 | | 825 | |
| 826 | const shoff = hdr.e_shoff; | 826 | const shoff = hdr.e_shoff; |
| 827 | const str_section_off = shoff + @as(u64, hdr.e_shentsize) * @as(u64, hdr.e_shstrndx); | 827 | const str_section_off = shoff + @as(u64, hdr.e_shentsize) * @as(u64, hdr.e_shstrndx); |
| 828 | const header_strings = mapped_mem[str_section_off..str_section_off + hdr.e_shentsize]; | 828 | const str_shdr = @ptrCast( |
| 829 | const shdrs = @ptrCast([*]const elf.Shdr, @alignCast(@alignOf(elf.Shdr), &mapped_mem[shoff]))[0..hdr.e_shnum]; | 829 | *const elf.Shdr, |
| | 830 | @alignCast(@alignOf(elf.Shdr), &mapped_mem[str_section_off]), |
| | 831 | ); |
| | 832 | const header_strings = mapped_mem[str_shdr.sh_offset .. str_shdr.sh_offset + str_shdr.sh_size]; |
| | 833 | const shdrs = @ptrCast( |
| | 834 | [*]const elf.Shdr, |
| | 835 | @alignCast(@alignOf(elf.Shdr), &mapped_mem[shoff]), |
| | 836 | )[0..hdr.e_shnum]; |
| 830 | | 837 | |
| 831 | var opt_debug_info: ?[]const u8 = null; | 838 | var opt_debug_info: ?[]const u8 = null; |
| 832 | var opt_debug_abbrev: ?[]const u8 = null; | 839 | var opt_debug_abbrev: ?[]const u8 = null; |