Skip to content

Commit 5befad8

Browse files
committed
* 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.
1 parent de84dc3 commit 5befad8

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

Frameworks/SPMySQLFramework/Source/SPMySQLConnection.m

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,11 @@ + (NSString *)findSocketPath
424424
#pragma mark -
425425
#pragma mark Private API
426426

427+
//http://alastairs-place.net/blog/2013/01/10/interesting-os-x-crash-report-tidbits/
428+
/* CrashReporter info */
429+
const char *__crashreporter_info__ = NULL;
430+
asm(".desc ___crashreporter_info__, 0x10");
431+
427432
@implementation SPMySQLConnection (PrivateAPI)
428433

429434
/**
@@ -434,6 +439,8 @@ - (BOOL)_connect
434439

435440
// If a connection is already active in some form, throw an exception
436441
if (state != SPMySQLDisconnected && state != SPMySQLConnectionLostInBackground) {
442+
asprintf(&__crashreporter_info__, "Attempted to connect a connection that is not disconnected (SPMySQLConnectionState=%d).", state);
443+
__builtin_trap();
437444
[NSException raise:NSInternalInconsistencyException format:@"Attempted to connect a connection that is not disconnected (SPMySQLConnectionState=%d).", state];
438445
return NO;
439446
}

Source/SPObjectAdditions.m

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,20 +48,37 @@ - (void)_scrollViewDidChangeBounds:(id)obj
4848

4949
[msg appendFormat:@"%s tripped!\n\n",__PRETTY_FUNCTION__];
5050

51+
retryDescribe:
5152
[msg appendFormat:@"passed object (class <%@>): %@\n\n",[obj className],obj];
5253

54+
if ([obj isKindOfClass:[NSNotification class]]) {
55+
NSNotification *notif = (NSNotification *)obj;
56+
[msg appendFormat:@"unwrapping NSNotification named '%@' (userInfo=%@)\n\n",
57+
[notif name],
58+
[notif userInfo]];
59+
obj = [notif object];
60+
goto retryDescribe;
61+
}
62+
5363
if([obj isKindOfClass:[NSView class]]) {
54-
[msg appendString:@"View hierarchy:\n"];
64+
[msg appendString:@"View hierarchy (parents):\n"];
5565
id parent = obj;
5666
while(parent) {
57-
[msg appendFormat:@"- (class <%@>): %@, id=%@, tag=%ld\n",
67+
[msg appendFormat:@"- %p (class <%@>): %@, id=%@, tag=%ld\n",
68+
obj,
5869
[obj className],
5970
obj,
6071
[(NSView *)obj identifier],
6172
[(NSView *)obj tag]];
6273
parent = [parent superview];
6374
}
6475
[msg appendString:@"\n"];
76+
77+
[msg appendString:@"View hierarchy (own children): \n"];
78+
for (id child in [(NSView *)obj subviews]) {
79+
[msg appendFormat:@"- %p\n",child];
80+
}
81+
[msg appendString:@"\n"];
6582
}
6683

6784
if([obj respondsToSelector:@selector(window)]) {

0 commit comments

Comments
 (0)