Updates

Symbols, Crash Log, Xcode, Crashes and Tooltips. Yes, TOOLTIPS.

One of the issues that I would occasionally get in the Winclone forums is a crash log that looks like this:

8/30/12 5:39:05.279 PM Winclone: -[__NSCFNumber isEqualToString:]: unrecognized selector sent to instance 0x7fffff000c3
8/30/12 5:39:05.283 PM Winclone: (
...

5 Winclone 0x0000000100006ace Winclone + 27342

...

It was a bit frustrating, because I didn’t have the full crash log, and XCode didn’t help much with trying to symbolicate this crash. The issue only happened occasionally, and was never reported directly as a crash. It was always associated with some other issues. Usually that other issue was the fact that Winclone failed to restore successfully, but when trying a second time to restore, it would work. I recently got this in a log, and decided to spend some time tracking it down. After a bit of searching, I found this excellent post:

http://www.cocoabuilder.com/archive/xcode/312725-can-symbolicate-crash-reports.html#312825

Jerry Krinock outlines how to use the symbol file to figure out the line number for frameworks and other things, but I just needed it for my app. Since I used the Xcode feature of “Archive” to do a final compile for Winclone, I had the symbol file and the associated binary:

Using these files and the posting, I fired up GDB:

power:Winclone 7-2-12 4.59 PM.xcarchive tperfitt$ gdb
GNU gdb 6.3.50-20050815 (Apple version gdb-1820) (Sat Jun 16 02:40:11 UTC 2012)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin".

I then read in the App:
(gdb) file /Users/tperfitt/Library/Developer/Xcode/Archives/2012-07-02/BuildAll 7-2-12 5.07 PM.xcarchive/Products/Applications/Winclone.app

Reading symbols for shared libraries ……….. done
Reading symbols from /Users/tperfitt/Library/Developer/Xcode/Archives/2012-07-02/BuildAll 7-2-12 5.07 PM.xcarchive/Products/Applications/Winclone.app/Contents/MacOS/Winclone…Reading symbols from /Users/tperfitt/Library/Developer/Xcode/DerivedData/Winclone_3-evmawjbqcaliofgyjctvjkncqjvi/Build/Intermediates/ArchiveIntermediates/BuildAll/BuildProductsPath/Release/Winclone.app.dSYM/Contents/Resources/DWARF/Winclone…done.

Now I add the symbols. Probably not needed since it will be found by spotlight, but since I have then and know where they are, leaving nothing to chance

(gdb) add-dsym /Users/tperfitt/Library/Developer/Xcode/Archives/2012-07-02/BuildAll 7-2-12 5.07 PM.xcarchive/dSYMs/Winclone.app.dSYM

Added dsym “/Users/tperfitt/Library/Developer/Xcode/Archives/2012-07-02/BuildAll 7-2-12 5.07 PM.xcarchive/dSYMs/Winclone.app.dSYM” to “/Users/tperfitt/Library/Developer/Xcode/DerivedData/Winclone_3-evmawjbqcaliofgyjctvjkncqjvi/Build/Intermediates/ArchiveIntermediates/BuildAll/BuildProductsPath/Release/Winclone.app.dSYM/Contents/Resources/DWARF/Winclone”.

Now I grab the address that I need to figure out where it is at in my code:

(gdb) info line *(0x0000000100006ace)

Line 28 of “/Users/tperfitt/Documents/Projects/Winclone 3/Winclone 3/TCDiskTableViewDataSource.m” starts at address 0x100006aa7 <-[TCDiskTableViewDataSource tableView:toolTipForCell:rect:tableColumn:row:mouseLocation:]+183> and ends at 0x100006ad2 <-[TCDiskTableViewDataSource tableView:toolTipForCell:rect:tableColumn:row:mouseLocation:]+226>.

Ah, ha! Now I know I need to look at line 28 of TCDiskTableViewDataSource.m. Firing up XCode, I see this:

- (NSString *)tableView:(NSTableView *)aTableView toolTipForCell: (NSCell *)aCell rect:(NSRectPointer)rect tableColumn:(NSTableColumn *) aTableColumn row:(int)row mouseLocation:(NSPoint)mouseLocation{

if ([currImage.totalSize isEqualToString:@“0”]){

I fall back my chair and think about it. Tooltip? TOOLTIP? This can’t be. Failures of cloning due to a damn tooltip? I dig a bit deeper, set some breakpoints, and OMG. currImage.totalSize is supposed to be an NSString but for certain objects, it is a NSNumber. Putting all the pieces together, I now know what is going on. If a user is running a restore and hovers the mouse over the tooltip for the volume, an error happens in the GUI portion and not the helper tool. The cloning continues until it is done, but when it returns, the process never continues. BECAUSE OF A TOOLTIP. The fix, of course, is easy. Just changed:

volume.totalSize=[diskAttributes objectForKey:NSFileSystemSize];

to

volume.totalSize=[NSString stringWithFormat:@"%lli",[[diskAttributes objectForKey:NSFileSystemSize] longLongValue]];

Meh. Tooltip.