@@ -187,18 +187,22 @@ LLVMUserExpression::DoExecute(DiagnosticManager &diagnostic_manager,
187187 if (execution_result == lldb::eExpressionInterrupted ||
188188 execution_result == lldb::eExpressionHitBreakpoint) {
189189 const char *error_desc = nullptr ;
190+ const char *explanation = execution_result == lldb::eExpressionInterrupted
191+ ? " was interrupted"
192+ : " hit a breakpoint" ;
190193
191194 if (user_expression_plan) {
192195 if (auto real_stop_info_sp = user_expression_plan->GetRealStopInfo ())
193196 error_desc = real_stop_info_sp->GetDescription ();
194197 }
198+
195199 if (error_desc)
196200 diagnostic_manager.Printf (lldb::eSeverityError,
197- " Execution was interrupted, reason : %s." ,
201+ " Expression execution %s : %s." , explanation ,
198202 error_desc);
199203 else
200- diagnostic_manager.PutString (lldb::eSeverityError,
201- " Execution was interrupted. " );
204+ diagnostic_manager.Printf (lldb::eSeverityError,
205+ " Expression execution %s. " , explanation );
202206
203207 if ((execution_result == lldb::eExpressionInterrupted &&
204208 options.DoesUnwindOnError ()) ||
@@ -212,31 +216,35 @@ LLVMUserExpression::DoExecute(DiagnosticManager &diagnostic_manager,
212216 user_expression_plan->TransferExpressionOwnership ();
213217 diagnostic_manager.AppendMessageToDiagnostic (
214218 " The process has been left at the point where it was "
215- " interrupted, "
216- " use \" thread return -x\" to return to the state before "
217- " expression evaluation." );
219+ " interrupted, use \" thread return -x\" to return to the state "
220+ " before expression evaluation." );
218221 }
219222
220223 return execution_result;
221- } else if (execution_result == lldb::eExpressionStoppedForDebug) {
224+ }
225+
226+ if (execution_result == lldb::eExpressionStoppedForDebug) {
222227 diagnostic_manager.PutString (
223228 lldb::eSeverityInfo,
224- " Execution was halted at the first instruction of the expression "
225- " function because \" debug\" was requested.\n "
229+ " Expression execution was halted at the first instruction of the "
230+ " expression function because \" debug\" was requested.\n "
226231 " Use \" thread return -x\" to return to the state before expression "
227232 " evaluation." );
228233 return execution_result;
229- } else if (execution_result == lldb::eExpressionThreadVanished) {
230- diagnostic_manager.Printf (
231- lldb::eSeverityError,
232- " Couldn't complete execution; the thread "
233- " on which the expression was being run: 0x%" PRIx64
234- " exited during its execution." ,
235- expr_thread_id);
234+ }
235+
236+ if (execution_result == lldb::eExpressionThreadVanished) {
237+ diagnostic_manager.Printf (lldb::eSeverityError,
238+ " Couldn't execute expression: the thread on "
239+ " which the expression was being run (0x%" PRIx64
240+ " ) exited during its execution." ,
241+ expr_thread_id);
236242 return execution_result;
237- } else if (execution_result != lldb::eExpressionCompleted) {
243+ }
244+
245+ if (execution_result != lldb::eExpressionCompleted) {
238246 diagnostic_manager.Printf (lldb::eSeverityError,
239- " Couldn't execute function; result was %s" ,
247+ " Couldn't execute expression: result was %s" ,
240248 toString (execution_result).c_str ());
241249 return execution_result;
242250 }
@@ -245,9 +253,9 @@ LLVMUserExpression::DoExecute(DiagnosticManager &diagnostic_manager,
245253 if (FinalizeJITExecution (diagnostic_manager, exe_ctx, result,
246254 function_stack_bottom, function_stack_top)) {
247255 return lldb::eExpressionCompleted;
248- } else {
249- return lldb::eExpressionResultUnavailable;
250256 }
257+
258+ return lldb::eExpressionResultUnavailable;
251259}
252260
253261bool LLVMUserExpression::FinalizeJITExecution (
0 commit comments