[lldb] Migrate runtime instrumentation plugins to ReportWarning

This commit is contained in:
Jonas Devlieghere 2022-03-16 23:09:59 -07:00
parent cc38a4a665
commit cae735f72b
No known key found for this signature in database
GPG Key ID: 49CC0BD90FDEED4D
4 changed files with 21 additions and 13 deletions

View File

@ -136,9 +136,11 @@ StructuredData::ObjectSP InstrumentationRuntimeASan::RetrieveReportData() {
exe_ctx, options, address_sanitizer_retrieve_report_data_command, "",
return_value_sp, eval_error);
if (result != eExpressionCompleted) {
process_sp->GetTarget().GetDebugger().GetAsyncOutputStream()->Printf(
"Warning: Cannot evaluate AddressSanitizer expression:\n%s\n",
eval_error.AsCString());
StreamString ss;
ss << "cannot evaluate AddressSanitizer expression:\n";
ss << eval_error.AsCString();
Debugger::ReportWarning(ss.GetString().str(),
process_sp->GetTarget().GetDebugger().GetID());
return StructuredData::ObjectSP();
}

View File

@ -327,9 +327,11 @@ StructuredData::ObjectSP InstrumentationRuntimeTSan::RetrieveReportData(
exe_ctx, options, thread_sanitizer_retrieve_report_data_command, "",
main_value, eval_error);
if (result != eExpressionCompleted) {
process_sp->GetTarget().GetDebugger().GetAsyncOutputStream()->Printf(
"Warning: Cannot evaluate ThreadSanitizer expression:\n%s\n",
eval_error.AsCString());
StreamString ss;
ss << "cannot evaluate ThreadSanitizer expression:\n";
ss << eval_error.AsCString();
Debugger::ReportWarning(ss.GetString().str(),
process_sp->GetTarget().GetDebugger().GetID());
return StructuredData::ObjectSP();
}

View File

@ -136,9 +136,11 @@ StructuredData::ObjectSP InstrumentationRuntimeUBSan::RetrieveReportData(
exe_ctx, options, ub_sanitizer_retrieve_report_data_command, "",
main_value, eval_error);
if (result != eExpressionCompleted) {
target.GetDebugger().GetAsyncOutputStream()->Printf(
"Warning: Cannot evaluate UndefinedBehaviorSanitizer expression:\n%s\n",
eval_error.AsCString());
StreamString ss;
ss << "cannot evaluate UndefinedBehaviorSanitizer expression:\n";
ss << eval_error.AsCString();
Debugger::ReportWarning(ss.GetString().str(),
process_sp->GetTarget().GetDebugger().GetID());
return StructuredData::ObjectSP();
}

View File

@ -72,7 +72,7 @@ const char *memory_history_asan_command_prefix = R"(
void *alloc_trace[256];
size_t alloc_count;
int alloc_tid;
void *free_trace[256];
size_t free_count;
int free_tid;
@ -179,9 +179,11 @@ HistoryThreads MemoryHistoryASan::GetHistoryThreads(lldb::addr_t address) {
ExpressionResults expr_result = UserExpression::Evaluate(
exe_ctx, options, expr.GetString(), "", return_value_sp, eval_error);
if (expr_result != eExpressionCompleted) {
process_sp->GetTarget().GetDebugger().GetAsyncOutputStream()->Printf(
"Warning: Cannot evaluate AddressSanitizer expression:\n%s\n",
eval_error.AsCString());
StreamString ss;
ss << "cannot evaluate AddressSanitizer expression:\n";
ss << eval_error.AsCString();
Debugger::ReportWarning(ss.GetString().str(),
process_sp->GetTarget().GetDebugger().GetID());
return result;
}