From a758205951d3a1eb60bdb65146ab23e8567f30a7 Mon Sep 17 00:00:00 2001 From: Walter Erquinigo Date: Wed, 18 May 2022 08:01:01 -0700 Subject: [trace][intelpt] Support system-wide tracing [9] - Collect and return context switch traces - Add collection of context switches per cpu grouped with the per-cpu intel pt traces. - Move the state handling from the interl pt trace class to the PerfEvent one. - Add support for stopping and enabling perf event groups. - Return context switch entries as part of the jLLDBTraceGetState response. - Move the triggers of whenever the process stopped or resumed. Now the will-resume notification is in a better location, which will ensure that we'll capture the instructions that will be executed. - Remove IntelPTSingleBufferTraceUP. The unique pointer was useless. - Add unit tests Differential Revision: https://reviews.llvm.org/D125897 --- lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (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 a7869d2241ae..429c68a9dc78 100644 --- a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp +++ b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp @@ -898,6 +898,8 @@ Status NativeProcessLinux::Resume(const ResumeActionList &resume_actions) { Log *log = GetLog(POSIXLog::Process); LLDB_LOG(log, "pid {0}", GetID()); + NotifyTracersProcessWillResume(); + bool software_single_step = !SupportHardwareSingleStepping(); if (software_single_step) { @@ -1665,9 +1667,12 @@ void NativeProcessLinux::StopTrackingThread(NativeThreadLinux &thread) { SignalIfAllThreadsStopped(); } -void NativeProcessLinux::NotifyTracersProcessStateChanged( - lldb::StateType state) { - m_intel_pt_collector.OnProcessStateChanged(state); +void NativeProcessLinux::NotifyTracersProcessDidStop() { + m_intel_pt_collector.ProcessDidStop(); +} + +void NativeProcessLinux::NotifyTracersProcessWillResume() { + m_intel_pt_collector.ProcessWillResume(); } Status NativeProcessLinux::NotifyTracersOfNewThread(lldb::tid_t tid) { -- cgit v1.2.3