Koen
Koen

Reputation: 1082

lldb strange error

I am using xCode 4.3.1 and as soon I want to use lldb, I hardly get any debug information but get the following result instead, po-ing on a simple NSMutableDictionary property:

(lldb) po _keywordCache
error: instance method 'delegate' has incompatible result types in different translation units ('objc_object *' vs. 'id')
error: instance method 'delegate' has incompatible result types in different translation units ('objc_object *' vs. 'id')
note: instance method 'delegate' also declared here
note: declared here with type 'id'
note: instance method 'delegate' also declared here
note: declared here with type 'id'
error: 2 errors parsing expression

Switching to gdb always gives proper results.
Anyone an idea?

Upvotes: 21

Views: 4421

Answers (4)

user8030
user8030

Reputation: 123

I have the same problem in Xcode 7.3 (7D1002) since yesterday. Before it worked fine for weeks. In my case now even a simple "po someString" doesn't work:
    error: instance method 'URLEncodedString' has incompatible result types in different translation units ('void *' vs. 'NSString *')
    error: instance method 'URLDecodedString' has incompatible result types in different translation units ('void *' vs. 'NSString *')
    note: instance method 'URLEncodedString' also declared here
    note: instance method 'URLDecodedString' also declared here
    error: 2 errors parsing expression

Things I tried:

  • quit and relaunch Xcode7 and the simulator (they were both running since several days without relaunch)
  • Xcode:Product->Clean and (holding the option key) Clean build folder
  • Delete ~/Library/Preferences/com.apple.dt.Xcode.plist
  • Delete ~/Library/Developer/Xcode/DerivedData/*
  • Delete ~/Library/Developer/Xcode/iOS DeviceSupport/*
  • Install the latest OS X El Capitan Update 10.11.4

but all that didn’t help. Still can neither p nor po strings in the debugger.

I still have an old Xcode 6 on my Mac (renamed and put away before installation of Xcode 7, then put back in /Applications). And that still works, I can enter “po someString” in the debugger and it prints the string into the debug log. But Xcode 7 doesn´t…

I found a workaround for local variables (even though this problem is different) here:
http://lists.apple.com/archives/xcode-users/2014/May/msg00088.html
ctrl-click on variable in local variables list and choose “print description”
    Printing description of someString:
    ipad

which helps a little but cannot print more complex commands.

Upvotes: 1

migs647
migs647

Reputation: 847

I know this is late, but ran into this on Xcode 6, needed to do a Clean Build Folder (hold down option while selecting clean).

Upvotes: 1

user3597140
user3597140

Reputation: 41

I also had that error, for me it actually had nothing wrong with the code though. All i did was click the button on the right of the "Toggle global breakpoint state" button in the console.

It is the blue arrow shaped button.
It is the blue, arrow-shaped button.

Upvotes: -1

danielpunkass
danielpunkass

Reputation: 17587

The source of the problem in my case was that the property in question here, "delegate" is declared as a subtly different type in the instance variable and the property declaration. In my case, the instance variable type was id and the property declaration was id<SomeProtocol>.

I'm going to report this as a bug to Apple, as it shouldn't cause failure to inspect variables. The fix is to make sure that the instance variable and the property declaration describe "delegate" as exactly the same type. Hope this helps!

Upvotes: 8

Related Questions