teemperor updated this revision to Diff 230046.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D70433/new/
https://reviews.llvm.org/D70433
Files:
lldb/packages/Python/lldbsuite/test/commands/expression/static-initializers/TestStaticInitializers.py
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
lldb/source/Target/Process.cpp
Index: lldb/source/Target/Process.cpp
===================================================================
--- lldb/source/Target/Process.cpp
+++ lldb/source/Target/Process.cpp
@@ -5228,90 +5228,88 @@
// Now do some processing on the results of the run:
if (return_value == eExpressionInterrupted ||
return_value == eExpressionHitBreakpoint) {
- if (log) {
- StreamString s;
- if (event_sp)
- event_sp->Dump(&s);
- else {
- log->PutCString("Process::RunThreadPlan(): Stop event that "
- "interrupted us is NULL.");
- }
+ StreamString s;
+ if (event_sp)
+ event_sp->Dump(&s);
+ else {
+ log->PutCString("Process::RunThreadPlan(): Stop event that "
+ "interrupted us is NULL.");
+ }
- StreamString ts;
+ StreamString ts;
- const char *event_explanation = nullptr;
+ const char *event_explanation = nullptr;
- do {
- if (!event_sp) {
- event_explanation = "<no event>";
- break;
- } else if (event_sp->GetType() == eBroadcastBitInterrupt) {
- event_explanation = "<user interrupt>";
+ do {
+ if (!event_sp) {
+ event_explanation = "<no event>";
+ break;
+ } else if (event_sp->GetType() == eBroadcastBitInterrupt) {
+ event_explanation = "<user interrupt>";
+ break;
+ } else {
+ const Process::ProcessEventData *event_data =
+ Process::ProcessEventData::GetEventDataFromEvent(event_sp.get());
+
+ if (!event_data) {
+ event_explanation = "<no event data>";
break;
- } else {
- const Process::ProcessEventData *event_data =
- Process::ProcessEventData::GetEventDataFromEvent(
- event_sp.get());
+ }
- if (!event_data) {
- event_explanation = "<no event data>";
- break;
- }
+ Process *process = event_data->GetProcessSP().get();
- Process *process = event_data->GetProcessSP().get();
+ if (!process) {
+ event_explanation = "<no process>";
+ break;
+ }
- if (!process) {
- event_explanation = "<no process>";
- break;
- }
+ ThreadList &thread_list = process->GetThreadList();
- ThreadList &thread_list = process->GetThreadList();
+ uint32_t num_threads = thread_list.GetSize();
+ uint32_t thread_index;
- uint32_t num_threads = thread_list.GetSize();
- uint32_t thread_index;
+ ts.Printf("<%u threads> ", num_threads);
- ts.Printf("<%u threads> ", num_threads);
+ for (thread_index = 0; thread_index < num_threads; ++thread_index) {
+ Thread *thread = thread_list.GetThreadAtIndex(thread_index).get();
- for (thread_index = 0; thread_index < num_threads; ++thread_index) {
- Thread *thread = thread_list.GetThreadAtIndex(thread_index).get();
+ if (!thread) {
+ ts.Printf("<?> ");
+ continue;
+ }
- if (!thread) {
- ts.Printf("<?> ");
- continue;
- }
+ ts.Printf("<0x%4.4" PRIx64 " ", thread->GetID());
+ RegisterContext *register_context =
+ thread->GetRegisterContext().get();
- ts.Printf("<0x%4.4" PRIx64 " ", thread->GetID());
- RegisterContext *register_context =
- thread->GetRegisterContext().get();
-
- if (register_context)
- ts.Printf("[ip 0x%" PRIx64 "] ", register_context->GetPC());
- else
- ts.Printf("[ip unknown] ");
-
- // Show the private stop info here, the public stop info will be
- // from the last natural stop.
- lldb::StopInfoSP stop_info_sp = thread->GetPrivateStopInfo();
- if (stop_info_sp) {
- const char *stop_desc = stop_info_sp->GetDescription();
- if (stop_desc)
- ts.PutCString(stop_desc);
- }
- ts.Printf(">");
+ if (register_context)
+ ts.Printf("[ip 0x%" PRIx64 "] ", register_context->GetPC());
+ else
+ ts.Printf("[ip unknown] ");
+
+ // Show the private stop info here, the public stop info will be
+ // from the last natural stop.
+ lldb::StopInfoSP stop_info_sp = thread->GetPrivateStopInfo();
+ if (stop_info_sp) {
+ const char *stop_desc = stop_info_sp->GetDescription();
+ if (stop_desc)
+ ts.PutCString(stop_desc);
}
-
- event_explanation = ts.GetData();
+ ts.Printf(">");
}
- } while (false);
- if (event_explanation)
- LLDB_LOGF(log,
- "Process::RunThreadPlan(): execution interrupted: %s %s",
- s.GetData(), event_explanation);
- else
- LLDB_LOGF(log, "Process::RunThreadPlan(): execution interrupted: %s",
- s.GetData());
- }
+ event_explanation = ts.GetData();
+ }
+ } while (false);
+
+ std::string error = s.GetString();
+ if (event_explanation)
+ error += " " + std::string(event_explanation);
+
+ diagnostic_manager.PutString(eDiagnosticSeverityError,
+ "Execution interrupted: " + error);
+ LLDB_LOGF(log, "Process::RunThreadPlan(): execution interrupted: %s",
+ error.c_str());
if (should_unwind) {
LLDB_LOGF(log,
Index: lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
===================================================================
--- lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
@@ -658,7 +658,7 @@
const char *error_cstr = static_init_error.AsCString();
if (error_cstr && error_cstr[0])
diagnostic_manager.Printf(eDiagnosticSeverityError,
- "couldn't run static initializers: %s\n",
+ "couldn't run static initializers:\n%s\n",
error_cstr);
else
diagnostic_manager.PutString(eDiagnosticSeverityError,
Index: lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
===================================================================
--- lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
@@ -1378,8 +1378,10 @@
exe_ctx, call_static_initializer, options, execution_errors);
if (results != lldb::eExpressionCompleted) {
- err.SetErrorStringWithFormat("couldn't run static initializer: %s",
- execution_errors.GetString().c_str());
+ if (execution_errors.Diagnostics().empty())
+ err.SetErrorStringWithFormatv("ExpressionResults: {0}", results);
+ else
+ err.SetErrorStringWithFormatv("{0}", execution_errors.GetString());
return err;
}
}
Index: lldb/packages/Python/lldbsuite/test/commands/expression/static-initializers/TestStaticInitializers.py
===================================================================
--- lldb/packages/Python/lldbsuite/test/commands/expression/static-initializers/TestStaticInitializers.py
+++ lldb/packages/Python/lldbsuite/test/commands/expression/static-initializers/TestStaticInitializers.py
@@ -26,6 +26,5 @@
lldbutil.run_to_source_breakpoint(self, '// break here',
lldb.SBFileSpec("main.cpp", False))
- # FIXME: This error message is not even remotely helpful.
self.expect("expr -p -- struct Foo2 { Foo2() { do_abort(); } }; Foo2 f;", error=True,
- substrs=["error: couldn't run static initializers: couldn't run static initializer:"])
+ substrs=["error: couldn't run static initializers:\nerror: Execution interrupted: "])
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits