LLDB  mainline
TraceIntelPTSessionSaver.h
Go to the documentation of this file.
1 //===-- TraceIntelPTSessionSaver.h ---------------------------*- C++ //-*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLDB_SOURCE_PLUGINS_TRACE_INTEL_PT_TRACEINTELPTSESSIONSAVER_H
10 #define LLDB_SOURCE_PLUGINS_TRACE_INTEL_PT_TRACEINTELPTSESSIONSAVER_H
11 
12 #include "TraceIntelPT.h"
13 
14 #include "../common/TraceJSONStructs.h"
15 
16 namespace lldb_private {
17 namespace trace_intel_pt {
18 
19 class TraceIntelPT;
20 
22 
23 public:
24  /// Save the Intel PT trace of a live process to the specified directory,
25  /// which will be created if needed. This will also create a file
26  /// \a <directory>/trace.json with the main properties of the trace
27  /// session, along with others files which contain the actual trace data.
28  /// The trace.json file can be used later as input for the "trace load"
29  /// command to load the trace in LLDB.
30  ///
31  /// \param[in] trace_ipt
32  /// The Intel PT trace to be saved to disk.
33  ///
34  /// \param[in] directory
35  /// The directory where the trace files will be saved.
36  ///
37  /// \return
38  /// \a llvm::success if the operation was successful, or an \a llvm::Error
39  /// otherwise.
40  llvm::Error SaveToDisk(TraceIntelPT &trace_ipt, FileSpec directory);
41 
42 private:
43  /// Build trace section of the intel-pt trace session description file.
44  ///
45  /// \param[in] trace_ipt
46  /// The Intel PT trace.
47  ///
48  /// \return
49  /// The trace section an \a llvm::Error in case of failures.
50  llvm::Expected<JSONTraceIntelPTTrace>
51  BuildTraceSection(TraceIntelPT &trace_ipt);
52 };
53 
54 } // namespace trace_intel_pt
55 } // namespace lldb_private
56 
57 #endif // LLDB_SOURCE_PLUGINS_TRACE_INTEL_PT_TRACEINTELPTSESSIONSAVER_H
lldb_private::trace_intel_pt::TraceIntelPTSessionSaver::BuildTraceSection
llvm::Expected< JSONTraceIntelPTTrace > BuildTraceSection(TraceIntelPT &trace_ipt)
Build trace section of the intel-pt trace session description file.
Definition: TraceIntelPTSessionSaver.cpp:72
lldb_private::trace_intel_pt::TraceIntelPT
Definition: TraceIntelPT.h:21
lldb_private::trace_intel_pt::TraceIntelPTSessionSaver
Definition: TraceIntelPTSessionSaver.h:21
lldb_private::FileSpec
Definition: FileSpec.h:56
lldb_private::trace_intel_pt::TraceIntelPTSessionSaver::SaveToDisk
llvm::Error SaveToDisk(TraceIntelPT &trace_ipt, FileSpec directory)
Save the Intel PT trace of a live process to the specified directory, which will be created if needed...
Definition: TraceIntelPTSessionSaver.cpp:34
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
Error
llvm::Error Error
Definition: UdtRecordCompleter.cpp:29
TraceIntelPT.h