[lldb-dev] Python API: Evaluating commands with specified language

Michail Pishchagin mblsha at gmail.com
Wed Dec 24 00:11:11 PST 2014


Hi!

I've been trying to get https://github.com/facebook/chisel to work on Swift targets, and so far noticed one issue: while I'm stopped inside Swift code, all SBFrame.EvaluateExpression() calls are evaluated as if they're in Swift, not in Objective-C (this is what Chisel expects).

It's very easy to reproduce the issue using just default prompt:

(lldb) e (id)objc_getClass("NSClipView")
error: <EXPR>:1:5: error: consecutive statements on a line must be separated by ';'
(id)objc_getClass("NSClipView")
    ^
    ;

(lldb) script
Python Interactive Interpreter. To exit, type 'quit()', 'exit()'.
>>> value = lldb.frame.EvaluateExpression('(id)objc_getClass("NSClipView")')
>>> str(value.GetError())
'error: <EXPR>:1:5: error: consecutive statements on a line must be separated by \';\'\n(id)objc_getClass("NSClipView")\n    ^\n    ;'

(lldb) e -l objective-c++ -- (id)objc_getClass("NSClipView")
(id) $1 = 0x00007fff7c259440

I've looked at LLDB Python API (http://lldb.llvm.org/python_reference/), and was unable to find a way to explicitly specify a language using EvaluateExpression call. Is there a way to do so?

-Michail



More information about the lldb-dev mailing list