Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add basic Swift support (requires Xcode 6) #68

Merged
merged 1 commit into from
Feb 7, 2015
Merged

Add basic Swift support (requires Xcode 6) #68

merged 1 commit into from
Feb 7, 2015

Conversation

mblsha
Copy link
Contributor

@mblsha mblsha commented Dec 26, 2014

By default expressions are evaluated in current frame's language.

When stopped inside a Swift function, current language is Swift, and it's invalid to use Objective-C syntax: many Chisel functions break as a result.

Explicitly specify Objective-C++ as expression language when evaluating commands.

However one problem will still persist: it's still impossible to use Swift objects by name in Chisel functions. One needs to first convert object names to id pointers using evaluateExpressionValueInFrameLanguage(), but the lldb code to enable that was committed very recently and is still unavailable in Xcode 6.1.1.

By default expressions are evaluated in current frame's language.

When stopped inside a Swift function, current language is Swift, and it's invalid to use Objective-C syntax: many Chisel functions break as a result.

Explicitly specify Objective-C++ as expression language when evaluating commands.

However one problem will still persist: it's still impossible to use Swift objects by name in Chisel functions. One needs to first convert object names to id pointers using evaluateExpressionValueInFrameLanguage(), but the lldb code to enable that was committed very recently and is still unavailable in Xcode 6.1.1.
@kastiglione
Copy link
Contributor

Thank you @mblsha :octocat:

Would you mind signing Facebook's Contributor License Agreement? If you have any questions I'd be happy to help answer. https://code.facebook.com/cla

@mblsha
Copy link
Contributor Author

mblsha commented Jan 3, 2015

Ok, done ;-)

# lldb.frame is supposed to contain the right frame, but it doesnt :/ so do the dance
frame = lldb.debugger.GetSelectedTarget().GetProcess().GetSelectedThread().GetSelectedFrame()
value = frame.EvaluateExpression(expression)
expr_options = lldb.SBExpressionOptions()
expr_options.SetLanguage(language) # requires lldb r210874 (2014-06-13) / Xcode 6
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @arigrant, what do you think about baseline Xcode support? Should Chisel support anything more than just the current version of Xcode?

@kastiglione
Copy link
Contributor

@mblsha I've left a couple comments. Thanks for submitting this pull request!

The only thing that needs to be figured out Xcode/lldb version support.

@kastiglione kastiglione self-assigned this Jan 4, 2015
@mblsha
Copy link
Contributor Author

mblsha commented Jan 16, 2015

evaluateExpressionValueWithLanguage() works fine in Xcode 6.0+. Once 6.2 becomes final maybe evaluateExpressionValueInFrameLanguage() will work as well.

@moreindirection
Copy link

It looks like there are still a few problems in Swift. Any commands that are of the form "po EXPRESSION" need to be changed to "expression -O -l objc++ --- EXPRESSION"

"pviews" and "pca" are two examples - just grep for:

HandleCommand('po

Would really like to see these changes merged into master, though. It's great to be able to still use Chisel commands when I hit a Swift breakpoint.

@kastiglione
Copy link
Contributor

🚢 🚢 🚢 Thanks @mblsha!

kastiglione added a commit that referenced this pull request Feb 7, 2015
Add basic Swift support (requires Xcode 6)
@kastiglione kastiglione merged commit abcbb93 into facebook:master Feb 7, 2015
@kastiglione
Copy link
Contributor

@moreindirection Can I interest you in opening a pull request to fix the stuff you've seen broken with Swift? 🍰

@moreindirection
Copy link

@kastiglione Sure, I just created pull request #73

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants