LLDB  mainline
TraceIntelPTSessionFileParser.h
Go to the documentation of this file.
1 //===-- TraceIntelPTSessionFileParser.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_TRACEINTELPTSESSIONFILEPARSER_H
10 #define LLDB_SOURCE_PLUGINS_TRACE_INTEL_PT_TRACEINTELPTSESSIONFILEPARSER_H
11 
12 #include "../common/TraceSessionFileParser.h"
13 #include "TraceIntelPT.h"
15 
16 namespace lldb_private {
17 namespace trace_intel_pt {
18 
19 class TraceIntelPT;
20 
22 public:
23 
24  /// See \a TraceSessionFileParser::TraceSessionFileParser for the description
25  /// of these fields.
27  const llvm::json::Value &trace_session_file,
28  llvm::StringRef session_file_dir)
29  : TraceSessionFileParser(debugger, session_file_dir, GetSchema()),
30  m_trace_session_file(trace_session_file) {}
31 
32  /// \return
33  /// The JSON schema for the session data.
34  static llvm::StringRef GetSchema();
35 
36  /// Parse the structured data trace session and create the corresponding \a
37  /// Target objects. In case of an error, no targets are created.
38  ///
39  /// \return
40  /// A \a lldb::TraceSP instance with the trace session data. In case of
41  /// errors, return a null pointer.
42  llvm::Expected<lldb::TraceSP> Parse();
43 
44  lldb::TraceSP
45  CreateTraceIntelPTInstance(const pt_cpu &cpu_info,
46  std::vector<ParsedProcess> &parsed_processes);
47 
48 private:
49  static pt_cpu ParsePTCPU(const JSONTraceIntelPTCPUInfo &cpu_info);
50 
51  const llvm::json::Value &m_trace_session_file;
52 };
53 
54 } // namespace trace_intel_pt
55 } // namespace lldb_private
56 
57 
58 #endif // LLDB_SOURCE_PLUGINS_TRACE_INTEL_PT_TRACEINTELPTSESSIONFILEPARSER_H
lldb_private::trace_intel_pt::TraceIntelPTSessionFileParser::GetSchema
static llvm::StringRef GetSchema()
Definition: TraceIntelPTSessionFileParser.cpp:19
lldb_private::trace_intel_pt::TraceIntelPTSessionFileParser::ParsePTCPU
static pt_cpu ParsePTCPU(const JSONTraceIntelPTCPUInfo &cpu_info)
Definition: TraceIntelPTSessionFileParser.cpp:35
lldb_private::trace_intel_pt::JSONTraceIntelPTCPUInfo
Definition: TraceIntelPTJSONStructs.h:18
TraceIntelPTJSONStructs.h
lldb_private::Debugger
Definition: Debugger.h:70
lldb_private::trace_intel_pt::TraceIntelPTSessionFileParser::TraceIntelPTSessionFileParser
TraceIntelPTSessionFileParser(Debugger &debugger, const llvm::json::Value &trace_session_file, llvm::StringRef session_file_dir)
See TraceSessionFileParser::TraceSessionFileParser for the description of these fields.
Definition: TraceIntelPTSessionFileParser.h:26
lldb_private::trace_intel_pt::TraceIntelPTSessionFileParser::CreateTraceIntelPTInstance
lldb::TraceSP CreateTraceIntelPTInstance(const pt_cpu &cpu_info, std::vector< ParsedProcess > &parsed_processes)
Definition: TraceIntelPTSessionFileParser.cpp:43
lldb_private::trace_intel_pt::TraceIntelPTSessionFileParser
Definition: TraceIntelPTSessionFileParser.h:21
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::TraceSessionFileParser
Definition: TraceSessionFileParser.h:24
lldb_private::trace_intel_pt::TraceIntelPTSessionFileParser::Parse
llvm::Expected< lldb::TraceSP > Parse()
Parse the structured data trace session and create the corresponding Target objects.
Definition: TraceIntelPTSessionFileParser.cpp:57
TraceIntelPT.h
lldb_private::trace_intel_pt::TraceIntelPTSessionFileParser::m_trace_session_file
const llvm::json::Value & m_trace_session_file
Definition: TraceIntelPTSessionFileParser.h:51