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; }
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; }
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits