knurling-rs / probe-run

Run embedded programs just like native ones
Apache License 2.0
645 stars 75 forks source link

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

Open Urhengulas opened 1 year ago

Urhengulas commented 1 year ago

This came up in the review of #383:

https://github.com/knurling-rs/probe-run/blob/b83bb9636d008eb9b9b87d7888e16342053e246b/src/backtrace/unwind.rs#L104-L110

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