Skip to content

Commit 18a8527

Browse files
committed
[trace][intel-pt] Fix a crash on unconsumed Expected's Error
Reproducible with build using libipt and -DLLVM_ENABLE_ASSERTIONS=ON: (lldb) b main (lldb) r (lldb) process trace start
1 parent 16ff1a7 commit 18a8527

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lldb/source/Plugins/Process/Linux/IntelPTManager.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,14 @@ IntelPTManager::GetBinaryData(const TraceGetBinaryDataRequest &request) const {
542542

543543
void IntelPTManager::ClearProcessTracing() { m_process_trace = None; }
544544

545-
bool IntelPTManager::IsSupported() { return (bool)GetOSEventType(); }
545+
bool IntelPTManager::IsSupported() {
546+
Expected<uint32_t> intel_pt_type = GetOSEventType();
547+
if (!intel_pt_type) {
548+
llvm::consumeError(intel_pt_type.takeError());
549+
return false;
550+
}
551+
return true;
552+
}
546553

547554
bool IntelPTManager::IsProcessTracingEnabled() const {
548555
return (bool)m_process_trace;

0 commit comments

Comments
 (0)