| author | |
| committer | |
| log | 084e92879a1732374fac5f1a05a27f42b9306d22 |
| tree | 59d416eec4b409c74aa2c0b95781e418d5cd2c7a |
| parent | dae703d3c028eab3bf98d89d2bca1abc75f864fa |
| signature |
Calling `current` here causes compilation failures as the C backend
currently does not emit valid MSVC inline assembly. This change means
that when building for MSVC with the self-hosted C backend, only FP
unwinding can be used.2 files changed, 9 insertions(+), 3 deletions(-)
lib/std/debug.zig+7-1| ... | ... | @@ -756,7 +756,13 @@ const StackIterator = union(enum) { |
| 756 | 756 | // Use `di_first` here so we report the PC in the context before unwinding any further. |
| 757 | 757 | return .{ .di_first = .init(context_ptr) }; |
| 758 | 758 | } |
| 759 | if (SelfInfo.supports_unwinding and cpu_context.Native != noreturn) { | |
| 759 | // Workaround the C backend being unable to use inline assembly on MSVC by disabling the | |
| 760 | // call to `current`. This effectively constrains stack trace collection and dumping to FP | |
| 761 | // unwinding when building with CBE for MSVC. | |
| 762 | if (!(builtin.zig_backend == .stage2_c and builtin.target.abi == .msvc) and | |
| 763 | SelfInfo.supports_unwinding and | |
| 764 | cpu_context.Native != noreturn) | |
| 765 | { | |
| 760 | 766 | // We don't need `di_first` here, because our PC is in `std.debug`; we're only interested |
| 761 | 767 | // in our caller's frame and above. |
| 762 | 768 | return .{ .di = .init(&.current()) }; |
lib/std/debug/cpu_context.zig+2-2| ... | ... | @@ -316,7 +316,7 @@ pub const X86_64 = struct { |
| 316 | 316 | \\movq %%r15, 0x78(%%rdi) |
| 317 | 317 | \\leaq (%%rip), %%rax |
| 318 | 318 | \\movq %%rax, 0x80(%%rdi) |
| 319 | \\movq 0x00(%%rdi), %%rax // restore saved rax | |
| 319 | \\movq 0x00(%%rdi), %%rax | |
| 320 | 320 | : |
| 321 | 321 | : [gprs] "{rdi}" (&ctx.gprs.values), |
| 322 | 322 | : .{ .memory = true }); |
| ... | ... | @@ -431,7 +431,7 @@ pub const Aarch64 = extern struct { |
| 431 | 431 | \\str x1, [x0, #0x0f8] |
| 432 | 432 | \\adr x1, . |
| 433 | 433 | \\str x1, [x0, #0x100] |
| 434 | \\ldr x1, [x0, #0x008] // restore saved x1 | |
| 434 | \\ldr x1, [x0, #0x008] | |
| 435 | 435 | : |
| 436 | 436 | : [gprs] "{x0}" (&ctx), |
| 437 | 437 | : .{ .memory = true }); |