use execinfo.h to get backtrace
Really poor backtrace because it will only have the frames from oc side, I don't know why callStackSymbols is returning null, compilation flags?
This commit is contained in:
parent
a77863947f
commit
c6b8be742d
|
@ -49,6 +49,7 @@
|
||||||
|
|
||||||
#include <mapistore/mapistore.h>
|
#include <mapistore/mapistore.h>
|
||||||
#include <mapistore/mapistore_errors.h>
|
#include <mapistore/mapistore_errors.h>
|
||||||
|
#include <execinfo.h>
|
||||||
|
|
||||||
static Class MAPIStoreContextK = Nil;
|
static Class MAPIStoreContextK = Nil;
|
||||||
static BOOL leakDebugging = NO;
|
static BOOL leakDebugging = NO;
|
||||||
|
@ -69,8 +70,18 @@ sogo_backend_unexpected_error()
|
||||||
static enum mapistore_error
|
static enum mapistore_error
|
||||||
sogo_backend_handle_objc_exception(NSException *e, const char *fn_name, const int line_no)
|
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]);
|
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"])
|
if ([[e name] isEqual:@"NotImplementedException"])
|
||||||
{
|
{
|
||||||
return MAPISTORE_ERR_NOT_IMPLEMENTED;
|
return MAPISTORE_ERR_NOT_IMPLEMENTED;
|
||||||
|
|
Loading…
Reference in a new issue