[Lldb-commits] [PATCH] D81654: [lldb] Don't print IRForTarget errors directly to the console

Raphael Isemann via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Jun 12 01:35:54 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG91728b9172bf: [lldb] Don't print IRForTarget errors directly to the console (authored by teemperor).
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Changed prior to commit:
  https://reviews.llvm.org/D81654?vs=270128&id=270323#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81654

Files:
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
  lldb/test/API/lang/objc/modules-non-objc-target/TestObjCModulesNonObjCTarget.py


Index: lldb/test/API/lang/objc/modules-non-objc-target/TestObjCModulesNonObjCTarget.py
===================================================================
--- lldb/test/API/lang/objc/modules-non-objc-target/TestObjCModulesNonObjCTarget.py
+++ lldb/test/API/lang/objc/modules-non-objc-target/TestObjCModulesNonObjCTarget.py
@@ -23,4 +23,4 @@
         # be prepared to run in the target but it should at least not crash LLDB.
         self.expect('expr --lang objc -- [NSString stringWithFormat:@"%d", 1];',
                     error=True,
-                    substrs=["error: The expression could not be prepared to run in the target"])
+                    substrs=["Rewriting an Objective-C constant string requires CFStringCreateWithBytes"])
Index: lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
===================================================================
--- lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
@@ -1323,18 +1323,13 @@
       type_system_helper->DeclMap(); // result can be NULL
 
   if (decl_map) {
-    Target *target = exe_ctx.GetTargetPtr();
-    auto &error_stream = target->GetDebugger().GetErrorStream();
+    StreamString error_stream;
     IRForTarget ir_for_target(decl_map, m_expr.NeedsVariableResolution(),
                               *execution_unit_sp, error_stream,
                               function_name.AsCString());
 
-    bool ir_can_run =
-        ir_for_target.runOnModule(*execution_unit_sp->GetModule());
-
-    if (!ir_can_run) {
-      err.SetErrorString(
-          "The expression could not be prepared to run in the target");
+    if (!ir_for_target.runOnModule(*execution_unit_sp->GetModule())) {
+      err.SetErrorString(error_stream.GetString());
       return err;
     }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81654.270323.patch
Type: text/x-patch
Size: 1857 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200612/5ae0a283/attachment.bin>


More information about the lldb-commits mailing list