| ... | @@ -256,32 +256,36 @@ pub fn createEmpty( | ... | @@ -256,32 +256,36 @@ pub fn createEmpty( |
| 256 | .program_code_size_hint = options.program_code_size_hint, | 256 | .program_code_size_hint = options.program_code_size_hint, |
| 257 | }); | 257 | }); |
| 258 | | 258 | |
| 259 | // TODO init dwarf | 259 | switch (comp.config.debug_format) { |
| 260 | | 260 | .strip => {}, |
| 261 | // if (comp.config.debug_format != .strip) { | 261 | .dwarf => { |
| 262 | // // Create dSYM bundle. | 262 | // Create dSYM bundle. |
| 263 | // log.debug("creating {s}.dSYM bundle", .{emit.sub_path}); | 263 | log.debug("creating {s}.dSYM bundle", .{emit.sub_path}); |
| 264 | | 264 | |
| 265 | // const d_sym_path = try std.fmt.allocPrint( | 265 | const sep = fs.path.sep_str; |
| 266 | // arena, | 266 | const d_sym_path = try std.fmt.allocPrint( |
| 267 | // "{s}.dSYM" ++ fs.path.sep_str ++ "Contents" ++ fs.path.sep_str ++ "Resources" ++ fs.path.sep_str ++ "DWARF", | 267 | arena, |
| 268 | // .{emit.sub_path}, | 268 | "{s}.dSYM" ++ sep ++ "Contents" ++ sep ++ "Resources" ++ sep ++ "DWARF", |
| 269 | // ); | 269 | .{emit.sub_path}, |
| 270 | | 270 | ); |
| 271 | // var d_sym_bundle = try emit.directory.handle.makeOpenPath(d_sym_path, .{}); | 271 | |
| 272 | // defer d_sym_bundle.close(); | 272 | var d_sym_bundle = try emit.directory.handle.makeOpenPath(d_sym_path, .{}); |
| 273 | | 273 | defer d_sym_bundle.close(); |
| 274 | // const d_sym_file = try d_sym_bundle.createFile(emit.sub_path, .{ | 274 | |
| 275 | // .truncate = false, | 275 | const d_sym_file = try d_sym_bundle.createFile(emit.sub_path, .{ |
| 276 | // .read = true, | 276 | .truncate = false, |
| 277 | // }); | 277 | .read = true, |
| 278 | | 278 | }); |
| 279 | // self.d_sym = .{ | 279 | |
| 280 | // .allocator = gpa, | 280 | self.d_sym = .{ |
| 281 | // .dwarf = link.File.Dwarf.init(&self.base, .dwarf32), | 281 | .allocator = gpa, |
| 282 | // .file = d_sym_file, | 282 | .dwarf = link.File.Dwarf.init(&self.base, .dwarf32), |
| 283 | // }; | 283 | .file = d_sym_file, |
| 284 | // } | 284 | }; |
| | 285 | try self.d_sym.?.initMetadata(self); |
| | 286 | }, |
| | 287 | .code_view => unreachable, |
| | 288 | } |
| 285 | } | 289 | } |
| 286 | } | 290 | } |
| 287 | | 291 | |
| ... | @@ -3906,9 +3910,8 @@ fn reportDuplicates(self: *MachO, dupes: anytype) error{ HasDuplicates, OutOfMem | ... | @@ -3906,9 +3910,8 @@ fn reportDuplicates(self: *MachO, dupes: anytype) error{ HasDuplicates, OutOfMem |
| 3906 | } | 3910 | } |
| 3907 | | 3911 | |
| 3908 | pub fn getDebugSymbols(self: *MachO) ?*DebugSymbols { | 3912 | pub fn getDebugSymbols(self: *MachO) ?*DebugSymbols { |
| 3909 | if (self.d_sym) |*ds| { | 3913 | if (self.d_sym) |*ds| return ds; |
| 3910 | return ds; | 3914 | return null; |
| 3911 | } else return null; | | |
| 3912 | } | 3915 | } |
| 3913 | | 3916 | |
| 3914 | pub fn ptraceAttach(self: *MachO, pid: std.os.pid_t) !void { | 3917 | pub fn ptraceAttach(self: *MachO, pid: std.os.pid_t) !void { |