Re: How many bytes is an instruction?
Re: How many bytes is an instruction?
- Subject: Re: How many bytes is an instruction?
- From: Eric Long <email@hidden>
- Date: Wed, 24 Jul 2013 20:54:50 +0000
- Thread-topic: How many bytes is an instruction?
> I've got a crash log without good symbolication. It shows the crash as
> myMethod:+657.
Here are some notes I have about gleaning useful information from Mac crash
logs. This was with gdb. May need adjustment with lldb.
Apple has a tech note on crash logs: TN2123
https://developer.apple.com/library/mac/#technotes/tn2004/tn2123.html
Here is a summary of how to resolve line numbers from Mac crash logs.
In a Mac crash log, you get a stack trace that looks something like this:
Thread 15 Crashed:
0 ...ySoftwareCompany.FooApp 0x00008e3b FileLister::GetNextFile() + 63
1 ...ySoftwareCompany.FooApp 0x001e882e
FooServer::RestCmdHandler_continueSearch(CConnection*) + 380
2 ...ySoftwareCompany.FooApp 0x001e85f7
FooServer::RestCmdHandler_search(CConnection*) + 2059
3 ...ySoftwareCompany.FooApp 0x001d5dda FooServer::HandleCommand(BString&,
CConnection*) + 1440
4 ...ySoftwareCompany.FooApp 0x001d57ef
FooServer::RestCmdHandler(mg_connection*, mg_request_info const*, void*) +
147
5 ...ySoftwareCompany.FooApp 0x001d94cf analyze_request + 1639
6 ...ySoftwareCompany.FooApp 0x001d85b8 worker_thread + 1015
7 libSystem.B.dylib 0x9aa64259 _pthread_start + 345
8 libSystem.B.dylib 0x9aa640de thread_start + 34
Getting the function name where an error occurred is very useful, but
getting the line number would be even more helpful. You can do this if you
have a copy of the build the crash occurred in and the dsym file for that
build.
Here's how:
Place the dsym file and the application from the build in which the crash
occurred into the same folder.
1. Open the Terminal and type:
cd [PATH TO FOLDER]
gdb Foo.app
2. Next, copy the address from the log. In the example above the crash
occurred at 0x00008e3b.
Enter the address in gdb like so:
info line *0x00008e3b
You should see output like this:
Line 52 of "/Volumes/Source/FooApp/build/xcode/../..//Filelister.mm" starts
at address 0x100007d96 <_ZN13FileLister11GetNextFileEv+60>
and ends at 0x100007da9 <_ZN13LFileLister11GetNextFileEv+79>.
If you don't have the matching dsym file, you can still get close to the
line you need with a little work.
In the above crash we see that crash occurred at FileLister::GetNextFile() +
63. In our dsym the address won't be 0x00008e3b. So, we need to get the
address of the first line of FileLister::GetNextFile().
If you have a current dsym for your sources, you can go look for:
char *FileLister::GetNextFile() in Filelister.mm. If the method starts at
line 48, you can go to the terminal as above and enter gdb.
Type:
info line Filelister_macos.mm:48
And get output like this:
Line 49 of "/Volumes/Source/FooApp/build/xcode/../..//Filelister.mm" starts
at address 0x100007d5a <_ZN13FileLister11GetNextFileEv>
and ends at 0x100007d6b <_ZN13FileLister11GetNextFileEv+17>.
2. Now the offset must be added to the address 0x100007d5a. The offset is
decimal. Calculator.app contains a Programmer's Calculator you can use (see
the View menu in the app) or you could use the bash terminal:
shell echo $[0x100007d5a + 63]
4294999449
shell printf "%x\n" 4294999449
100007d99
63 converts to 3F. 0x100007d5a + 0x3F = 0x100007D99.
3. However you choose to calculate the address, once you have it, enter it
in gdb:
info line *0x100007D99
Line 52 of "/Volumes/Source/FooApp/build/xcode/../..//Filelister.mm" starts
at address 0x100007d96 <_ZN13FileLister11GetNextFileEv+60>
and ends at 0x100007da9 <_ZN13FileLister11GetNextFileEv+79>.
If the file has been modified since the version the crash came from, the
line may not be the same where the crash occurred, but it could be close
enough to help you look for the problem.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden