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