-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[lldb] Improve user expression diagnostics #123242
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This patch rewords some of the user expression diagnostics. - Differentiate between being interrupted and hitting a breakpoint. - Use "expression execution" to make it more obvious that the diagnostic is associated with the user expression. - Consistently use a colon instead of semicolons and commas.
@llvm/pr-subscribers-lldb Author: Jonas Devlieghere (JDevlieghere) ChangesThis patch rewords some of the user expression diagnostics.
rdar://143059974 Full diff: https://github.com/llvm/llvm-project/pull/123242.diff 1 Files Affected:
diff --git a/lldb/source/Expression/LLVMUserExpression.cpp b/lldb/source/Expression/LLVMUserExpression.cpp
index 529ac462dfd8f4..fac3ce6f5799d5 100644
--- a/lldb/source/Expression/LLVMUserExpression.cpp
+++ b/lldb/source/Expression/LLVMUserExpression.cpp
@@ -187,18 +187,22 @@ LLVMUserExpression::DoExecute(DiagnosticManager &diagnostic_manager,
if (execution_result == lldb::eExpressionInterrupted ||
execution_result == lldb::eExpressionHitBreakpoint) {
const char *error_desc = nullptr;
+ const char *explanation = execution_result == lldb::eExpressionInterrupted
+ ? "was interrupted"
+ : "hit a breakpoint";
if (user_expression_plan) {
if (auto real_stop_info_sp = user_expression_plan->GetRealStopInfo())
error_desc = real_stop_info_sp->GetDescription();
}
+
if (error_desc)
diagnostic_manager.Printf(lldb::eSeverityError,
- "Execution was interrupted, reason: %s.",
+ "Expression execution %s: %s.", explanation,
error_desc);
else
- diagnostic_manager.PutString(lldb::eSeverityError,
- "Execution was interrupted.");
+ diagnostic_manager.Printf(lldb::eSeverityError,
+ "Expression execution %s.", explanation);
if ((execution_result == lldb::eExpressionInterrupted &&
options.DoesUnwindOnError()) ||
@@ -212,31 +216,35 @@ LLVMUserExpression::DoExecute(DiagnosticManager &diagnostic_manager,
user_expression_plan->TransferExpressionOwnership();
diagnostic_manager.AppendMessageToDiagnostic(
"The process has been left at the point where it was "
- "interrupted, "
- "use \"thread return -x\" to return to the state before "
- "expression evaluation.");
+ "interrupted, use \"thread return -x\" to return to the state "
+ "before expression evaluation.");
}
return execution_result;
- } else if (execution_result == lldb::eExpressionStoppedForDebug) {
+ }
+
+ if (execution_result == lldb::eExpressionStoppedForDebug) {
diagnostic_manager.PutString(
lldb::eSeverityInfo,
- "Execution was halted at the first instruction of the expression "
- "function because \"debug\" was requested.\n"
+ "Expression execution was halted at the first instruction of the "
+ "expression function because \"debug\" was requested.\n"
"Use \"thread return -x\" to return to the state before expression "
"evaluation.");
return execution_result;
- } else if (execution_result == lldb::eExpressionThreadVanished) {
- diagnostic_manager.Printf(
- lldb::eSeverityError,
- "Couldn't complete execution; the thread "
- "on which the expression was being run: 0x%" PRIx64
- " exited during its execution.",
- expr_thread_id);
+ }
+
+ if (execution_result == lldb::eExpressionThreadVanished) {
+ diagnostic_manager.Printf(lldb::eSeverityError,
+ "Couldn't execute expression: the thread on "
+ "which the expression was being run (0x%" PRIx64
+ ") exited during its execution.",
+ expr_thread_id);
return execution_result;
- } else if (execution_result != lldb::eExpressionCompleted) {
+ }
+
+ if (execution_result != lldb::eExpressionCompleted) {
diagnostic_manager.Printf(lldb::eSeverityError,
- "Couldn't execute function; result was %s",
+ "Couldn't execute expression: result was %s",
toString(execution_result).c_str());
return execution_result;
}
@@ -245,9 +253,9 @@ LLVMUserExpression::DoExecute(DiagnosticManager &diagnostic_manager,
if (FinalizeJITExecution(diagnostic_manager, exe_ctx, result,
function_stack_bottom, function_stack_top)) {
return lldb::eExpressionCompleted;
- } else {
- return lldb::eExpressionResultUnavailable;
}
+
+ return lldb::eExpressionResultUnavailable;
}
bool LLVMUserExpression::FinalizeJITExecution(
|
jimingham
approved these changes
Jan 16, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's clearer...
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This patch rewords some of the user expression diagnostics.
rdar://143059974