--- /dev/null
+"""
+Test calling an expression without a target.
+"""
+
+from __future__ import print_function
+
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestCalculatorMode(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ def setUp(self):
+ # Call super's setUp().
+ TestBase.setUp(self)
+
+ def test__calculator_mode(self):
+ """Test calling expressions in the dummy target."""
+ self.expect("expression 11 + 22", "11 + 22 didn't get the expected result", substrs=["33"])
+ # Now try it with a specific language:
+ self.expect("expression -l c -- 11 + 22", "11 + 22 didn't get the expected result", substrs=["33"])
+
if (log)
log->Printf("%s - Currrent expression language is %s\n", __FUNCTION__,
Language::GetNameForLanguageType(lang));
-
- if (lang != lldb::eLanguageTypeUnknown) {
- auto runtime = exe_ctx.GetProcessSP()->GetLanguageRuntime(lang);
+ lldb::ProcessSP process_sp = exe_ctx.GetProcessSP();
+ if (process_sp && lang != lldb::eLanguageTypeUnknown) {
+ auto runtime = process_sp->GetLanguageRuntime(lang);
if (runtime)
runtime->GetIRPasses(custom_passes);
}