Guest User

Untitled

a guest
Jan 17th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. signal(SIGBUS, signalHandler);
  2. signal(SIGSEGV, signalHandler);
  3.  
  4. void signalHandler(int signal)
  5. {
  6. NSMutableString *crashReport = [[NSMutableString alloc] init];
  7. void* callstack[128];
  8. int i, frames = backtrace(callstack, 128);
  9. char** strs = backtrace_symbols(callstack, frames);
  10. for (i = 0; i < frames; ++i) {
  11. //printf("%sn", strs[i]);
  12. [crashReport appendFormat:@"%sn",strs[i]];
  13.  
  14. }
  15. free(strs);
  16. // write crashReport to file
  17. [crashReport release];
  18. exit(1);
  19. }
Add Comment
Please, Sign In to add comment