| author | |
| committer | |
| log | 06733c3ff5ed3d7ab0d6a3a6baae6d6699d33f8c |
| tree | a8a81037d96f586797ebe650620d91c35e688265 |
| parent | 704444a6e329ee3bb7a99f8b2cc6cebde18b93cd |
| parent | 027517a0c933f7c07497497c1e8cc0700b7f02bb |
| signature | Signed by PGP key 4AEE18F83AFDEB23 |
fixed coff header parsing2 files changed, 15 insertions(+), 11 deletions(-)
std/coff.zig+14-2| ... | ... | @@ -39,6 +39,18 @@ pub const Coff = struct { |
| 39 | 39 | guid: [16]u8, |
| 40 | 40 | age: u32, |
| 41 | 41 | |
| 42 | pub fn init(allocator: *mem.Allocator, in_file: File) Coff { | |
| 43 | return Coff{ | |
| 44 | .in_file = in_file, | |
| 45 | .allocator = allocator, | |
| 46 | .coff_header = undefined, | |
| 47 | .pe_header = undefined, | |
| 48 | .sections = ArrayList(Section).init(allocator), | |
| 49 | .guid = undefined, | |
| 50 | .age = undefined, | |
| 51 | }; | |
| 52 | } | |
| 53 | ||
| 42 | 54 | pub fn loadHeader(self: *Coff) !void { |
| 43 | 55 | const pe_pointer_offset = 0x3C; |
| 44 | 56 | |
| ... | ... | @@ -142,10 +154,10 @@ pub const Coff = struct { |
| 142 | 154 | } |
| 143 | 155 | |
| 144 | 156 | pub fn loadSections(self: *Coff) !void { |
| 145 | if (self.sections.len != 0) | |
| 157 | if (self.sections.len == self.coff_header.number_of_sections) | |
| 146 | 158 | return; |
| 147 | 159 | |
| 148 | self.sections = ArrayList(Section).init(self.allocator); | |
| 160 | try self.sections.ensureCapacity(self.coff_header.number_of_sections); | |
| 149 | 161 | |
| 150 | 162 | var file_stream = self.in_file.inStream(); |
| 151 | 163 | const in = &file_stream.stream; |
std/debug.zig+1-9| ... | ... | @@ -826,15 +826,7 @@ fn openSelfDebugInfoWindows(allocator: *mem.Allocator) !DebugInfo { |
| 826 | 826 | defer self_file.close(); |
| 827 | 827 | |
| 828 | 828 | const coff_obj = try allocator.create(coff.Coff); |
| 829 | coff_obj.* = coff.Coff{ | |
| 830 | .in_file = self_file, | |
| 831 | .allocator = allocator, | |
| 832 | .coff_header = undefined, | |
| 833 | .pe_header = undefined, | |
| 834 | .sections = undefined, | |
| 835 | .guid = undefined, | |
| 836 | .age = undefined, | |
| 837 | }; | |
| 829 | coff_obj.* = coff.Coff.init(allocator, self_file); | |
| 838 | 830 | |
| 839 | 831 | var di = DebugInfo{ |
| 840 | 832 | .coff = coff_obj, |