| author | |
| committer | |
| log | 027517a0c933f7c07497497c1e8cc0700b7f02bb |
| tree | b7925a8cdd951f751ca382482c79b34f983faf30 |
| parent | b780dee3e845f5c8fb8ea7b7906685d5196261a4 |
2 files changed, 13 insertions(+), 9 deletions(-)
std/coff.zig+12| ... | @@ -39,6 +39,18 @@ pub const Coff = struct { | ... | @@ -39,6 +39,18 @@ pub const Coff = struct { |
| 39 | guid: [16]u8, | 39 | guid: [16]u8, |
| 40 | age: u32, | 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 | pub fn loadHeader(self: *Coff) !void { | 54 | pub fn loadHeader(self: *Coff) !void { |
| 43 | const pe_pointer_offset = 0x3C; | 55 | const pe_pointer_offset = 0x3C; |
| 44 | 56 |
std/debug.zig+1-9| ... | @@ -800,15 +800,7 @@ fn openSelfDebugInfoWindows(allocator: *mem.Allocator) !DebugInfo { | ... | @@ -800,15 +800,7 @@ fn openSelfDebugInfoWindows(allocator: *mem.Allocator) !DebugInfo { |
| 800 | defer self_file.close(); | 800 | defer self_file.close(); |
| 801 | 801 | ||
| 802 | const coff_obj = try allocator.create(coff.Coff); | 802 | const coff_obj = try allocator.create(coff.Coff); |
| 803 | coff_obj.* = coff.Coff{ | 803 | coff_obj.* = coff.Coff.init(allocator, self_file); |
| 804 | .in_file = self_file, | ||
| 805 | .allocator = allocator, | ||
| 806 | .coff_header = undefined, | ||
| 807 | .pe_header = undefined, | ||
| 808 | .sections = ArrayList(coff.Section).init(allocator), | ||
| 809 | .guid = undefined, | ||
| 810 | .age = undefined, | ||
| 811 | }; | ||
| 812 | 804 | ||
| 813 | var di = DebugInfo{ | 805 | var di = DebugInfo{ |
| 814 | .coff = coff_obj, | 806 | .coff = coff_obj, |