| ... | ... | @@ -4893,6 +4893,7 @@ fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !void { |
| 4893 | 4893 | var fetch_mode: Package.Fetch.JobQueue.Mode = .needed; |
| 4894 | 4894 | var system_pkg_dir_path: ?[]const u8 = null; |
| 4895 | 4895 | var debug_target: ?[]const u8 = null; |
| 4896 | var debug_libc_paths_file: ?[]const u8 = null; |
| 4896 | 4897 | |
| 4897 | 4898 | const argv_index_exe = child_argv.items.len; |
| 4898 | 4899 | _ = try child_argv.addOne(); |
| ... | ... | @@ -5016,6 +5017,14 @@ fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !void { |
| 5016 | 5017 | } else { |
| 5017 | 5018 | warn("Zig was compiled without debug extensions. --debug-target has no effect.", .{}); |
| 5018 | 5019 | } |
| 5020 | } else if (mem.eql(u8, arg, "--debug-libc")) { |
| 5021 | if (i + 1 >= args.len) fatal("expected argument after '{s}'", .{arg}); |
| 5022 | i += 1; |
| 5023 | if (build_options.enable_debug_extensions) { |
| 5024 | debug_libc_paths_file = args[i]; |
| 5025 | } else { |
| 5026 | warn("Zig was compiled without debug extensions. --debug-libc has no effect.", .{}); |
| 5027 | } |
| 5019 | 5028 | } else if (mem.eql(u8, arg, "--verbose-link")) { |
| 5020 | 5029 | verbose_link = true; |
| 5021 | 5030 | } else if (mem.eql(u8, arg, "--verbose-cc")) { |
| ... | ... | @@ -5103,6 +5112,14 @@ fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !void { |
| 5103 | 5112 | .is_explicit_dynamic_linker = false, |
| 5104 | 5113 | }; |
| 5105 | 5114 | }; |
| 5115 | // Likewise, `--debug-libc` allows overriding the libc installation. |
| 5116 | const libc_installation: ?*const LibCInstallation = lci: { |
| 5117 | const paths_file = debug_libc_paths_file orelse break :lci null; |
| 5118 | if (!build_options.enable_debug_extensions) unreachable; |
| 5119 | const lci = try arena.create(LibCInstallation); |
| 5120 | lci.* = try .parse(arena, paths_file, &resolved_target.result); |
| 5121 | break :lci lci; |
| 5122 | }; |
| 5106 | 5123 | |
| 5107 | 5124 | process.raiseFileDescriptorLimit(); |
| 5108 | 5125 | |
| ... | ... | @@ -5367,6 +5384,7 @@ fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !void { |
| 5367 | 5384 | } |
| 5368 | 5385 | |
| 5369 | 5386 | const comp = Compilation.create(gpa, arena, .{ |
| 5387 | .libc_installation = libc_installation, |
| 5370 | 5388 | .dirs = dirs, |
| 5371 | 5389 | .root_name = "build", |
| 5372 | 5390 | .config = config, |