| 22 | }; |
| 23 | |
| 24 | static _Unwind_Reason_Code unwind_callback(struct _Unwind_Context *context, void *data) { |
| 25 | auto *state = (struct backtrace_stack *) (data); |
| 26 | uintptr_t pc = _Unwind_GetIP(context); // 获取 pc 值,即绝对地址 |
| 27 | if (pc) { |
| 28 | if (state->current == state->end) { |
| 29 | return _URC_END_OF_STACK; |
| 30 | } else { |
| 31 | *state->current++ = (void *) (pc); |
| 32 | } |
| 33 | } |
| 34 | return _URC_NO_REASON; |
| 35 | } |
| 36 | |
| 37 | static size_t fill_backtraces_buffer(void **buffer, int max) { |
| 38 | struct backtrace_stack stack = {buffer, buffer + max}; |
nothing calls this directly
no outgoing calls
no test coverage detected