From 1637545f689b8c4ef888ca385de75982a6a932e3 Mon Sep 17 00:00:00 2001 From: Walter Erquinigo Date: Wed, 4 May 2022 13:24:49 -0700 Subject: [trace][intelpt] Support system-wide tracing [5] - Disable/enable per-core tracing based on the process state When tracing on per-core mode, we are tracing all processes, which means that after hitting a breakpoint, our process will stop running (thus producing no more tracing data) but other processes will continue writing to our trace buffers. This causes a big data loss for our trace. As a way to remediate this, I'm adding some logic to pause and unpause tracing based on the target's state. The earlier we do it the better, however, I'm not adding the trigger at the earliest possible point for simplicity of this diff. Later we can improve that part. Differential Revision: https://reviews.llvm.org/D124962 --- lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp') diff --git a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp index 37da1f12421a..a7869d2241ae 100644 --- a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp +++ b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp @@ -1665,6 +1665,11 @@ void NativeProcessLinux::StopTrackingThread(NativeThreadLinux &thread) { SignalIfAllThreadsStopped(); } +void NativeProcessLinux::NotifyTracersProcessStateChanged( + lldb::StateType state) { + m_intel_pt_collector.OnProcessStateChanged(state); +} + Status NativeProcessLinux::NotifyTracersOfNewThread(lldb::tid_t tid) { Log *log = GetLog(POSIXLog::Thread); Status error(m_intel_pt_collector.OnThreadCreated(tid)); -- cgit v1.2.3