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]") {
41 llvm::StringRef file_path;
44 file_path = args[0].ref();
54#define LLDB_OPTIONS_history
55#include "CommandOptions.inc"
61 "Dump the history of commands in this session.\n"
62 "Commands in the history list can be run again "
63 "using \"!<INDEX>\". \"!-<OFFSET>\" will re-run "
64 "the command that is <OFFSET> commands from the end"
65 " of the list (counting the current command).",
85 switch (short_option) {
90 if (option_arg ==
"end") {
106 llvm_unreachable(
"Unimplemented option");
120 return llvm::ArrayRef(g_history_options);
140 result.
AppendError(
"--count, --start-index and --end-index cannot be "
141 "all specified in the same invocation");
144 std::pair<bool, uint64_t> start_idx(
147 std::pair<bool, uint64_t> stop_idx(
155 if (start_idx.first && start_idx.second ==
UINT64_MAX) {
157 start_idx.second = history.
GetSize() - count.second;
158 stop_idx.second = history.
GetSize() - 1;
159 }
else if (stop_idx.first) {
160 start_idx.second = stop_idx.second;
161 stop_idx.second = history.
GetSize() - 1;
163 start_idx.second = 0;
164 stop_idx.second = history.
GetSize() - 1;
167 if (!start_idx.first && !stop_idx.first && !count.first) {
168 start_idx.second = 0;
169 stop_idx.second = history.
GetSize() - 1;
170 }
else if (start_idx.first) {
172 stop_idx.second = start_idx.second + count.second - 1;
173 }
else if (!stop_idx.first) {
174 stop_idx.second = history.
GetSize() - 1;
176 }
else if (stop_idx.first) {
178 if (stop_idx.second >= count.second)
179 start_idx.second = stop_idx.second - count.second + 1;
181 start_idx.second = 0;
185 start_idx.second = 0;
186 stop_idx.second = count.second - 1;
201 "Commands controlling LLDB session.",
202 "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
bool DoExecute(Args &command, CommandReturnObject &result) override
Options * GetOptions() override
bool DoExecute(Args &args, CommandReturnObject &result) override
void HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) override
The input array contains a parsed version of the line.
~CommandObjectSessionSave() override=default
CommandObjectSessionSave(CommandInterpreter &interpreter)
A command line argument class.
static bool InvokeCommonCompletionCallbacks(CommandInterpreter &interpreter, uint32_t completion_mask, lldb_private::CompletionRequest &request, SearchFilter *searcher)
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)
std::vector< CommandArgumentData > CommandArgumentEntry
std::vector< CommandArgumentEntry > m_arguments
CommandInterpreter & GetCommandInterpreter()
CommandInterpreter & m_interpreter
void void AppendError(llvm::StringRef in_string)
void SetStatus(lldb::ReturnStatus status)
Stream & GetOutputStream()
"lldb/Utility/ArgCompletionRequest.h"
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
void SetCurrentValue(bool value)
bool GetCurrentValue() const
uint64_t GetCurrentValue() const
Status SetValueFromString(llvm::StringRef value, VarSetOperationType op=eVarSetOperationAssign) override
void SetCurrentValue(uint64_t value)
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::vector< OptionArgElement > OptionElementVector
@ eReturnStatusSuccessFinishNoResult