Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix Xcode 10.0 debugger, it is not fully functioning?

After upgrading to Xcode 10.0 the debugger is failing to perform basic functions. It's possible the debugger problems are unrelated to the upgrade to 10.0 but I suspect this as the catalyst.

Symptoms:

  • Breakpoints are breaking properly
  • The "local variables" area (not sure if this is the proper term) lists local variables but cannot provide any info on them. Attempting something like "Print description of x" The result is an error message:
Printing description of x
x = <could not resolve type>

Followed by:

note: Swift compiler options for ProjectX conflict with options 
found in other modules;
 Switching to a new expression evaluator for ProjectX, old $R 
variables are lost.
  • when selecting "view memory of x" for any given variable, the "memory view" appears, but the address is "0x0" and there is absolutely zero content in the view.

  • Using the (lldb) interface directly, when I try to print a variable, i.e. po x to print the variable "x" I'm first given the message above about switching to a new expression evaluator, but upon second execution of the same print command po x, a different error is presented as

    error: Swift expressions require OS X 10.10 / iOS 8 SDKs or later.
    

Yes, I am on OS X 10.13 and my iOS SDK is 12.0 and I've simulated various devices iPad 6, pro 2, air 2, iPhone X, debugger has exact same symptoms on all devices.

Attempted fixes:

  • I've tried re-cloning my repository in a new location to import a new workspace in a new location.
  • Deleted DerivedData and rebooted Xcode many times
  • Uninstalled and re-installed Xcode
  • Cleaned and re-built everything
  • Restarted computer
like image 681
David Avatar asked Oct 09 '18 20:10

David


People also ask

How do I run the debugger in Xcode?

When you run an application in Xcode, the debugger is automatically started and attached to the process of the application. Click the Run button in the top left or press Command + R. From the moment the application is up and running, we can start inspecting the process and, if necessary, debug it.

How do I print a variable in Xcode?

If the variable is an image or other type that isn't expressible as text, click the Quick Look button at the upper-right to see a preview of the variable. Click the Print Description button to print a description of the object in the console.

How do you evaluate expressions in Xcode?

Evaluate a C/ObjC/C++ expression in the current program context, using user defined variables and variables currently in scope. This command takes 'raw' input (no need to quote stuff). -G <gdb-format> ( --gdb-format <gdb-format> ) Specify a format using a GDB format specifier string.


2 Answers

I upgraded my Cocoapod version to 1.6.0.beta.2 and my debugger works now. Seems like CommonCrypto is the causing the issue

like image 192
chlkdst Avatar answered Sep 23 '22 11:09

chlkdst


Fixed

In the case of my project, it was caused by the inclusion of a CommonCrypto wrapper which was included as a framework in one of my modules. From what I understand, this caused some conflict with the crypto modules now included with iOS

This is a long-lived project and this CommonCrypto framework is now deprecated for us by the facilities provided in more recent Apple frameworks. With the CommonCrypto framework removed debugging started working again.

like image 24
David Avatar answered Sep 21 '22 11:09

David