options.SetLanguage(frame.GuessLanguage())
eval_result = self.frame().EvaluateExpression(expr, options)
else:
- eval_result = self.target().EvaluateExpression(expr, options)
+ target = self.target()
+ # If there is no selected target, run the expression in the dummy
+ # target.
+ if not target.IsValid():
+ target = self.dbg.GetDummyTarget()
+ eval_result = target.EvaluateExpression(expr, options)
self.assertSuccess(eval_result.GetError())
--- /dev/null
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+class TestCase(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ @no_debug_info_test
+ def test(self):
+ self.expect_expr("int i; __typeof__(i) j = 1; j", result_type="typeof (i)", result_value="1")
+ self.expect_expr("int i; typeof(i) j = 1; j", result_type="typeof (i)", result_value="1")
+ self.expect_expr("int i; decltype(i) j = 1; j", result_type="decltype(i)", result_value="1")
+++ /dev/null
-# RUN: %lldb -b -s %s | FileCheck %s
-
-expression int i; __typeof__(i) j = 1; j
-# CHECK: (lldb) expression int i; __typeof__(i) j = 1; j
-# CHECK-NEXT: (typeof (i)) {{.*}} = 1
-
-expression int i; typeof(i) j = 1; j
-# CHECK: (lldb) expression int i; typeof(i) j = 1; j
-# CHECK-NEXT: (typeof (i)) {{.*}} = 1
-
-expression int i; decltype(i) j = 1; j
-# CHECK: (lldb) expression int i; decltype(i) j = 1; j
-# CHECK-NEXT: (decltype(i)) {{.*}} = 1