mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
enable debugging infrastructure when using C backend
Thanks to @jacobly0's recent enhancements to the C backend, this stuff works now.
This commit is contained in:
parent
afbcad9939
commit
396bd51c48
4 changed files with 9 additions and 17 deletions
|
|
@ -868,8 +868,7 @@ pub fn default_panic(msg: []const u8, error_return_trace: ?*StackTrace, ret_addr
|
|||
|
||||
// For backends that cannot handle the language features depended on by the
|
||||
// default panic handler, we have a simpler panic handler:
|
||||
if (builtin.zig_backend == .stage2_c or
|
||||
builtin.zig_backend == .stage2_wasm or
|
||||
if (builtin.zig_backend == .stage2_wasm or
|
||||
builtin.zig_backend == .stage2_arm or
|
||||
builtin.zig_backend == .stage2_aarch64 or
|
||||
builtin.zig_backend == .stage2_x86_64 or
|
||||
|
|
|
|||
|
|
@ -1360,13 +1360,7 @@ pub const DebugInfo = struct {
|
|||
}
|
||||
|
||||
pub fn getModuleForAddress(self: *DebugInfo, address: usize) !*ModuleDebugInfo {
|
||||
if (builtin.zig_backend == .stage2_c) {
|
||||
return @as(error{
|
||||
InvalidDebugInfo,
|
||||
MissingDebugInfo,
|
||||
UnsupportedBackend,
|
||||
}, error.UnsupportedBackend);
|
||||
} else if (comptime builtin.target.isDarwin()) {
|
||||
if (comptime builtin.target.isDarwin()) {
|
||||
return self.lookupModuleDyld(address);
|
||||
} else if (native_os == .windows) {
|
||||
return self.lookupModuleWin32(address);
|
||||
|
|
@ -1380,9 +1374,7 @@ pub const DebugInfo = struct {
|
|||
}
|
||||
|
||||
pub fn getModuleNameForAddress(self: *DebugInfo, address: usize) ?[]const u8 {
|
||||
if (builtin.zig_backend == .stage2_c) {
|
||||
return null;
|
||||
} else if (comptime builtin.target.isDarwin()) {
|
||||
if (comptime builtin.target.isDarwin()) {
|
||||
return null;
|
||||
} else if (native_os == .windows) {
|
||||
return self.lookupModuleNameWin32(address);
|
||||
|
|
@ -2191,8 +2183,6 @@ pub fn dumpStackPointerAddr(prefix: []const u8) void {
|
|||
}
|
||||
|
||||
test "manage resources correctly" {
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // error.UnsupportedBackend
|
||||
|
||||
if (builtin.os.tag == .wasi) return error.SkipZigTest;
|
||||
|
||||
if (builtin.os.tag == .windows and builtin.cpu.arch == .x86_64) {
|
||||
|
|
|
|||
|
|
@ -5371,8 +5371,10 @@ pub fn dl_iterate_phdr(
|
|||
) Error!void {
|
||||
const Context = @TypeOf(context);
|
||||
|
||||
if (builtin.object_format != .elf)
|
||||
@compileError("dl_iterate_phdr is not available for this target");
|
||||
switch (builtin.object_format) {
|
||||
.elf, .c => {},
|
||||
else => @compileError("dl_iterate_phdr is not available for this target"),
|
||||
}
|
||||
|
||||
if (builtin.link_libc) {
|
||||
switch (system.dl_iterate_phdr(struct {
|
||||
|
|
|
|||
|
|
@ -6629,7 +6629,8 @@ pub fn backendSupportsFeature(mod: Module, feature: Feature) bool {
|
|||
mod.comp.bin_file.options.use_llvm,
|
||||
.panic_unwrap_error => mod.comp.bin_file.options.target.ofmt == .c or
|
||||
mod.comp.bin_file.options.use_llvm,
|
||||
.safety_check_formatted => mod.comp.bin_file.options.use_llvm,
|
||||
.safety_check_formatted => mod.comp.bin_file.options.target.ofmt == .c or
|
||||
mod.comp.bin_file.options.use_llvm,
|
||||
.error_return_trace => mod.comp.bin_file.options.use_llvm,
|
||||
.is_named_enum_value => mod.comp.bin_file.options.use_llvm,
|
||||
.error_set_has_value => mod.comp.bin_file.options.use_llvm or mod.comp.bin_file.options.target.isWasm(),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue