Re: Mysterious Snow Crash
Re: Mysterious Snow Crash
- Subject: Re: Mysterious Snow Crash
- From: "Gerriet M. Denkmann" <email@hidden>
- Date: Thu, 24 Sep 2009 12:52:16 +0700
On 24 Sep 2009, at 09:12, Kyle Sluder wrote:
On Wed, Sep 23, 2009 at 6:59 PM, Graham Cox <email@hidden>
wrote:
(gdb) po *(id*)($ebp+4)
Of course this will only work when building i386, not x86_64.
On x86_64, I would break on _LSAcquireIconRefForURL and do `po $rdi`.
Looking at the disassembly, the first thing it does is load a constant
string object (@"_NSURLBindingKey") into $rsi before calling
CFURLCopyResourcePropertyForKey. If at this point $rdi doesn't point
at a valid CFURL object, it's going to blow up.
I added a breakpoint: _LSAcquireIconRefForURL() but it does not stop
there.
It stops at the EXC_BAD_ACCESS:
#0 0x00007fff84babf45 in _LSAcquireIconRefForURL ()
0x00007fff84babf1f <+0000> push %rbp
0x00007fff84babf20 <+0001> mov %rsp,%rbp
0x00007fff84babf23 <+0004> push %rbx
0x00007fff84babf24 <+0005> sub $0x18,%rsp
0x00007fff84babf28 <+0009> lea -0x18(%rbp),%rdx
0x00007fff84babf2c <+0013> mov %rsi,%rcx
0x00007fff84babf2f <+0016> lea -0x142bcf5e(%rip),%rsi #
0x7fff708eefd8
0x00007fff84babf36 <+0023> callq 0x7fff84bac39e
<dyld_stub_CFURLCopyResourcePropertyForKey>
0x00007fff84babf3b <+0028> xor ëx,ëx
0x00007fff84babf3d <+0030> test %al,%al
0x00007fff84babf3f <+0032> je 0x7fff84babf5b
<_LSAcquireIconRefForURL+60>
0x00007fff84babf41 <+0034> mov -0x18(%rbp),%rbx
0x00007fff84babf45 <+0038> mov 0x10(%rbx),%rdi <-----
EXC_BAD_ACCESS
(gdb) p/x $rsi
$1 = 0x1004795d0
(gdb) po $rsi
<_FileCache 0x1004795d0 [0x7fff708e1f00]>
(gdb) p/x $rbx
$2 = 0x0
(gdb) p/x $rbp
$3 = 0x7fff5fbfdf50
(gdb) p/x $rdi
$4 = 0x1004795f0
---------------------------
I then ran the program without debugger to get a crash log:
Code Type: X86-64 (Native)
Parent Process: launchd [113]
Date/Time: 2009-09-24 12:00:36.938 +0700
OS Version: Mac OS X 10.6.1 (10B504)
Report Version: 6
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000010
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Thread 0 Crashed: Dispatch queue: com.apple.main-thread
0 com.apple.LaunchServices 0x00007fff84babf45
_LSAcquireIconRefForURL + 38
1 com.apple.LaunchServices 0x00007fff84bab23c
LSSharedFileListInsertItemURL + 388
2 com.apple.AppKit 0x00007fff83e7e1d8 -
[NSDocumentController _notePendingRecentDocumentURLsForKey:] + 497
3 com.apple.Foundation 0x00007fff82b50500
__NSFireDelayedPerform + 404
4 com.apple.CoreFoundation 0x00007fff84a0ca78 __CFRunLoopRun +
5480
5 com.apple.CoreFoundation 0x00007fff84a0b03f
CFRunLoopRunSpecific + 575
6 com.apple.HIToolbox 0x00007fff82552c4e
RunCurrentEventLoopInMode + 333
7 com.apple.HIToolbox 0x00007fff82552a53
ReceiveNextEventCommon + 310
8 com.apple.HIToolbox 0x00007fff8255290c
BlockUntilNextEventMatchingListInMode + 59
9 com.apple.AppKit 0x00007fff83b46520 _DPSNextEvent +
718
10 com.apple.AppKit 0x00007fff83b45e89 -[NSApplication
nextEventMatchingMask:untilDate:inMode:dequeue:] + 155
11 com.apple.AppKit 0x00007fff83b0ba7d -[NSApplication
run] + 395
12 com.apple.AppKit 0x00007fff83b04798
NSApplicationMain + 364
13 de.mdenkmann.HFSChecker 0x0000000100002d07 main + 33
(main.m:14)
14 de.mdenkmann.HFSChecker 0x00000001000011fc start + 52
Thread 0 crashed with X86 Thread State (64-bit):
rax: 0x0000000000000001 rbx: 0x0000000000000000 rcx:
0x00007fff5fbfe428 rdx: 0x0000000000000001
rdi: 0x000000010042fa20 rsi: 0x000000010042fa00 rbp:
0x00007fff5fbfe440 rsp: 0x00007fff5fbfe420
r8: 0x00007fff5fbfe388 r9: 0x0000000000000001 r10:
0x00007fff84b3ff24 r11: 0x0000000100432ab0
r12: 0x0000000000000001 r13: 0x0000000100432ab0 r14:
0x0000000000000001 r15: 0x00007fff708bd330
rip: 0x00007fff84babf45 rfl: 0x0000000000010202 cr2:
0x0000000000000010
------------------------
The problem is, I don't speak assembler. I tought me some basics about
PowerPC some time ago, but have never looked at Intel.
I seem to remember that Xcode had a link to the assembler manual, but
now that I need them, I cannot find anything.
Any ideas what I could try next?
When the crash happens, my document window is visible, contains all
the right information, has the correct name, but NO icon yet.
Looks like creating the icon crashes my app.
The document path is something like: "/dev/rdisk1s10" and on Leopard
there is a rather generic icon: just a white rectangle.
I added:
- (id)initWithContentsOfURL:(NSURL *)absoluteURL ofType:(NSString *)
typeName error:(NSError **)outError
{
.....
#ifdef DEBUG
NSLog(@"%s setting url to Downloads; was %@",__FUNCTION__, [self
fileURL]);
// was: file://localhost/dev/rdisk1s10
NSURL *uu = [ NSURL fileURLWithPath: @"/Volumes/เม่น/Users/
gerriet/Downloads" ];
[ self setFileURL: uu ];
NSLog(@"%s done %@",__FUNCTION__, [self fileURL]);
#endif
return self ;
}
Now I have no crash (which is good), but the fileURL of my document is
wrong, as is it's title and icon, which probably will create problems
later on.
Kind regards,
Gerriet.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden