diff --git a/OpenChange/MAPIStoreSOGo.m b/OpenChange/MAPIStoreSOGo.m index dba78b5f1..97d1d7d7c 100644 --- a/OpenChange/MAPIStoreSOGo.m +++ b/OpenChange/MAPIStoreSOGo.m @@ -49,6 +49,7 @@ #include #include +#include static Class MAPIStoreContextK = Nil; static BOOL leakDebugging = NO; @@ -69,8 +70,18 @@ sogo_backend_unexpected_error() static enum mapistore_error sogo_backend_handle_objc_exception(NSException *e, const char *fn_name, const int line_no) { - NSLog(@"[SOGo: %s:%d] - EXCEPTION: %@, reason: %@, stackframe: %@", + NSLog(@"[SOGo: %s:%d] - EXCEPTION: %@, reason: %@, backtrace: %@", fn_name, line_no, e.name, e.reason, [e callStackSymbols]); + if (![e callStackSymbols]) + { + void *frames[128]; + int i, len = backtrace(frames, 128); + char **symbols = backtrace_symbols(frames, len); + NSLog(@"Backtrace using execinfo.h:"); + for (i = 0; i < len; ++i) + NSLog(@"\t%s", symbols[i]); + free(symbols); + } if ([[e name] isEqual:@"NotImplementedException"]) { return MAPISTORE_ERR_NOT_IMPLEMENTED;