Xcode debugger sometimes doesn't display variable values?

后端 未结 19 2099
醉话见心
醉话见心 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:37

    You can get the value of any variable in the console by writing:

    po name_of_an_objectCVar
    

    or

    print name_of_a_cVar
    
    0 讨论(0)
  • 2020-12-14 14:37

    I've had the same issue and I fixed it by reinstalling all Pods. Just delete them and install again.

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

    I figured out why it is not working in XCode 4.6 - all of the variables in my object, self, were declared in the .m file instead of the .h. When I moved one of them back to the .h file, it showed up in the debugger. Sounds like a bug with XCode in that it cannot "see" variables declared in the implementation file.

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

    Had the same issue using Xcode 6.4 running the app on device. Running on simulator will show all variables on debugging variables panel.

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

    There is a situation I have seen where Xcode can't cope with return value optimisation (RVO) -- if the compiler decides to apply RVO to a variable then it may not appear in the variables list. You can disable this in g++ and clang with the compiler flag -fno-elide-constructors

    See also Understanding eliding rules with regard to c++11

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

    The most common reason for this is that you're trying to debug code compiled with optimisation enabled and/or no debug symbols. Typically this will be because you're trying to debug a Release build rather than a Debug build but it can also happen with Debug builds if you've made inappropriate changes to the Debug build settings.

    Another less common possibility is that you've hosed the stack.

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