Xcode debugger sometimes doesn't display variable values?

后端 未结 19 2097
醉话见心
醉话见心 2020-12-14 13:54

This happens to me pretty often. For example, right now I have the debugger stopped at a breakpoint in a method . . . and it isn\'t displaying any variable values at all.

相关标签:
19条回答
  • 2020-12-14 14:27

    For Swift mix OC Project which use pod

    Fixing it by removing useless header(that import with framework by pod) xx-Bridging-Header.h

    eg. In the past I import header with #import "GCDAsyncSocket.h" which I was added in podfile

    platform:ios, '8.0' use_frameworks! target "roocontrollerphone" do pod 'CocoaAsyncSocket' end

    just remove it in that xx-Bridging-Header.h file

    0 讨论(0)
  • 2020-12-14 14:27

    You need to disable two types of build optimizations in the build settings. By default, the "swift compiler - code generation" optimization level for debug build is set to fast. You need to set this to none. Also check that the "apple llvm 7.1 - code generation" optimization is set to none for debug build. Finally, check that you are building the debug build in the "architectures" section of your build settings.

    Hope this helps.

    0 讨论(0)
  • 2020-12-14 14:31

    I know this is old, but i ran into same problem too. I could not see any summaries of any objects, just types and some address code. After 4 hours of struggling with compilers, debuggers and other solutions i was about to give up when by accident i found this option in debugger. "Show Summaries". Just by clicking it everything got fixed and now i see all variable summaries!

    enter image description here

    0 讨论(0)
  • 2020-12-14 14:33

    I've had similar issues using LLDB. Switching it back to GDB seems to address it. Obviously this isn't solving the problem, but its a workaround anyway

    0 讨论(0)
  • 2020-12-14 14:34

    I had this issue (using Swift), I spent ages crawling through my git commits to find where to problem started.


    For me, I was using Facebook Tweaks library, but I was (unnecessarily) importing it from my project-bridging-header.h file.

    Once I got rid of it, I got my debugging back.

    for example, in my bridging header I had:

    #ifndef PROJECT_Bridging_Header_h
    #define PROJECT_Bridging_Header_h
    // Facebook Tweaks
    #import "FBTweak.h"
    #import "FBTweakStore.h"
    #import "FBTweakCategory.h"
    #import "FBTweakCollection.h"
    #import "FBTweakViewController.h"
    #import "FBTweakShakeWindow.h"
    #endif
    

    I removed all the imports and just imported it as usual in my AppDelegate import Tweaks.

    e.g:

    #ifndef PROJECT_Bridging_Header_h
    #define PROJECT_Bridging_Header_h
    // Removed Facebook Tweaks
    #endif
    

    and in my AppDelegate.swift

    import Tweaks
    

    This fixed all my debugging issues, everything works as expected and I can also using Facebook Tweaks.

    Note: I don't think this is an issue with Facebook Tweaks itself, you may have some other library causing the same issue. The idea is to remove things from your bridging-header one by one and see if you can narrow down the issue.

    I think I read somewhere that if a library is causing many issues behind the scenes, this can stop your debugger working.

    If this doesn't help, try crawling through your git commits and see at what stage the debugging stopped.

    other similar issues on SO:

    Xcode Debugging not showing values

    Xcode debugger doesn't display variable information after installing CocoaPods Podfile

    If you're having similar issues hope this helps!

    0 讨论(0)
  • 2020-12-14 14:36

    For me it works changing the content of display variables panel to Local Variables and then back to Auto.

    This solution worked on XCode 6.3.2, Swift type project.

    0 讨论(0)
提交回复
热议问题