Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions fblldbbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,27 @@ def run(self, arguments, option):
pass


def evaluateExpressionValue(expression, printErrors=True):
def evaluateExpressionValueWithLanguage(expression, language, printErrors):
# 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?

value = frame.EvaluateExpression(expression, expr_options)
if printErrors and value.GetError() is not None and str(value.GetError()) != 'success':
print value.GetError()
return value

def evaluateExpressionValueInFrameLanguage(expression, printErrors=True):
# lldb.frame is supposed to contain the right frame, but it doesnt :/ so do the dance
frame = lldb.debugger.GetSelectedTarget().GetProcess().GetSelectedThread().GetSelectedFrame()
language = frame.GetCompileUnit().GetLanguage() # requires lldb r222189 (2014-11-17)
Copy link
Contributor

Choose a reason for hiding this comment

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

@mblsha Which version of Xcode includes r222189? That date is pretty recent…

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure, it's not yet in 6.1.1, so evaluateExpressionValueInFrameLanguage() is not actually called anywhere and is present for future reference. Hopefully LLDB in 6.2 beta has it, but I haven't verified it.

I'll try it once it becomes final.

Copy link
Contributor

Choose a reason for hiding this comment

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

evaluateExpressionValueInFrameLanguage() is not actually called anywhere

👍

return evaluateExpressionValueWithLanguage(expression, language, printErrors)

# evaluates expression in Objective-C++ context, so it will work even for
# Swift projects
def evaluateExpressionValue(expression, printErrors=True):
return evaluateExpressionValueWithLanguage(expression, lldb.eLanguageTypeObjC_plus_plus, printErrors)

def evaluateIntegerExpression(expression, printErrors=True):
output = evaluateExpression('(int)(' + expression + ')', printErrors).replace('\'', '')
if output.startswith('\\x'): # Booleans may display as \x01 (Hex)
Expand Down