Skip to content

Commit 39a4da2

Browse files
committed
[lldb][asan] Add temporary logging to ReportRetriever
`TestReportData.py` is failing on the macOS CI with: ``` Traceback (most recent call last): File "/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake/llvm-project/lldb/packages/Python/lldbsuite/test/lldbtest.py", line 1784, in test_method return attrvalue(self) File "/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake/llvm-project/lldb/packages/Python/lldbsuite/test/decorators.py", line 148, in wrapper return func(*args, **kwargs) File "/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake/llvm-project/lldb/test/API/functionalities/asan/TestReportData.py", line 28, in test_libsanitizers_asan self.asan_tests(libsanitizers=True) File "/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake/llvm-project/lldb/test/API/functionalities/asan/TestReportData.py", line 60, in asan_tests self.expect( File "/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake/llvm-project/lldb/packages/Python/lldbsuite/test/lldbtest.py", line 2490, in expect self.fail(log_msg) AssertionError: Ran command: "thread list" Got output: Process 3474 stopped * thread #1: tid = 0x38b5e9, 0x00007ff80f563b52 libsystem_kernel.dylib`__pthread_kill + 10, queue = 'com.apple.main-thread', stop reason = signal SIGABRT Expecting sub string: "stopped" (was found) Expecting sub string: "stop reason = Use of deallocated memory" (was not found) Process should be stopped due to ASan report ``` There isn't much to go off of in the log, so adding more to help us debug this.
1 parent 1873f55 commit 39a4da2

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

lldb/source/Plugins/InstrumentationRuntime/Utility/ReportRetriever.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "lldb/Core/Module.h"
1515
#include "lldb/Expression/UserExpression.h"
1616
#include "lldb/Target/InstrumentationRuntimeStopInfo.h"
17+
#include "lldb/Utility/LLDBLog.h"
1718
#include "lldb/ValueObject/ValueObject.h"
1819

1920
using namespace lldb;
@@ -84,6 +85,8 @@ ReportRetriever::RetrieveReportData(const ProcessSP process_sp) {
8485
options.SetLanguage(eLanguageTypeObjC_plus_plus);
8586

8687
if (auto m = GetPreferredAsanModule(process_sp->GetTarget())) {
88+
LLDB_LOGF(GetLog(LLDBLog::Expressions), "Using preferred ASAN module: %s",
89+
m->GetFileSpec().GetFilename().AsCString(""));
8790
SymbolContextList sc_list;
8891
sc_list.Append(SymbolContext(std::move(m)));
8992
options.SetPreferredSymbolContexts(std::move(sc_list));
@@ -105,11 +108,16 @@ ReportRetriever::RetrieveReportData(const ProcessSP process_sp) {
105108
return StructuredData::ObjectSP();
106109
}
107110

111+
LLDB_LOGF(GetLog(LLDBLog::Expressions),
112+
"Successfully ran ASAN report retriever utility expression");
113+
108114
int present = return_value_sp->GetValueForExpressionPath(".present")
109115
->GetValueAsUnsigned(0);
110116
if (present != 1)
111117
return StructuredData::ObjectSP();
112118

119+
LLDB_LOGF(GetLog(LLDBLog::Expressions), "Retrieving report.1");
120+
113121
addr_t pc =
114122
return_value_sp->GetValueForExpressionPath(".pc")->GetValueAsUnsigned(0);
115123
addr_t bp =
@@ -135,6 +143,8 @@ ReportRetriever::RetrieveReportData(const ProcessSP process_sp) {
135143
if (!dict)
136144
return StructuredData::ObjectSP();
137145

146+
LLDB_LOGF(GetLog(LLDBLog::Expressions), "Retrieving report.2");
147+
138148
dict->AddStringItem("instrumentation_class", "AddressSanitizer");
139149
dict->AddStringItem("stop_type", "fatal_error");
140150
dict->AddIntegerItem("pc", pc);

lldb/test/API/functionalities/asan/TestReportData.py

+3
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ def setUp(self):
3838
self.col_crash = 16
3939

4040
def asan_tests(self, libsanitizers=False):
41+
if libsanitizers:
42+
self.runCmd("log enable lldb expr")
43+
4144
target = self.createTestTarget()
4245

4346
if libsanitizers:

0 commit comments

Comments
 (0)