mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 14:23:09 +00:00
std.debug: fix FP unwind progress check for stackGrowth() == .up targets
This commit is contained in:
parent
a689c38197
commit
c13355abda
@ -974,11 +974,15 @@ const StackIterator = union(enum) {
|
|||||||
const ra_ptr: *const usize = @ptrFromInt(ra_addr);
|
const ra_ptr: *const usize = @ptrFromInt(ra_addr);
|
||||||
const bp = applyOffset(bp_ptr.*, stack_bias) orelse return .end;
|
const bp = applyOffset(bp_ptr.*, stack_bias) orelse return .end;
|
||||||
|
|
||||||
// The stack grows downards, so `bp > fp` should always hold. If it doesn't, this
|
// If the stack grows downwards, `bp > fp` should always hold; conversely, if it
|
||||||
// frame is invalid, so we'll treat it as though it we reached end of stack. The
|
// grows upwards, `bp < fp` should always hold. If that is not the case, this
|
||||||
|
// frame is invalid, so we'll treat it as though we reached end of stack. The
|
||||||
// exception is address 0, which is a graceful end-of-stack signal, in which case
|
// exception is address 0, which is a graceful end-of-stack signal, in which case
|
||||||
// *this* return address is valid and the *next* iteration will be the last.
|
// *this* return address is valid and the *next* iteration will be the last.
|
||||||
if (bp != 0 and bp <= fp) return .end;
|
if (bp != 0 and switch (comptime builtin.target.stackGrowth()) {
|
||||||
|
.down => bp <= fp,
|
||||||
|
.up => bp >= fp,
|
||||||
|
}) return .end;
|
||||||
|
|
||||||
it.fp = bp;
|
it.fp = bp;
|
||||||
const ra = stripInstructionPtrAuthCode(ra_ptr.*);
|
const ra = stripInstructionPtrAuthCode(ra_ptr.*);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user