realm / realm-swift

Realm is a mobile database: a replacement for Core Data & SQLite
https://realm.io
Apache License 2.0
16.29k stars 2.14k forks source link

Issue with symbolication when using prebuilt Realm binaries in Xcode #4996

Closed saham closed 7 years ago

saham commented 7 years ago

Goals

Symbolicate crash log

Expected Results

Gives me file name,function name, and line number where crash happaned

Actual Results

I see everything is symbolicated except where it has my app name and some realm stuff

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note:  EXC_CORPSE_NOTIFY
Triggered by Thread:  0
Backtrace:
2   Realm                           0x100296214 0x10024c000 + 303636
3   Realm                           0x10029346c 0x10024c000 + 291948
4   RealmSwift                      0x1017b7a90 0x101798000 + 129680
5   APP_NAME                        0x100101dd0 0x1000a4000 + 384464
6   APP_NAME                        0x100101f0c 0x1000a4000 + 384780
37  APP_NAME                        0x1000fb808 0x1000a4000 + 358408
Thread 0:
12  APP_NAME                        0x00000001000fb808 0x1000a4000 + 358408

Steps to Reproduce

Code Sample

Version of Realm and Tooling

Realm framework version: 2.5.0

Realm Object Server version: ?

Xcode version: 8.3

iOS/OSX version: 10.

Dependency manager + version: ?

bdash commented 7 years ago

You'll need to provide more information than that if there's to be any chance we can help you.

saham commented 7 years ago

My question is in general?,how to symbolicate a crash file when realm is used? Thank you

bdash commented 7 years ago

If you're not seeing any symbols from your app or frameworks it embeds, something is likely misconfigured in your Xcode project (perhaps you're stripping the binaries, or the .dSYM files related to your app have gone missing). The fact it's affecting your app itself strongly suggests this isn't a Realm issue.

If you're seeing symbols from the Realm frameworks but no line numbers, that may be because you're embedding the prebuilt version of the Realm frameworks that we provide. These prebuilt frameworks are released without debug symbols to reduce the file size.

saham commented 7 years ago

Thank you. As you can see, it shows some references to realm follwed by memory address. What version of realm is NOT prebuilt? So i can use that one

bdash commented 7 years ago

Building Realm from source, whether manually or via CocoaPods or Carthage, would give you the ability to include debug symbols. However, since you're not even seeing symbol names, Realm being prebuilt isn't your immediate issue. Prebuilt Realm frameworks includes symbol names, but not the extra debug information that would provide line numbers. Something else is misconfigured if you're not even seeing function names.

saham commented 7 years ago

Thanks bdash for your detailed answer. Would you please guide me to properly configure Xcode so I can get more details in crash log.If I can get Function name, I should be able to figure out where the error is sittong Once that part is done, I'll go for prebuilt realm.

jpsim commented 7 years ago

Although we're happy providing free support for our products, general Xcode usage questions are out of our scope.

That being said, I just created a sample Xcode project when helping a different user on Stack Overflow with an unrelated question, and it happens to use our prebuilt binary frameworks and I could confirm that the framework is properly symbolicated. You can download it here: https://static.realm.io/debug/SO44298696.tgz

I just created a fresh Xcode project using Xcode 8.3.2 and the "Single View" iOS app template, then I added a Cartfile with the contents of github "realm/realm-cocoa", ran carthage update. Then I dragged all the files from Carthage/Build/iOS into the "Embedded Libraries" section of the app's Xcode pane:

19C518E0-71C7-3532-8BBD-6DF2E95AC01A.bcsymbolmap
1D647BBE-369E-36F2-B0F3-BAF951565410.bcsymbolmap
9111B619-4D7E-35C8-98D8-2207417FC7B0.bcsymbolmap
CC4BF2EA-604F-3A43-862C-FEE4138C99B7.bcsymbolmap
Realm.framework
Realm.framework.dSYM
RealmSwift.framework
RealmSwift.framework.dSYM

From that point on, stopping a breakpoint or a crash could reveal the backtrace of what Realm was doing, including symbolicated frames. For example:

bt
* thread #4, queue = 'realm', stop reason = step in
  * frame #0: 0x0000000106b3267f Realm`check_read_write(realm=0x00007f98f551e470) at shared_realm.cpp:497 [opt]
    frame #1: 0x0000000106b324e3 Realm`realm::Realm::begin_transaction(this=0x00007f98f551e470) at shared_realm.cpp:533 [opt]
    frame #2: 0x0000000106b0e70b Realm`::-[RLMRealm beginWriteTransaction](self=<unavailable>, _cmd=<unavailable>) at RLMRealm.mm:530 [opt]
    frame #3: 0x0000000106941718 RealmSwift`RealmSwift.Realm.write (() throws -> ()) throws -> () at Realm.swift:184
    frame #4: 0x00000001068601e5 SO44298696`ViewController.(id="E3E88AAC-E7F3-4209-B242-870A82E8A789") -> ()).(closure #1) at ViewController.swift:100
    frame #5: 0x0000000106860527 SO44298696`thunk at ViewController.swift:0
    frame #6: 0x000000010a49d4a6 libdispatch.dylib`_dispatch_call_block_and_release + 12
    frame #7: 0x000000010a4c605c libdispatch.dylib`_dispatch_client_callout + 8
    frame #8: 0x000000010a4a494f libdispatch.dylib`_dispatch_queue_serial_drain + 221
    frame #9: 0x000000010a4a5669 libdispatch.dylib`_dispatch_queue_invoke + 1084
    frame #10: 0x000000010a4a5b32 libdispatch.dylib`_dispatch_queue_override_invoke + 654
    frame #11: 0x000000010a4a7ec4 libdispatch.dylib`_dispatch_root_queue_drain + 634
    frame #12: 0x000000010a4a7bef libdispatch.dylib`_dispatch_worker_thread3 + 123
    frame #13: 0x000000010a85d5a2 libsystem_pthread.dylib`_pthread_wqthread + 1299
    frame #14: 0x000000010a85d07d libsystem_pthread.dylib`start_wqthread + 13

I hope this is of help to you, but for future inquiries about how to use Xcode, please post to Stack Overflow. Thanks.