LLDB  mainline
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
lldb_private::TraceSessionFileParser Class Reference

#include <TraceSessionFileParser.h>

Inheritance diagram for lldb_private::TraceSessionFileParser:
Inheritance graph
[legend]
Collaboration diagram for lldb_private::TraceSessionFileParser:
Collaboration graph
[legend]

Classes

struct  ParsedProcess
 Helper struct holding the objects created when parsing a process. More...
 

Public Member Functions

 TraceSessionFileParser (Debugger &debugger, llvm::StringRef session_file_dir, llvm::StringRef schema)
 
llvm::Expected< std::vector< ParsedProcess > > ParseCommonSessionFile (const JSONTraceSessionBase &session)
 Parse the fields common to all trace session schemas. More...
 

Static Public Member Functions

static std::string BuildSchema (llvm::StringRef plugin_schema)
 Build the full schema for a Trace plug-in. More...
 

Protected Member Functions

void NormalizePath (lldb_private::FileSpec &file_spec)
 Resolve non-absolute paths relative to the session file folder. More...
 
lldb::ThreadPostMortemTraceSP ParseThread (lldb::ProcessSP &process_sp, const JSONThread &thread)
 
llvm::Expected< ParsedProcessParseProcess (const JSONProcess &process)
 
llvm::Error ParseModule (lldb::TargetSP &target_sp, const JSONModule &module)
 
llvm::Error CreateJSONError (llvm::json::Path::Root &root, const llvm::json::Value &value)
 Create a user-friendly error message upon a JSON-parsing failure using the json::ObjectMapper functionality. More...
 

Protected Attributes

Debuggerm_debugger
 
std::string m_session_file_dir
 
llvm::StringRef m_schema
 

Detailed Description

Base class for parsing the common information of JSON trace session files. Contains the basic C++ structs that represent the JSON data, which include JSONTraceSession as the root object.

See Trace::FindPlugin for more information regarding these JSON files.

Definition at line 24 of file TraceSessionFileParser.h.

Constructor & Destructor Documentation

◆ TraceSessionFileParser()

lldb_private::TraceSessionFileParser::TraceSessionFileParser ( Debugger debugger,
llvm::StringRef  session_file_dir,
llvm::StringRef  schema 
)
inline

Definition at line 33 of file TraceSessionFileParser.h.

Member Function Documentation

◆ BuildSchema()

std::string TraceSessionFileParser::BuildSchema ( llvm::StringRef  plugin_schema)
static

Build the full schema for a Trace plug-in.

Parameters
[in]plugin_schemaThe subschema that corresponds to the "trace" section of the schema.
Returns
The full schema containing the common attributes and the plug-in specific attributes.

Definition at line 67 of file TraceSessionFileParser.cpp.

◆ CreateJSONError()

Error TraceSessionFileParser::CreateJSONError ( llvm::json::Path::Root &  root,
const llvm::json::Value &  value 
)
protected

Create a user-friendly error message upon a JSON-parsing failure using the json::ObjectMapper functionality.

Parameters
[in]rootThe llvm::json::Path::Root used to parse the JSON value.
[in]valueThe json value that failed to parse.
Returns
An llvm::Error containing the user-friendly error message.

Definition at line 57 of file TraceSessionFileParser.cpp.

References string(), and lldb_private::toString().

◆ NormalizePath()

void TraceSessionFileParser::NormalizePath ( lldb_private::FileSpec file_spec)
protected

Resolve non-absolute paths relative to the session file folder.

It modifies the given file_spec.

Definition at line 23 of file TraceSessionFileParser.cpp.

References lldb_private::FileSpec::IsRelative(), and lldb_private::FileSpec::PrependPathComponent().

◆ ParseCommonSessionFile()

Expected< std::vector< TraceSessionFileParser::ParsedProcess > > TraceSessionFileParser::ParseCommonSessionFile ( const JSONTraceSessionBase session)

Parse the fields common to all trace session schemas.

Parameters
[in]sessionThe session json objects already deserialized.
Returns
A list of ParsedProcess containing all threads and targets created during the parsing, or an error in case of failures. In case of errors, no side effects are produced.

Definition at line 129 of file TraceSessionFileParser.cpp.

◆ ParseModule()

Error TraceSessionFileParser::ParseModule ( lldb::TargetSP &  target_sp,
const JSONModule module 
)
protected

◆ ParseProcess()

Expected< TraceSessionFileParser::ParsedProcess > TraceSessionFileParser::ParseProcess ( const JSONProcess process)
protected

Definition at line 90 of file TraceSessionFileParser.cpp.

◆ ParseThread()

ThreadPostMortemTraceSP TraceSessionFileParser::ParseThread ( lldb::ProcessSP &  process_sp,
const JSONThread thread 
)
protected

Definition at line 76 of file TraceSessionFileParser.cpp.

Member Data Documentation

◆ m_debugger

Debugger& lldb_private::TraceSessionFileParser::m_debugger
protected

Definition at line 86 of file TraceSessionFileParser.h.

◆ m_schema

llvm::StringRef lldb_private::TraceSessionFileParser::m_schema
protected

Definition at line 88 of file TraceSessionFileParser.h.

◆ m_session_file_dir

std::string lldb_private::TraceSessionFileParser::m_session_file_dir
protected

Definition at line 87 of file TraceSessionFileParser.h.


The documentation for this class was generated from the following files: