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