| ... | @@ -815,13 +815,17 @@ const StackIterator = union(enum) { | ... | @@ -815,13 +815,17 @@ const StackIterator = union(enum) { |
| 815 | | 815 | |
| 816 | /// On aarch64-macos, Apple mandate that the frame pointer is always used. | 816 | /// On aarch64-macos, Apple mandate that the frame pointer is always used. |
| 817 | /// TODO: are there any other architectures with guarantees like this? | 817 | /// TODO: are there any other architectures with guarantees like this? |
| 818 | const fp_unwind_is_safe = !builtin.omit_frame_pointer and builtin.cpu.arch == .aarch64 and builtin.os.tag.isDarwin(); | 818 | const fp_unwind_is_safe = builtin.cpu.arch == .aarch64 and builtin.os.tag.isDarwin(); |
| 819 | | 819 | |
| 820 | /// Whether the current unwind strategy is allowed given `allow_unsafe`. | 820 | /// Whether the current unwind strategy is allowed given `allow_unsafe`. |
| 821 | fn stratOk(it: *const StackIterator, allow_unsafe: bool) bool { | 821 | fn stratOk(it: *const StackIterator, allow_unsafe: bool) bool { |
| 822 | return switch (it.*) { | 822 | return switch (it.*) { |
| 823 | .di => true, | 823 | .di => true, |
| 824 | .fp => allow_unsafe or fp_unwind_is_safe, | 824 | // If we omitted frame pointers from *this* compilation, FP unwinding would crash |
| | 825 | // immediately regardless of anything. But FPs could also be omitted from a different |
| | 826 | // linked object, so it's not guaranteed to be safe, unless the target specifically |
| | 827 | // requires it. |
| | 828 | .fp => !builtin.omit_frame_pointer and (fp_unwind_is_safe or allow_unsafe), |
| 825 | }; | 829 | }; |
| 826 | } | 830 | } |
| 827 | | 831 | |