Skip to content
This repository has been archived by the owner on Jan 30, 2024. It is now read-only.

Unwinding with -C force-frame-pointers=off #387

Open
Urhengulas opened this issue Mar 7, 2023 · 0 comments
Open

Unwinding with -C force-frame-pointers=off #387

Urhengulas opened this issue Mar 7, 2023 · 0 comments
Labels
difficulty: medium Somewhat difficult to solve topic: unwinding

Comments

@Urhengulas
Copy link
Member

This came up in the review of #383:

// If the frame didn't move, and the program counter didn't change, bail out
// (otherwise we might print the same frame over and over).
if !cfa_changed && !program_counter_changed {
// If we do not end up in the reset function the stack is corrupted
output.corrupted = !reset_range.contains(&pc);
break;
}

this is not due to this PR but I wouldn't necessarily categorize this exit condition as "corrupted". if you compile the rust program with -C force-frame-pointers=off then it's not possible to unwind the stack because frame pointer information is missing (from register r7) so you'll hit this branch but the call stack and the program will both operate fine.

-C force-frame-pointers=off is not very common but the assembly trampolines used to implement context switches in RTOSes / kernels could have the same effect of making unwinding not work.

I think it would be more to correct to simply say in this branch that it's "not possible to further unwind the stack" or something like that

@Urhengulas Urhengulas added difficulty: medium Somewhat difficult to solve topic: unwinding labels Mar 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
difficulty: medium Somewhat difficult to solve topic: unwinding
Projects
None yet
Development

No branches or pull requests

1 participant