20 "Save the current session transcripts to a file.\n"
21 "If no file if specified, transcripts will be "
22 "saved to a temporary file.",
23 "session save [file]") {
31 llvm::StringRef file_path;
34 file_path = args[0].ref();
43#define LLDB_OPTIONS_history
44#include "CommandOptions.inc"
50 "Dump the history of commands in this session.\n"
51 "Commands in the history list can be run again "
52 "using \"!<INDEX>\". \"!-<OFFSET>\" will re-run "
53 "the command that is <OFFSET> commands from the end"
54 " of the list (counting the current command).",
74 switch (short_option) {
79 if (option_arg ==
"end") {
95 llvm_unreachable(
"Unimplemented option");
109 return llvm::ArrayRef(g_history_options);
129 result.
AppendError(
"--count, --start-index and --end-index cannot be "
130 "all specified in the same invocation");
133 std::pair<bool, uint64_t> start_idx(
136 std::pair<bool, uint64_t> stop_idx(
144 if (start_idx.first && start_idx.second ==
UINT64_MAX) {
146 start_idx.second = history.
GetSize() - count.second;
147 stop_idx.second = history.
GetSize() - 1;
148 }
else if (stop_idx.first) {
149 start_idx.second = stop_idx.second;
150 stop_idx.second = history.
GetSize() - 1;
152 start_idx.second = 0;
153 stop_idx.second = history.
GetSize() - 1;
156 if (!start_idx.first && !stop_idx.first && !count.first) {
157 start_idx.second = 0;
158 stop_idx.second = history.
GetSize() - 1;
159 }
else if (start_idx.first) {
161 stop_idx.second = start_idx.second + count.second - 1;
162 }
else if (!stop_idx.first) {
163 stop_idx.second = history.
GetSize() - 1;
165 }
else if (stop_idx.first) {
167 if (stop_idx.second >= count.second)
168 start_idx.second = stop_idx.second - count.second + 1;
170 start_idx.second = 0;
174 start_idx.second = 0;
175 stop_idx.second = count.second - 1;
189 "Commands controlling LLDB session.",
190 "session <subcommand> [<command-options>]") {
static llvm::raw_ostream & error(Stream &strm)
OptionValueBoolean m_clear
OptionValueUInt64 m_stop_idx
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
Set the value of an option.
~CommandOptions() override=default
void OptionParsingStarting(ExecutionContext *execution_context) override
OptionValueUInt64 m_start_idx
OptionValueUInt64 m_count
CommandObjectSessionHistory(CommandInterpreter &interpreter)
~CommandObjectSessionHistory() override=default
void DoExecute(Args &command, CommandReturnObject &result) override
Options * GetOptions() override
~CommandObjectSessionSave() override=default
void DoExecute(Args &args, CommandReturnObject &result) override
CommandObjectSessionSave(CommandInterpreter &interpreter)
A command line argument class.
void Dump(Stream &stream, size_t start_idx=0, size_t stop_idx=SIZE_MAX) const
bool SaveTranscript(CommandReturnObject &result, std::optional< std::string > output_file=std::nullopt)
Save the current debugger session transcript to a file on disk.
CommandHistory & GetCommandHistory()
bool LoadSubCommand(llvm::StringRef cmd_name, const lldb::CommandObjectSP &command_obj) override
CommandObjectSession(CommandInterpreter &interpreter)
void AddSimpleArgumentList(lldb::CommandArgumentType arg_type, ArgumentRepetitionType repetition_type=eArgRepeatPlain)
CommandInterpreter & m_interpreter
void void AppendError(llvm::StringRef in_string)
void SetStatus(lldb::ReturnStatus status)
Stream & GetOutputStream()
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
void SetCurrentValue(bool value)
bool GetCurrentValue() const
uint64_t GetCurrentValue() const
bool SetCurrentValue(uint64_t value)
Status SetValueFromString(llvm::StringRef value, VarSetOperationType op=eVarSetOperationAssign) override
bool OptionWasSet() const
A command line option parsing protocol class.
std::vector< Option > m_getopt_table
A class that represents a running process on the host machine.
std::shared_ptr< lldb_private::CommandObject > CommandObjectSP
@ eReturnStatusSuccessFinishNoResult