Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
702 views
in Technique[技术] by (71.8m points)

objective c - lldb fails to print variable values with "error: reference to 'id' is ambiguous"

Since I updated to xcode 4.3 and let it switch my debugger over to lldb, any request to print a member variable fails with this error message:

(lldb) print request
error: error: reference to 'id' is ambiguous
note: candidate found by name lookup is 'id'
note: candidate found by name lookup is 'id'
error: 1 errors parsing expression

'self' is ok:

(lldb) print self
(LoginViewController *) $6 = 0x1cd54d50

And other forms of printing the member variable also fail:

(lldb) print self.request
error: property 'request' not found on object of type 'LoginViewController *'; did you mean to access ivar 'request'?
error: 1 errors parsing expression
(lldb) print self->request
error: error: reference to 'id' is ambiguous
note: candidate found by name lookup is 'id'
note: candidate found by name lookup is 'id'
error: 1 errors parsing expression

Everything else otherwise seems to be working fine. Xcode's variable window can correctly retrieve the value. I've tried a clean build and deleting ~/Library/Developer/Xcode/DerivedData/. Googling hasn't revealed any other instances of the same problem.

I found one thread on Apple's dev forum but no solution:

https://devforums.apple.com/message/623694

I've reported this to Apple as Bug ID# 11029004.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I found one workaround:

Use 'Edit scheme' under the 'Product' menu, select 'Run' in the left bar, the 'Info' tab, and change the Debugger to gdb (this does not apply to xcode 5, which no longer has gdb).

Apparently Apple thought they'd fixed this bug in xcode 4.3.1, but it still happens. I submitted some extra debug information they requested, so I'm hoping it'll be fixed for the next release of xcode. It's still failing in 4.3.2. See https://devforums.apple.com/message/623694 for an update from Apple.

UPDATE

I've tried various cases I was having trouble with, and they all seem to be working fine with lldb in Xcode 4.4.1 - hence I highly recommend upgrading if you're having this problem.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...