11#include "../common/TraceHTR.h"
24#define LLDB_OPTIONS_thread_trace_export_ctf
25#include "TraceExporterCTFCommandOptions.inc"
28 uint32_t option_idx, llvm::StringRef option_arg,
33 switch (short_option) {
35 m_file.assign(std::string(option_arg));
40 if (option_arg.empty() || option_arg.getAsInteger(0, thread_index) ||
43 "invalid integer value for option '{0}'", option_arg);
49 llvm_unreachable(
"Unimplemented option");
57 m_thread_index = std::nullopt;
60llvm::ArrayRef<OptionDefinition>
62 return llvm::ArrayRef(g_thread_trace_export_ctf_options);
75 if (thread ==
nullptr) {
79 "Thread index {0} is out of range (valid values are 1 - {1}).\n", tid,
82 auto do_work = [&]() ->
Error {
83 Expected<TraceCursorSP> cursor = trace_sp->CreateNewCursor(*thread);
85 return cursor.takeError();
91 if (llvm::Error err = do_work()) {
static llvm::raw_ostream & error(Stream &strm)
A command line argument class.
ExecutionContext m_exe_ctx
Thread * GetDefaultThread()
void AppendErrorWithFormatv(const char *format, Args &&... args)
void AppendErrorWithFormat(const char *format,...) __attribute__((format(printf
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
const lldb::TargetSP & GetTargetSP() const
Get accessor to get the target shared pointer.
Process * GetProcessPtr() const
Returns a pointer to the process object.
std::vector< Option > m_getopt_table
A plug-in interface definition class for debugging a process.
ThreadList & GetThreadList()
static Status static Status FromErrorStringWithFormatv(const char *format, Args &&...args)
uint32_t GetSize(bool can_update=true)
lldb::ThreadSP FindThreadByIndexID(uint32_t index_id, bool can_update=true)
Top-level HTR class See lldb/docs/htr.rst for comprehensive HTR documentation.
llvm::Error Export(std::string outfile)
Export HTR layers to the specified format and outfile.
void ExecutePasses()
Executes passes on the HTR layers until no further summarization/compression is achieved.
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
Set the value of an option.
void OptionParsingStarting(ExecutionContext *execution_context) override
std::optional< size_t > m_thread_index
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
void DoExecute(Args &args, CommandReturnObject &result) override
#define LLDB_INVALID_THREAD_ID
A class that represents a running process on the host machine.
const char * toString(AppleArm64ExceptionClass EC)
std::shared_ptr< lldb_private::Trace > TraceSP