[Lldb-commits] [PATCH] D83388: [lldb] Make expect_expr fall back to the dummy target if no target is selected

Raphael Isemann via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Jul 15 04:56:25 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG10fd550d308d: [lldb] Make expect_expr fall back to the dummy target if no target is selected (authored by teemperor).
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83388/new/

https://reviews.llvm.org/D83388

Files:
  lldb/packages/Python/lldbsuite/test/lldbtest.py
  lldb/test/API/lang/cpp/typeof/TestTypeOfDeclTypeExpr.py
  lldb/test/Shell/Expr/TestTypeOfDeclTypeExpr.test


Index: lldb/test/Shell/Expr/TestTypeOfDeclTypeExpr.test
===================================================================
--- lldb/test/Shell/Expr/TestTypeOfDeclTypeExpr.test
+++ /dev/null
@@ -1,13 +0,0 @@
-# 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
Index: lldb/test/API/lang/cpp/typeof/TestTypeOfDeclTypeExpr.py
===================================================================
--- /dev/null
+++ lldb/test/API/lang/cpp/typeof/TestTypeOfDeclTypeExpr.py
@@ -0,0 +1,14 @@
+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")
Index: lldb/packages/Python/lldbsuite/test/lldbtest.py
===================================================================
--- lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -2456,7 +2456,12 @@
             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())
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83388.278147.patch
Type: text/x-patch
Size: 2261 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200715/8c8b3e51/attachment.bin>


More information about the lldb-commits mailing list