Overview
Comment: | Show a backtrace for uncaught exceptions. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
32230a1615aece4bd164b9750ac612ce |
User & Date: | js on 2013-05-22 21:09:40 |
Other Links: | manifest | tags |
Context
2013-05-25
| ||
11:40 | Switch back to backtrace(). check-in: f2a8bdf254 user: js tags: trunk | |
2013-05-22
| ||
21:09 | Show a backtrace for uncaught exceptions. check-in: 32230a1615 user: js tags: trunk | |
20:36 | Don't depened on execinfo.h for backtraces. check-in: a889f21180 user: js tags: trunk | |
Changes
Modified src/OFObject.m from [6f6ec3f922] to [8d2c38124f].
︙ | ︙ | |||
21 22 23 24 25 26 27 28 29 30 31 32 33 34 | #include <string.h> #include <assert.h> #include <sys/time.h> #import "OFObject.h" #import "OFTimer.h" #import "OFRunLoop.h" #import "OFThread.h" #import "OFAllocFailedException.h" #import "OFEnumerationMutationException.h" #import "OFInitializationFailedException.h" | > | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | #include <string.h> #include <assert.h> #include <sys/time.h> #import "OFObject.h" #import "OFArray.h" #import "OFTimer.h" #import "OFRunLoop.h" #import "OFThread.h" #import "OFAllocFailedException.h" #import "OFEnumerationMutationException.h" #import "OFInitializationFailedException.h" |
︙ | ︙ | |||
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | uint32_t of_hash_seed; #if !defined(OF_APPLE_RUNTIME) || defined(__OBJC2__) static void uncaught_exception_handler(id exception) { fprintf(stderr, "\nRuntime error: Unhandled exception:\n%s\n", [[exception description] UTF8String]); abort(); } #endif static void enumeration_mutation_handler(id object) { | > > > > > > > > > > | 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | uint32_t of_hash_seed; #if !defined(OF_APPLE_RUNTIME) || defined(__OBJC2__) static void uncaught_exception_handler(id exception) { OFArray *backtrace = nil; fprintf(stderr, "\nRuntime error: Unhandled exception:\n%s\n", [[exception description] UTF8String]); if ([exception respondsToSelector: @selector(backtrace)]) backtrace = [exception backtrace]; if (backtrace != nil) fprintf(stderr, "\nBacktrace:\n %s\n\n", [[backtrace componentsJoinedByString: @"\n "] UTF8String]); abort(); } #endif static void enumeration_mutation_handler(id object) { |
︙ | ︙ |
Modified tests/TestsAppDelegate.m from [dbb5e73795] to [3d02f5dcdc].
︙ | ︙ | |||
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | */ #include "config.h" #include <stdlib.h> #import "OFString.h" #import "OFStdIOStream.h" #import "OFFile.h" #import "OFAutoreleasePool.h" #import "TestsAppDelegate.h" #ifdef _PSP # include <pspmoduleinfo.h> # include <pspkernel.h> # include <pspdebug.h> | > > > | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | */ #include "config.h" #include <stdlib.h> #import "OFString.h" #import "OFArray.h" #import "OFStdIOStream.h" #import "OFFile.h" #import "OFAutoreleasePool.h" #import "OFException.h" #import "TestsAppDelegate.h" #ifdef _PSP # include <pspmoduleinfo.h> # include <pspkernel.h> # include <pspdebug.h> |
︙ | ︙ | |||
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | return of_application_main(&argc, &argv, [TestsAppDelegate class]); } @catch (id e) { TestsAppDelegate *delegate = [[OFApplication sharedApplication] delegate]; OFString *string = [OFString stringWithFormat: @"\nRuntime error: Unhandled exception:\n%@\n", e]; [delegate outputString: string inColor: RED]; [delegate outputString: @"Press home button to exit!\n" inColor: NO_COLOR]; for (;;) { WPAD_ScanPads(); if (WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME) [OFApplication terminateWithStatus: 1]; | > > > > > > > > | 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | return of_application_main(&argc, &argv, [TestsAppDelegate class]); } @catch (id e) { TestsAppDelegate *delegate = [[OFApplication sharedApplication] delegate]; OFString *string = [OFString stringWithFormat: @"\nRuntime error: Unhandled exception:\n%@\n", e]; OFString *backtrace = [[e backtrace] componentsJoinedByString: @"\n "]; [delegate outputString: string inColor: RED]; if (backtrace != nil) { backtrace = [OFString stringWithFormat: @"\nBacktrace:\n %@\n\n", backtrace]; [delegate outputString: backtrace inColor: RED]; } [delegate outputString: @"Press home button to exit!\n" inColor: NO_COLOR]; for (;;) { WPAD_ScanPads(); if (WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME) [OFApplication terminateWithStatus: 1]; |
︙ | ︙ |