| ... | ... | @@ -3,7 +3,7 @@ const fatal = std.process.fatal; |
| 3 | 3 | const Allocator = std.mem.Allocator; |
| 4 | 4 | const Cache = std.Build.Cache; |
| 5 | 5 | |
| 6 | | const usage = "usage: incr-check <zig binary path> <input file> [--zig-lib-dir lib] [--debug-zcu] [--emit none|bin|c] [--zig-cc-binary /path/to/zig]"; |
| 6 | const usage = "usage: incr-check <zig binary path> <input file> [--zig-lib-dir lib] [--debug-zcu] [--debug-link] [--emit none|bin|c] [--zig-cc-binary /path/to/zig]"; |
| 7 | 7 | |
| 8 | 8 | const EmitMode = enum { |
| 9 | 9 | none, |
| ... | ... | @@ -22,6 +22,7 @@ pub fn main() !void { |
| 22 | 22 | var opt_cc_zig: ?[]const u8 = null; |
| 23 | 23 | var emit: EmitMode = .bin; |
| 24 | 24 | var debug_zcu = false; |
| 25 | var debug_link = false; |
| 25 | 26 | |
| 26 | 27 | var arg_it = try std.process.argsWithAllocator(arena); |
| 27 | 28 | _ = arg_it.skip(); |
| ... | ... | @@ -35,6 +36,8 @@ pub fn main() !void { |
| 35 | 36 | opt_lib_dir = arg_it.next() orelse fatal("expected arg after '--zig-lib-dir'\n{s}", .{usage}); |
| 36 | 37 | } else if (std.mem.eql(u8, arg, "--debug-zcu")) { |
| 37 | 38 | debug_zcu = true; |
| 39 | } else if (std.mem.eql(u8, arg, "--debug-link")) { |
| 40 | debug_link = true; |
| 38 | 41 | } else if (std.mem.eql(u8, arg, "--zig-cc-binary")) { |
| 39 | 42 | opt_cc_zig = arg_it.next() orelse fatal("expect arg after '--zig-cc-binary'\n{s}", .{usage}); |
| 40 | 43 | } else { |
| ... | ... | @@ -98,6 +101,11 @@ pub fn main() !void { |
| 98 | 101 | if (debug_zcu) { |
| 99 | 102 | try child_args.appendSlice(arena, &.{ "--debug-log", "zcu" }); |
| 100 | 103 | } |
| 104 | if (debug_link) { |
| 105 | try child_args.appendSlice(arena, &.{ "--debug-log", "link", "--debug-log", "link_state", "--debug-log", "link_relocs" }); |
| 106 | } |
| 107 | |
| 108 | const debug_log_verbose = debug_zcu or debug_link; |
| 101 | 109 | |
| 102 | 110 | var child = std.process.Child.init(child_args.items, arena); |
| 103 | 111 | child.stdin_behavior = .Pipe; |
| ... | ... | @@ -131,7 +139,7 @@ pub fn main() !void { |
| 131 | 139 | .tmp_dir = tmp_dir, |
| 132 | 140 | .tmp_dir_path = tmp_dir_path, |
| 133 | 141 | .child = &child, |
| 134 | | .allow_stderr = debug_zcu, |
| 142 | .allow_stderr = debug_log_verbose, |
| 135 | 143 | .emit = emit, |
| 136 | 144 | .cc_child_args = &cc_child_args, |
| 137 | 145 | }; |
| ... | ... | @@ -148,7 +156,7 @@ pub fn main() !void { |
| 148 | 156 | var update_node = prog_node.start(update.name, 0); |
| 149 | 157 | defer update_node.end(); |
| 150 | 158 | |
| 151 | | if (debug_zcu) { |
| 159 | if (debug_log_verbose) { |
| 152 | 160 | std.log.info("=== START UPDATE '{s}' ===", .{update.name}); |
| 153 | 161 | } |
| 154 | 162 | |