Merge pull request #141 from birth-software/provide-debug-info-switch

Provide debug info switch
This commit is contained in:
David 2024-04-14 14:39:03 -06:00 committed by GitHub
commit 1e7248ab0a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 2 deletions

View File

@ -2803,7 +2803,7 @@ pub fn buildExecutable(context: *const Context, arguments: []const []const u8, o
var maybe_executable_name: ?[]const u8 = null;
var c_source_files = UnpinnedArray([]const u8){};
var optimization = Optimization.none;
const generate_debug_information = true;
var generate_debug_information = true;
if (arguments.len == 0) return error.InvalidInput;
@ -2929,6 +2929,15 @@ pub fn buildExecutable(context: *const Context, arguments: []const []const u8, o
} else {
reportUnterminatedArgumentError(current_argument);
}
} else if (byte_equal(current_argument, "-debug")) {
if (i + 1 != arguments.len) {
i += 1;
const debug_string = arguments[i];
generate_debug_information = if (byte_equal(debug_string, "true")) true else if (byte_equal(debug_string, "false")) false else unreachable;
} else {
reportUnterminatedArgumentError(current_argument);
}
} else {
@panic(current_argument);
// std.debug.panic("Unrecognized argument: {s}", .{current_argument});

View File

@ -2412,7 +2412,6 @@ pub fn codegen(unit: *Compilation.Unit, context: *const Compilation.Context) !vo
.@"noalias" = llvm_context.getAttributeFromEnum(.NoAlias, 0),
},
};
unit.descriptor.generate_debug_information = false;
if (unit.descriptor.generate_debug_information) {
const full_path = try std.fs.cwd().realpathAlloc(context.allocator, unit.descriptor.main_package_path);