summaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/Process/Linux/IntelPTPerThreadProcessTrace.cpp
diff options
context:
space:
mode:
authorWalter Erquinigo <wallace@fb.com>2022-05-05 14:42:54 -0700
committerWalter Erquinigo <wallace@fb.com>2022-05-17 12:46:54 -0700
commit1188faa7ab4b005e3ee28f30055de2f76e210eb8 (patch)
tree3207b36aaf2e37331da7d1164b8c48bd77e24bd4 /lldb/source/Plugins/Process/Linux/IntelPTPerThreadProcessTrace.cpp
parent1637545f689b8c4ef888ca385de75982a6a932e3 (diff)
[trace][intelpt] Support system-wide tracing [6] - Break IntelPTCollector into smaller files and minor refactor
IntelPTCollector is very big and has 3 classes in it. It's actually cleaner if each one has its own file. This also gives more visibility to the developer about the different kinds of "tracers" that we have. Besides that, I'm now restricting the creation of the BinaryData chunks to GetState() instead of having it in different places, which is not very clean, because the gdb-remote protocol should be as restricted as possible. Differential Revision: https://reviews.llvm.org/D125047
Diffstat (limited to 'lldb/source/Plugins/Process/Linux/IntelPTPerThreadProcessTrace.cpp')
-rw-r--r--lldb/source/Plugins/Process/Linux/IntelPTPerThreadProcessTrace.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/lldb/source/Plugins/Process/Linux/IntelPTPerThreadProcessTrace.cpp b/lldb/source/Plugins/Process/Linux/IntelPTPerThreadProcessTrace.cpp
new file mode 100644
index 000000000000..087597c4f2a5
--- /dev/null
+++ b/lldb/source/Plugins/Process/Linux/IntelPTPerThreadProcessTrace.cpp
@@ -0,0 +1,40 @@
+//===-- IntelPTPerThreadProcessTrace.cpp ----------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "IntelPTPerThreadProcessTrace.h"
+
+using namespace lldb;
+using namespace lldb_private;
+using namespace process_linux;
+using namespace llvm;
+
+bool IntelPTPerThreadProcessTrace::TracesThread(lldb::tid_t tid) const {
+ return m_thread_traces.TracesThread(tid);
+}
+
+Error IntelPTPerThreadProcessTrace::TraceStop(lldb::tid_t tid) {
+ return m_thread_traces.TraceStop(tid);
+}
+
+Error IntelPTPerThreadProcessTrace::TraceStart(lldb::tid_t tid) {
+ if (m_thread_traces.GetTotalBufferSize() +
+ m_tracing_params.trace_buffer_size >
+ static_cast<size_t>(*m_tracing_params.process_buffer_size_limit))
+ return createStringError(
+ inconvertibleErrorCode(),
+ "Thread %" PRIu64 " can't be traced as the process trace size limit "
+ "has been reached. Consider retracing with a higher "
+ "limit.",
+ tid);
+
+ return m_thread_traces.TraceStart(tid, m_tracing_params);
+}
+
+IntelPTThreadTraceCollection &IntelPTPerThreadProcessTrace::GetThreadTraces() {
+ return m_thread_traces;
+}