Skip to content

Commit

Permalink
[lldb] Migrate runtime instrumentation plugins to ReportWarning
Browse files Browse the repository at this point in the history
  • Loading branch information
JDevlieghere committed Mar 17, 2022
1 parent cc38a4a commit cae735f
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 13 deletions.
Expand Up @@ -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();
}

Expand Down
Expand Up @@ -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();
}

Expand Down
Expand Up @@ -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();
}

Expand Down
10 changes: 6 additions & 4 deletions lldb/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit cae735f

Please sign in to comment.