| ... | ... | @@ -438,7 +438,12 @@ pub fn writeCurrentStackTrace( |
| 438 | 438 | } |
| 439 | 439 | var it = StackIterator.init(start_addr, null); |
| 440 | 440 | while (it.next()) |return_address| { |
| 441 | | try printSourceAtAddress(debug_info, out_stream, return_address - 1, tty_config); |
| 441 | // On arm64 macOS, the address of the last frame is 0x0 rather than 0x1 as on x86_64 macOS, |
| 442 | // therefore, we do a check for `return_address == 0` before subtracting 1 from it to avoid |
| 443 | // an overflow. We do not need to signal `StackIterator` as it will correctly detect this |
| 444 | // condition on the subsequent iteration and return `null` thus terminating the loop. |
| 445 | const address = if (return_address == 0) return_address else return_address - 1; |
| 446 | try printSourceAtAddress(debug_info, out_stream, address, tty_config); |
| 442 | 447 | } |
| 443 | 448 | } |
| 444 | 449 | |