[utils,unwind] add return to string functions

This commit is contained in:
Armin Novak 2024-05-29 09:25:25 +02:00
parent fc9fef65cb
commit 1dcac1618c
No known key found for this signature in database
GPG Key ID: 2CF4A2D2D3D72105

View File

@ -44,6 +44,36 @@ typedef struct
unwind_info_t* info;
} unwind_context_t;
static const char* unwind_reason_str(_Unwind_Reason_Code code) {
switch(code) {
case _URC_NO_REASON: return "_URC_NO_REASON";
#if defined(__arm__) && !defined(__USING_SJLJ_EXCEPTIONS__) && \
!defined(__ARM_DWARF_EH__) && !defined(__SEH__)
case _URC_OK: return "_URC_OK";
#endif
case _URC_FOREIGN_EXCEPTION_CAUGHT: return "_URC_FOREIGN_EXCEPTION_CAUGHT";
case _URC_FATAL_PHASE2_ERROR: return "_URC_FATAL_PHASE2_ERROR";
case _URC_FATAL_PHASE1_ERROR: return "_URC_FATAL_PHASE1_ERROR";
case _URC_NORMAL_STOP: return "_URC_NORMAL_STOP";
case _URC_END_OF_STACK: return "_URC_END_OF_STACK";
case _URC_HANDLER_FOUND: return "_URC_HANDLER_FOUND";
case _URC_INSTALL_CONTEXT: return "_URC_INSTALL_CONTEXT";
case _URC_CONTINUE_UNWIND: return "_URC_CONTINUE_UNWIND";
#if defined(__arm__) && !defined(__USING_SJLJ_EXCEPTIONS__) && \
!defined(__ARM_DWARF_EH__) && !defined(__SEH__)
case _URC_FAILURE: return "_URC_FAILURE";
#endif
default:
return "_URC_UNKNOWN";
}
}
static const char* unwind_reason_str_buffer(_Unwind_Reason_Code code, char* buffer, size_t size) {
const char* str = unwind_reason_str(code);
_snprintf(buffer, size, "%s [0x%02x]", str, code);
return buffer;
}
static _Unwind_Reason_Code unwind_backtrace_callback(struct _Unwind_Context* context, void* arg)
{
unwind_context_t* ctx = arg;