| ... | ... | @@ -63,16 +63,22 @@ pub const cpu_context = @import("debug/cpu_context.zig"); |
| 63 | 63 | /// ``` |
| 64 | 64 | pub const SelfInfo = if (@hasDecl(root, "debug") and @hasDecl(root.debug, "SelfInfo")) |
| 65 | 65 | root.debug.SelfInfo |
| 66 | | else switch (std.Target.ObjectFormat.default(native_os, native_arch)) { |
| 67 | | .coff => if (native_os == .windows) @import("debug/SelfInfo/Windows.zig") else void, |
| 68 | | .elf => switch (native_os) { |
| 69 | | .freestanding, .other => void, |
| 70 | | else => @import("debug/SelfInfo/Elf.zig"), |
| 71 | | }, |
| 72 | | .macho => @import("debug/SelfInfo/MachO.zig"), |
| 73 | | .plan9, .spirv, .wasm => void, |
| 74 | | .c, .hex, .raw => unreachable, |
| 75 | | }; |
| 66 | else |
| 67 | TargetInfo(native_os, native_arch); |
| 68 | |
| 69 | /// Returns the default `SelfInfo` for the given `os` and `arch`. |
| 70 | pub fn TargetInfo(os: std.Target.Os.Tag, arch: std.Target.Cpu.Arch) type { |
| 71 | return switch (std.Target.ObjectFormat.default(os, arch)) { |
| 72 | .coff => if (os == .windows) @import("debug/SelfInfo/Windows.zig") else void, |
| 73 | .elf => switch (os) { |
| 74 | .freestanding, .other => void, |
| 75 | else => @import("debug/SelfInfo/Elf.zig"), |
| 76 | }, |
| 77 | .macho => @import("debug/SelfInfo/MachO.zig"), |
| 78 | .plan9, .spirv, .wasm => void, |
| 79 | .c, .hex, .raw => unreachable, |
| 80 | }; |
| 81 | } |
| 76 | 82 | |
| 77 | 83 | pub const SelfInfoError = error{ |
| 78 | 84 | /// The required debug info is invalid or corrupted. |