Skip to content

Commit 94f1518

Browse files
committed
[LLDB] Add log channel for InstrumentationRuntime plugins
This patch adds `LLDBLog::InstrumentationRuntime` as a log channel to provide an appropriate channel for instrumentation runtime plugins as previously one did not exist. A small use of the channel is added to illustrate its use. The logging added is not intended to be comprehensive. This is primarily motivated by an `-fbounds-safety` instrumentation plugin (swiftlang#11835). rdar://164920875
1 parent 2c4bce4 commit 94f1518

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

lldb/include/lldb/Utility/LLDBLog.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ enum class LLDBLog : Log::MaskType {
5050
OnDemand = Log::ChannelFlag<31>,
5151
Source = Log::ChannelFlag<32>,
5252
Disassembler = Log::ChannelFlag<33>,
53-
LLVM_MARK_AS_BITMASK_ENUM(Disassembler),
53+
InstrumentationRuntime = Log::ChannelFlag<34>,
54+
LLVM_MARK_AS_BITMASK_ENUM(InstrumentationRuntime),
5455
};
5556

5657
LLVM_ENABLE_BITMASK_ENUMS_IN_NAMESPACE();

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ bool ReportRetriever::NotifyBreakpointHit(ProcessSP process_sp,
199199
StoppointCallbackContext *context,
200200
user_id_t break_id,
201201
user_id_t break_loc_id) {
202+
auto *log = GetLog(LLDBLog::InstrumentationRuntime);
202203
// Make sure this is the right process
203204
if (!process_sp || process_sp != context->exe_ctx_ref.GetProcessSP())
204205
return false;
@@ -207,8 +208,10 @@ bool ReportRetriever::NotifyBreakpointHit(ProcessSP process_sp,
207208
return false;
208209

209210
StructuredData::ObjectSP report = RetrieveReportData(process_sp);
210-
if (!report || report->GetType() != lldb::eStructuredDataTypeDictionary)
211+
if (!report || report->GetType() != lldb::eStructuredDataTypeDictionary) {
212+
LLDB_LOGF(log, "ReportRetriever::RetrieveReportData() failed");
211213
return false;
214+
}
212215

213216
std::string description = FormatDescription(report);
214217

lldb/source/Utility/LLDBLog.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ static constexpr Log::Category g_categories[] = {
6767
{{"disassembler"},
6868
{"log disassembler related activities"},
6969
LLDBLog::Disassembler},
70+
{{"instrumentation-runtime"},
71+
{"log instrumentation runtime plugin related activities"},
72+
LLDBLog::InstrumentationRuntime},
7073
};
7174

7275
static Log::Channel g_log_channel(g_categories,

0 commit comments

Comments
 (0)