diff options
author | Max <post@wickenrode.com> | 2015-08-06 23:29:50 +0200 |
---|---|---|
committer | Max <post@wickenrode.com> | 2015-08-06 23:29:50 +0200 |
commit | 5befad85ccd6d22900942ea73f4018d71038f516 (patch) | |
tree | e4140be1b430cd1c6e94db9db94f2b424e28b681 | |
parent | de84dc3f4beaa370d1a8bfe02df41cfe450f59b2 (diff) | |
download | sequelpro-5befad85ccd6d22900942ea73f4018d71038f516.tar.gz sequelpro-5befad85ccd6d22900942ea73f4018d71038f516.tar.bz2 sequelpro-5befad85ccd6d22900942ea73f4018d71038f516.zip |
* Expand the debugging code from prev. commit
* Also Sequel Pro will now crash on the "Attempted to connect a connection that is not disconnected" issue. That is sadly necessary to get a stack trace of ALL threads as for exceptions Feedback Reporter only gives us the current thread.
-rw-r--r-- | Frameworks/SPMySQLFramework/Source/SPMySQLConnection.m | 7 | ||||
-rw-r--r-- | Source/SPObjectAdditions.m | 21 |
2 files changed, 26 insertions, 2 deletions
diff --git a/Frameworks/SPMySQLFramework/Source/SPMySQLConnection.m b/Frameworks/SPMySQLFramework/Source/SPMySQLConnection.m index d212867a..dfe4802f 100644 --- a/Frameworks/SPMySQLFramework/Source/SPMySQLConnection.m +++ b/Frameworks/SPMySQLFramework/Source/SPMySQLConnection.m @@ -424,6 +424,11 @@ const char *SPMySQLSSLPermissibleCiphers = "DHE-RSA-AES256-SHA:AES256-SHA:DHE-RS #pragma mark - #pragma mark Private API +//http://alastairs-place.net/blog/2013/01/10/interesting-os-x-crash-report-tidbits/ +/* CrashReporter info */ +const char *__crashreporter_info__ = NULL; +asm(".desc ___crashreporter_info__, 0x10"); + @implementation SPMySQLConnection (PrivateAPI) /** @@ -434,6 +439,8 @@ const char *SPMySQLSSLPermissibleCiphers = "DHE-RSA-AES256-SHA:AES256-SHA:DHE-RS // If a connection is already active in some form, throw an exception if (state != SPMySQLDisconnected && state != SPMySQLConnectionLostInBackground) { + asprintf(&__crashreporter_info__, "Attempted to connect a connection that is not disconnected (SPMySQLConnectionState=%d).", state); + __builtin_trap(); [NSException raise:NSInternalInconsistencyException format:@"Attempted to connect a connection that is not disconnected (SPMySQLConnectionState=%d).", state]; return NO; } diff --git a/Source/SPObjectAdditions.m b/Source/SPObjectAdditions.m index 4f2eef1e..c211809e 100644 --- a/Source/SPObjectAdditions.m +++ b/Source/SPObjectAdditions.m @@ -48,13 +48,24 @@ [msg appendFormat:@"%s tripped!\n\n",__PRETTY_FUNCTION__]; +retryDescribe: [msg appendFormat:@"passed object (class <%@>): %@\n\n",[obj className],obj]; + if ([obj isKindOfClass:[NSNotification class]]) { + NSNotification *notif = (NSNotification *)obj; + [msg appendFormat:@"unwrapping NSNotification named '%@' (userInfo=%@)\n\n", + [notif name], + [notif userInfo]]; + obj = [notif object]; + goto retryDescribe; + } + if([obj isKindOfClass:[NSView class]]) { - [msg appendString:@"View hierarchy:\n"]; + [msg appendString:@"View hierarchy (parents):\n"]; id parent = obj; while(parent) { - [msg appendFormat:@"- (class <%@>): %@, id=%@, tag=%ld\n", + [msg appendFormat:@"- %p (class <%@>): %@, id=%@, tag=%ld\n", + obj, [obj className], obj, [(NSView *)obj identifier], @@ -62,6 +73,12 @@ parent = [parent superview]; } [msg appendString:@"\n"]; + + [msg appendString:@"View hierarchy (own children): \n"]; + for (id child in [(NSView *)obj subviews]) { + [msg appendFormat:@"- %p\n",child]; + } + [msg appendString:@"\n"]; } if([obj respondsToSelector:@selector(window)]) { |