diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp +++ b/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; } diff --git a/lldb/test/API/lang/objc/modules-non-objc-target/TestObjCModulesNonObjCTarget.py b/lldb/test/API/lang/objc/modules-non-objc-target/TestObjCModulesNonObjCTarget.py --- a/lldb/test/API/lang/objc/modules-non-objc-target/TestObjCModulesNonObjCTarget.py +++ b/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"])