aboutsummaryrefslogtreecommitdiff
path: root/src/main.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2024-07-24 17:41:44 -0700
committerAndrew Kelley <andrew@ziglang.org>2024-07-25 18:52:21 -0700
commita3c74aca99c7eaf719c745ec6e9ee7366cad1910 (patch)
treeb0396505cb9623d1a906501ed97905f7cc8bb6c6 /src/main.zig
parent90dfd86ebee1639e5455ace4e34157ff9b68ac0f (diff)
downloadzig-a3c74aca99c7eaf719c745ec6e9ee7366cad1910.tar.gz
zig-a3c74aca99c7eaf719c745ec6e9ee7366cad1910.zip
add --debug-rt CLI arg to the compiler + bonus edits
The flag makes compiler_rt and libfuzzer be in debug mode. Also: * fuzzer: override debug logs and disable debug logs for frequently called functions * std.Build.Fuzz: fix bug of rerunning the old unit test binary * report errors from rebuilding the unit tests better * link.Elf: additionally add tsan lib and fuzzer lib to the hash
Diffstat (limited to 'src/main.zig')
-rw-r--r--src/main.zig5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/main.zig b/src/main.zig
index 9940312bcd..ddd2e79f44 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -655,6 +655,7 @@ const usage_build_generic =
\\ --debug-log [scope] Enable printing debug/info log messages for scope
\\ --debug-compile-errors Crash with helpful diagnostics at the first compile error
\\ --debug-link-snapshot Enable dumping of the linker's state in JSON format
+ \\ --debug-rt Debug compiler runtime libraries
\\
;
@@ -912,6 +913,7 @@ fn buildOutputType(
var minor_subsystem_version: ?u16 = null;
var mingw_unicode_entry_point: bool = false;
var enable_link_snapshots: bool = false;
+ var debug_compiler_runtime_libs = false;
var opt_incremental: ?bool = null;
var install_name: ?[]const u8 = null;
var hash_style: link.File.Elf.HashStyle = .both;
@@ -1367,6 +1369,8 @@ fn buildOutputType(
} else {
enable_link_snapshots = true;
}
+ } else if (mem.eql(u8, arg, "--debug-rt")) {
+ debug_compiler_runtime_libs = true;
} else if (mem.eql(u8, arg, "-fincremental")) {
dev.check(.incremental);
opt_incremental = true;
@@ -3408,6 +3412,7 @@ fn buildOutputType(
// noise when --search-prefix and --mod are combined.
.global_cc_argv = try cc_argv.toOwnedSlice(arena),
.file_system_inputs = &file_system_inputs,
+ .debug_compiler_runtime_libs = debug_compiler_runtime_libs,
}) catch |err| switch (err) {
error.LibCUnavailable => {
const triple_name = try target.zigTriple(arena);