LLDB mainline
lldb_private::CommandInterpreter Class Reference

#include <CommandInterpreter.h>

Inheritance diagram for lldb_private::CommandInterpreter:
[legend]

Public Types

enum  {
  eBroadcastBitThreadShouldExit = (1 << 0) , eBroadcastBitResetPrompt = (1 << 1) , eBroadcastBitQuitCommandReceived = (1 << 2) , eBroadcastBitAsynchronousOutputData = (1 << 3) ,
  eBroadcastBitAsynchronousErrorData = (1 << 4)
}
enum  ChildrenOmissionWarningStatus { eNoOmission = 0 , eUnwarnedOmission = 1 , eWarnedOmission = 2 }
 Tristate boolean to manage children omission warnings. More...
enum  CommandTypes {
  eCommandTypesBuiltin = 0x0001 , eCommandTypesUserDef = 0x0002 , eCommandTypesUserMW = 0x0004 , eCommandTypesAliases = 0x0008 ,
  eCommandTypesHidden = 0x0010 , eCommandTypesAllThem = 0xFFFF
}
using CommandReturnObjectCallback
Public Types inherited from lldb_private::IOHandlerDelegate
enum class  Completion { None , LLDBCommand , Expression }

Public Member Functions

 CommandInterpreter (Debugger &debugger, bool synchronous_execution)
 ~CommandInterpreter () override=default
llvm::StringRef GetBroadcasterClass () const override
 This needs to be filled in if you are going to register the broadcaster with the broadcaster manager and do broadcaster class matching.
void SourceInitFileCwd (CommandReturnObject &result)
void SourceInitFileHome (CommandReturnObject &result, bool is_repl)
 We will first see if there is an application specific ".lldbinit" file whose name is "~/.lldbinit" followed by a "-" and the name of the program.
void SourceInitFileGlobal (CommandReturnObject &result)
bool AddCommand (llvm::StringRef name, const lldb::CommandObjectSP &cmd_sp, bool can_replace)
Status AddUserCommand (llvm::StringRef name, const lldb::CommandObjectSP &cmd_sp, bool can_replace)
lldb::CommandObjectSP GetCommandSPExact (llvm::StringRef cmd, bool include_aliases=false) const
CommandObjectGetCommandObject (llvm::StringRef cmd, StringList *matches=nullptr, StringList *descriptions=nullptr) const
CommandObjectGetUserCommandObject (llvm::StringRef cmd, StringList *matches=nullptr, StringList *descriptions=nullptr) const
CommandObjectGetAliasCommandObject (llvm::StringRef cmd, StringList *matches=nullptr, StringList *descriptions=nullptr) const
bool CommandExists (llvm::StringRef cmd) const
 Determine whether a root level, built-in command with this name exists.
bool AliasExists (llvm::StringRef cmd) const
 Determine whether an alias command with this name exists.
bool UserCommandExists (llvm::StringRef cmd) const
 Determine whether a root-level user command with this name exists.
bool UserMultiwordCommandExists (llvm::StringRef cmd) const
 Determine whether a root-level user multiword command with this name exists.
CommandObjectMultiwordVerifyUserMultiwordCmdPath (Args &path, bool leaf_is_command, Status &result)
 Look up the command pointed to by path encoded in the arguments of the incoming command object.
CommandAliasAddAlias (llvm::StringRef alias_name, lldb::CommandObjectSP &command_obj_sp, llvm::StringRef args_string=llvm::StringRef())
bool RemoveCommand (llvm::StringRef cmd, bool force=false)
 Remove a command if it is removable (python or regex command).
bool RemoveAlias (llvm::StringRef alias_name)
bool GetAliasFullName (llvm::StringRef cmd, std::string &full_name) const
bool RemoveUserMultiword (llvm::StringRef multiword_name)
void RemoveAllUserMultiword ()
bool RemoveUser (llvm::StringRef alias_name)
void RemoveAllUser ()
const CommandAliasGetAlias (llvm::StringRef alias_name) const
CommandObjectBuildAliasResult (llvm::StringRef alias_name, std::string &raw_input_string, std::string &alias_result, CommandReturnObject &result)
bool HandleCommand (const char *command_line, LazyBool add_to_history, const ExecutionContext &override_context, CommandReturnObject &result)
bool HandleCommand (const char *command_line, LazyBool add_to_history, CommandReturnObject &result, bool force_repeat_command=false)
bool InterruptCommand ()
void HandleCommands (const StringList &commands, const ExecutionContext &context, const CommandInterpreterRunOptions &options, CommandReturnObject &result)
 Execute a list of commands in sequence.
void HandleCommands (const StringList &commands, const CommandInterpreterRunOptions &options, CommandReturnObject &result)
void HandleCommandsFromFile (FileSpec &file, const ExecutionContext &context, const CommandInterpreterRunOptions &options, CommandReturnObject &result)
 Execute a list of commands from a file.
void HandleCommandsFromFile (FileSpec &file, const CommandInterpreterRunOptions &options, CommandReturnObject &result)
CommandObjectGetCommandObjectForCommand (llvm::StringRef &command_line)
std::optional< std::string > GetAutoSuggestionForCommand (llvm::StringRef line)
 Returns the auto-suggestion string that should be added to the given command line.
void HandleCompletion (CompletionRequest &request)
void HandleCompletionMatches (CompletionRequest &request)
int GetCommandNamesMatchingPartialString (const char *cmd_cstr, bool include_aliases, StringList &matches, StringList &descriptions)
void GetHelp (CommandReturnObject &result, uint32_t types=eCommandTypesAllThem)
void GetAliasHelp (const char *alias_name, StreamString &help_string)
void OutputFormattedHelpText (Stream &strm, llvm::StringRef prefix, llvm::StringRef help_text)
void OutputFormattedHelpText (Stream &stream, llvm::StringRef command_word, llvm::StringRef separator, llvm::StringRef help_text, size_t max_word_len)
void OutputHelpText (Stream &stream, llvm::StringRef command_word, llvm::StringRef separator, llvm::StringRef help_text, uint32_t max_word_len)
DebuggerGetDebugger ()
ExecutionContext GetExecutionContext () const
lldb::PlatformSP GetPlatform (bool prefer_target_platform)
const char * ProcessEmbeddedScriptCommands (const char *arg)
void UpdatePrompt (llvm::StringRef prompt)
void UpdateUseColor (bool use_color)
bool Confirm (llvm::StringRef message, bool default_answer)
void LoadCommandDictionary ()
void Initialize ()
void Clear ()
bool HasCommands () const
bool HasAliases () const
bool HasUserCommands () const
bool HasUserMultiwordCommands () const
bool HasAliasOptions () const
void BuildAliasCommandArgs (CommandObject *alias_cmd_obj, const char *alias_name, Args &cmd_args, std::string &raw_input_string, CommandReturnObject &result)
int GetOptionArgumentPosition (const char *in_string)
 Picks the number out of a string of the form "%NNN", otherwise return 0.
void SkipLLDBInitFiles (bool skip_lldbinit_files)
void SkipAppInitFiles (bool skip_app_init_files)
bool GetSynchronous ()
void FindCommandsForApropos (llvm::StringRef word, StringList &commands_found, StringList &commands_help, bool search_builtin_commands, bool search_user_commands, bool search_alias_commands, bool search_user_mw_commands)
bool GetBatchCommandMode ()
bool SetBatchCommandMode (bool value)
void ChildrenTruncated ()
void SetReachedMaximumDepth ()
void PrintWarningsIfNecessary (Stream &s, const std::string &cmd_name)
CommandHistoryGetCommandHistory ()
bool IsActive ()
CommandInterpreterRunResult RunCommandInterpreter (CommandInterpreterRunOptions &options)
void GetLLDBCommandsFromIOHandler (const char *prompt, IOHandlerDelegate &delegate, void *baton=nullptr)
void GetPythonCommandsFromIOHandler (const char *prompt, IOHandlerDelegate &delegate, void *baton=nullptr)
const char * GetCommandPrefix ()
bool GetExpandRegexAliases () const
bool GetPromptOnQuit () const
void SetPromptOnQuit (bool enable)
bool GetSaveTranscript () const
void SetSaveTranscript (bool enable)
bool GetSaveSessionOnQuit () const
void SetSaveSessionOnQuit (bool enable)
bool GetOpenTranscriptInEditor () const
void SetOpenTranscriptInEditor (bool enable)
FileSpec GetSaveSessionDirectory () const
void SetSaveSessionDirectory (llvm::StringRef path)
bool GetEchoCommands () const
void SetEchoCommands (bool enable)
bool GetEchoCommentCommands () const
void SetEchoCommentCommands (bool enable)
bool GetRepeatPreviousCommand () const
bool GetRequireCommandOverwrite () const
const CommandObject::CommandMapGetUserCommands () const
const CommandObject::CommandMapGetUserMultiwordCommands () const
const CommandObject::CommandMapGetCommands () const
const CommandObject::CommandMapGetAliases () const
void AllowExitCodeOnQuit (bool allow)
 Specify if the command interpreter should allow that the user can specify a custom exit code when calling 'quit'.
bool SetQuitExitCode (int exit_code)
 Sets the exit code for the quit command.
int GetQuitExitCode (bool &exited) const
 Returns the exit code that the user has specified when running the 'quit' command.
void ResolveCommand (const char *command_line, CommandReturnObject &result)
bool GetStopCmdSourceOnError () const
lldb::IOHandlerSP GetIOHandler (bool force_create=false, CommandInterpreterRunOptions *options=nullptr)
bool GetSpaceReplPrompts () const
bool SaveTranscript (CommandReturnObject &result, std::optional< std::string > output_file=std::nullopt)
 Save the current debugger session transcript to a file on disk.
FileSpec GetCurrentSourceDir ()
bool IsInteractive ()
bool IOHandlerInterrupt (IOHandler &io_handler) override
Status PreprocessCommand (std::string &command)
Status PreprocessToken (std::string &token)
void IncreaseCommandUsage (const CommandObject &cmd_obj)
void SetPrintCallback (CommandReturnObjectCallback callback)
llvm::json::Value GetStatistics ()
const StructuredData::ArrayGetTranscript () const
Public Member Functions inherited from lldb_private::Broadcaster
 Broadcaster (lldb::BroadcasterManagerSP manager_sp, std::string name)
 Construct with a broadcaster with a name.
virtual ~Broadcaster ()
 Destructor.
void CheckInWithManager ()
void BroadcastEvent (lldb::EventSP &event_sp)
 Broadcast an event which has no associated data.
void BroadcastEventIfUnique (lldb::EventSP &event_sp)
void BroadcastEvent (uint32_t event_type, const lldb::EventDataSP &event_data_sp)
void BroadcastEvent (uint32_t event_type)
void BroadcastEventIfUnique (uint32_t event_type)
void Clear ()
virtual void AddInitialEventsToListener (const lldb::ListenerSP &listener_sp, uint32_t requested_events)
uint32_t AddListener (const lldb::ListenerSP &listener_sp, uint32_t event_mask)
 Listen for any events specified by event_mask.
const std::string & GetBroadcasterName ()
 Get this broadcaster's name.
bool GetEventNames (Stream &s, const uint32_t event_mask, bool prefix_with_broadcaster_name) const
 Get the event name(s) for one or more event bits.
void SetEventName (uint32_t event_mask, const char *name)
 Set the name for an event bit.
const char * GetEventName (uint32_t event_mask) const
bool EventTypeHasListeners (uint32_t event_type)
bool RemoveListener (const lldb::ListenerSP &listener_sp, uint32_t event_mask=UINT32_MAX)
 Removes a Listener from this broadcasters list and frees the event bits specified by event_mask that were previously acquired by listener (assuming listener was listening to this object) for other listener objects to use.
bool HijackBroadcaster (const lldb::ListenerSP &listener_sp, uint32_t event_mask=UINT32_MAX)
 Provides a simple mechanism to temporarily redirect events from broadcaster.
bool IsHijackedForEvent (uint32_t event_mask)
void RestoreBroadcaster ()
 Restore the state of the Broadcaster from a previous hijack attempt.
lldb::BroadcasterManagerSP GetManager ()
void SetPrimaryListener (lldb::ListenerSP listener_sp)
lldb::ListenerSP GetPrimaryListener ()
Public Member Functions inherited from lldb_private::Properties
 Properties ()
 Properties (const lldb::OptionValuePropertiesSP &collection_sp)
virtual ~Properties ()
lldb::OptionValuePropertiesSP GetValueProperties () const
virtual lldb::OptionValueSP GetPropertyValue (const ExecutionContext *exe_ctx, llvm::StringRef property_path, Status &error) const
virtual Status SetPropertyValue (const ExecutionContext *exe_ctx, VarSetOperationType op, llvm::StringRef property_path, llvm::StringRef value)
virtual Status DumpPropertyValue (const ExecutionContext *exe_ctx, Stream &strm, llvm::StringRef property_path, uint32_t dump_mask, bool is_json=false)
virtual void DumpAllPropertyValues (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask, bool is_json=false)
virtual void DumpAllDescriptions (CommandInterpreter &interpreter, Stream &strm) const
size_t Apropos (llvm::StringRef keyword, std::vector< const Property * > &matching_properties) const
template<typename T>
GetPropertyAtIndexAs (uint32_t idx, T default_value, const ExecutionContext *exe_ctx=nullptr) const
template<typename T, typename U = typename std::remove_pointer<T>::type, std::enable_if_t< std::is_pointer_v< T >, bool > = true>
const U * GetPropertyAtIndexAs (uint32_t idx, const ExecutionContext *exe_ctx=nullptr) const
template<typename T>
bool SetPropertyAtIndex (uint32_t idx, T t, const ExecutionContext *exe_ctx=nullptr) const
Public Member Functions inherited from lldb_private::IOHandlerDelegate
 IOHandlerDelegate (Completion completion=Completion::None)
virtual ~IOHandlerDelegate ()=default
virtual void IOHandlerActivated (IOHandler &io_handler, bool interactive)
virtual void IOHandlerDeactivated (IOHandler &io_handler)
virtual std::optional< std::string > IOHandlerSuggestion (IOHandler &io_handler, llvm::StringRef line)
virtual void IOHandlerComplete (IOHandler &io_handler, CompletionRequest &request)
virtual const char * IOHandlerGetFixIndentationCharacters ()
virtual int IOHandlerFixIndentation (IOHandler &io_handler, const StringList &lines, int cursor_position)
 Called when a new line is created or one of an identified set of indentation characters is typed.
virtual void IOHandlerInputInterrupted (IOHandler &io_handler, std::string &data)
virtual bool IOHandlerIsInputComplete (IOHandler &io_handler, StringList &lines)
 Called to determine whether typing enter after the last line in lines should end input.
virtual const char * IOHandlerGetCommandPrefix ()
virtual const char * IOHandlerGetHelpPrologue ()

Static Public Member Functions

static llvm::StringRef GetStaticBroadcasterClass ()
Static Public Member Functions inherited from lldb_private::Properties
static llvm::StringRef GetExperimentalSettingsName ()
static bool IsSettingExperimental (llvm::StringRef setting)

Static Public Attributes

static const char * g_no_argument = "<no-argument>"
static const char * g_need_argument = "<need-argument>"
static const char * g_argument = "<argument>"

Protected Member Functions

bool WasInterrupted () const
void IOHandlerInputComplete (IOHandler &io_handler, std::string &line) override
 Called when a line or lines have been retrieved.
llvm::StringRef IOHandlerGetControlSequence (char ch) override
void GetProcessOutput ()
bool DidProcessStopAbnormally () const
void SetSynchronous (bool value)
lldb::CommandObjectSP GetCommandSP (llvm::StringRef cmd, bool include_aliases=true, bool exact=true, StringList *matches=nullptr, StringList *descriptions=nullptr) const
Protected Member Functions inherited from lldb_private::Broadcaster
BroadcasterImplSP GetBroadcasterImpl ()
const char * GetHijackingListenerName ()

Private Types

enum class  CommandHandlingState { eIdle , eInProgress , eInterrupted }
typedef llvm::StringMap< uint64_t > CommandUsageMap
 Command usage statistics.

Private Member Functions

void OverrideExecutionContext (const ExecutionContext &override_context)
void RestoreExecutionContext ()
void SourceInitFile (FileSpec file, CommandReturnObject &result)
CommandObjectResolveCommandImpl (std::string &command_line, CommandReturnObject &result)
void FindCommandsForApropos (llvm::StringRef word, StringList &commands_found, StringList &commands_help, const CommandObject::CommandMap &command_map)
void PrintCommandOutput (IOHandler &io_handler, llvm::StringRef str, bool is_stdout)
bool EchoCommandNonInteractive (llvm::StringRef line, const Flags &io_handler_flags) const
lldb::CommandObjectSP GetFrameLanguageCommand () const
 Return the language specific command object for the current frame.
void StartHandlingCommand ()
void FinishHandlingCommand ()

Private Attributes

std::atomic< CommandHandlingStatem_command_state
int m_iohandler_nesting_level = 0
Debuggerm_debugger
std::stack< ExecutionContextm_overriden_exe_contexts
bool m_synchronous_execution
bool m_skip_lldbinit_files
bool m_skip_app_init_files
CommandObject::CommandMap m_command_dict
CommandObject::CommandMap m_alias_dict
CommandObject::CommandMap m_user_dict
CommandObject::CommandMap m_user_mw_dict
CommandHistory m_command_history
std::string m_repeat_command
lldb::IOHandlerSP m_command_io_handler_sp
char m_comment_char
bool m_batch_command_mode
ChildrenOmissionWarningStatus m_truncation_warning
 Whether we truncated a value's list of children and whether the user has been told.
ChildrenOmissionWarningStatus m_max_depth_warning
 Whether we reached the maximum child nesting depth and whether the user has been told.
uint32_t m_command_source_depth
std::vector< FileSpecm_command_source_dirs
 A stack of directory paths.
std::vector< uint32_t > m_command_source_flags
CommandInterpreterRunResult m_result
CommandReturnObjectCallback m_print_callback
 An optional callback to handle printing the CommandReturnObject.
std::optional< int > m_quit_exit_code
bool m_allow_exit_code = false
CommandUsageMap m_command_usages
StreamString m_transcript_stream
 Turn on settings interpreter.save-transcript for LLDB to populate this stream.
StructuredData::Array m_transcript
 Contains a list of handled commands and their details.

Friends

class Debugger

Additional Inherited Members

Protected Types inherited from lldb_private::Broadcaster
typedef std::shared_ptr< BroadcasterImplBroadcasterImplSP
typedef std::weak_ptr< BroadcasterImplBroadcasterImplWP
Protected Attributes inherited from lldb_private::Properties
lldb::OptionValuePropertiesSP m_collection_sp
Protected Attributes inherited from lldb_private::IOHandlerDelegate
Completion m_completion

Detailed Description

Definition at line 229 of file CommandInterpreter.h.

Member Typedef Documentation

◆ CommandReturnObjectCallback

Initial value:
CommandReturnObjectCallbackResult
Callback return value, indicating whether it handled printing the CommandReturnObject or deferred doi...

Definition at line 257 of file CommandInterpreter.h.

◆ CommandUsageMap

typedef llvm::StringMap<uint64_t> lldb_private::CommandInterpreter::CommandUsageMap
private

Command usage statistics.

Definition at line 802 of file CommandInterpreter.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
eBroadcastBitThreadShouldExit 
eBroadcastBitResetPrompt 
eBroadcastBitQuitCommandReceived 
eBroadcastBitAsynchronousOutputData 
eBroadcastBitAsynchronousErrorData 

Definition at line 233 of file CommandInterpreter.h.

◆ ChildrenOmissionWarningStatus

Tristate boolean to manage children omission warnings.

Enumerator
eNoOmission 

No children were omitted.

eUnwarnedOmission 

Children omitted, and not yet notified.

eWarnedOmission 

Children omitted and notified.

Definition at line 242 of file CommandInterpreter.h.

◆ CommandHandlingState

Enumerator
eIdle 
eInProgress 
eInterrupted 

Definition at line 740 of file CommandInterpreter.h.

◆ CommandTypes

Enumerator
eCommandTypesBuiltin 

native commands such as "frame"

eCommandTypesUserDef 

scripted commands

eCommandTypesUserMW 

multiword commands (command containers)

eCommandTypesAliases 

aliases such as "po"

eCommandTypesHidden 

commands prefixed with an underscore

eCommandTypesAllThem 

all commands

Definition at line 248 of file CommandInterpreter.h.

Constructor & Destructor Documentation

◆ CommandInterpreter()

◆ ~CommandInterpreter()

lldb_private::CommandInterpreter::~CommandInterpreter ( )
overridedefault

Member Function Documentation

◆ AddAlias()

CommandAlias * CommandInterpreter::AddAlias ( llvm::StringRef alias_name,
lldb::CommandObjectSP & command_obj_sp,
llvm::StringRef args_string = llvm::StringRef() )

Definition at line 1467 of file CommandInterpreter.cpp.

References lldbassert, and m_alias_dict.

Referenced by Initialize().

◆ AddCommand()

bool CommandInterpreter::AddCommand ( llvm::StringRef name,
const lldb::CommandObjectSP & cmd_sp,
bool can_replace )

Definition at line 1224 of file CommandInterpreter.cpp.

References lldbassert, and m_command_dict.

◆ AddUserCommand()

◆ AliasExists()

bool CommandInterpreter::AliasExists ( llvm::StringRef cmd) const

Determine whether an alias command with this name exists.

Definition at line 1454 of file CommandInterpreter.cpp.

References m_alias_dict.

◆ AllowExitCodeOnQuit()

void CommandInterpreter::AllowExitCodeOnQuit ( bool allow)

Specify if the command interpreter should allow that the user can specify a custom exit code when calling 'quit'.

Definition at line 236 of file CommandInterpreter.cpp.

References m_allow_exit_code, and m_quit_exit_code.

◆ BuildAliasCommandArgs()

◆ BuildAliasResult()

◆ ChildrenTruncated()

void lldb_private::CommandInterpreter::ChildrenTruncated ( )
inline

Definition at line 532 of file CommandInterpreter.h.

References eNoOmission, eUnwarnedOmission, and m_truncation_warning.

◆ Clear()

void CommandInterpreter::Clear ( )

Definition at line 542 of file CommandInterpreter.cpp.

References m_command_io_handler_sp.

◆ CommandExists()

bool CommandInterpreter::CommandExists ( llvm::StringRef cmd) const

Determine whether a root level, built-in command with this name exists.

Definition at line 1421 of file CommandInterpreter.cpp.

References m_command_dict.

Referenced by AddUserCommand().

◆ Confirm()

bool CommandInterpreter::Confirm ( llvm::StringRef message,
bool default_answer )

◆ DidProcessStopAbnormally()

◆ EchoCommandNonInteractive()

bool CommandInterpreter::EchoCommandNonInteractive ( llvm::StringRef line,
const Flags & io_handler_flags ) const
private

◆ FindCommandsForApropos() [1/2]

void CommandInterpreter::FindCommandsForApropos ( llvm::StringRef word,
StringList & commands_found,
StringList & commands_help,
bool search_builtin_commands,
bool search_user_commands,
bool search_alias_commands,
bool search_user_mw_commands )

◆ FindCommandsForApropos() [2/2]

void CommandInterpreter::FindCommandsForApropos ( llvm::StringRef word,
StringList & commands_found,
StringList & commands_help,
const CommandObject::CommandMap & command_map )
private

◆ FinishHandlingCommand()

void CommandInterpreter::FinishHandlingCommand ( )
private

Definition at line 3202 of file CommandInterpreter.cpp.

References eIdle, lldbassert, m_command_state, and m_iohandler_nesting_level.

Referenced by IOHandlerInputComplete().

◆ GetAlias()

const CommandAlias * CommandInterpreter::GetAlias ( llvm::StringRef alias_name) const

Definition at line 2339 of file CommandInterpreter.cpp.

References m_alias_dict.

Referenced by BuildAliasCommandArgs().

◆ GetAliasCommandObject()

CommandObject * CommandInterpreter::GetAliasCommandObject ( llvm::StringRef cmd,
StringList * matches = nullptr,
StringList * descriptions = nullptr ) const

◆ GetAliases()

const CommandObject::CommandMap & lldb_private::CommandInterpreter::GetAliases ( ) const
inline

Definition at line 619 of file CommandInterpreter.h.

References m_alias_dict.

Referenced by GetAliasCommandObject().

◆ GetAliasFullName()

bool CommandInterpreter::GetAliasFullName ( llvm::StringRef cmd,
std::string & full_name ) const

◆ GetAliasHelp()

void lldb_private::CommandInterpreter::GetAliasHelp ( const char * alias_name,
StreamString & help_string )

◆ GetAutoSuggestionForCommand()

std::optional< std::string > CommandInterpreter::GetAutoSuggestionForCommand ( llvm::StringRef line)

Returns the auto-suggestion string that should be added to the given command line.

Definition at line 2300 of file CommandInterpreter.cpp.

References m_command_history.

Referenced by lldb_private::IOHandlerDelegate::IOHandlerSuggestion().

◆ GetBatchCommandMode()

bool lldb_private::CommandInterpreter::GetBatchCommandMode ( )
inline

Definition at line 524 of file CommandInterpreter.h.

References m_batch_command_mode.

◆ GetBroadcasterClass()

llvm::StringRef lldb_private::CommandInterpreter::GetBroadcasterClass ( ) const
inlineoverridevirtual

This needs to be filled in if you are going to register the broadcaster with the broadcaster manager and do broadcaster class matching.

FIXME: Probably should make a ManagedBroadcaster subclass with all the bits needed to work with the BroadcasterManager, so that it is clearer how to add one.

Reimplemented from lldb_private::Broadcaster.

Definition at line 277 of file CommandInterpreter.h.

References GetStaticBroadcasterClass().

◆ GetCommandHistory()

CommandHistory & lldb_private::CommandInterpreter::GetCommandHistory ( )
inline

Definition at line 562 of file CommandInterpreter.h.

References m_command_history.

◆ GetCommandNamesMatchingPartialString()

int CommandInterpreter::GetCommandNamesMatchingPartialString ( const char * cmd_cstr,
bool include_aliases,
StringList & matches,
StringList & descriptions )

◆ GetCommandObject()

CommandObject * CommandInterpreter::GetCommandObject ( llvm::StringRef cmd,
StringList * matches = nullptr,
StringList * descriptions = nullptr ) const

◆ GetCommandObjectForCommand()

◆ GetCommandPrefix()

const char * CommandInterpreter::GetCommandPrefix ( )

Definition at line 2646 of file CommandInterpreter.cpp.

References GetDebugger(), and lldb_private::Debugger::GetIOHandlerCommandPrefix().

Referenced by GetHelp().

◆ GetCommands()

const CommandObject::CommandMap & lldb_private::CommandInterpreter::GetCommands ( ) const
inline

Definition at line 615 of file CommandInterpreter.h.

References m_command_dict.

◆ GetCommandSP()

◆ GetCommandSPExact()

CommandObjectSP CommandInterpreter::GetCommandSPExact ( llvm::StringRef cmd,
bool include_aliases = false ) const

◆ GetCurrentSourceDir()

FileSpec CommandInterpreter::GetCurrentSourceDir ( )

◆ GetDebugger()

◆ GetEchoCommands()

bool CommandInterpreter::GetEchoCommands ( ) const

◆ GetEchoCommentCommands()

bool CommandInterpreter::GetEchoCommentCommands ( ) const

◆ GetExecutionContext()

◆ GetExpandRegexAliases()

bool CommandInterpreter::GetExpandRegexAliases ( ) const

◆ GetFrameLanguageCommand()

CommandObjectSP CommandInterpreter::GetFrameLanguageCommand ( ) const
private

Return the language specific command object for the current frame.

For example, when stopped on a C++ frame, this returns the command object for "language cplusplus" (CommandObjectMultiwordItaniumABI).

Definition at line 1048 of file CommandInterpreter.cpp.

References lldb_private::Language::FindPlugin(), GetExecutionContext(), lldb_private::ExecutionContext::GetFrameSP(), lldb_private::Language::GetPrimaryLanguage(), and m_command_dict.

Referenced by GetCommandSP().

◆ GetHelp()

◆ GetIOHandler()

◆ GetLLDBCommandsFromIOHandler()

void CommandInterpreter::GetLLDBCommandsFromIOHandler ( const char * prompt,
IOHandlerDelegate & delegate,
void * baton = nullptr )

◆ GetOpenTranscriptInEditor()

bool CommandInterpreter::GetOpenTranscriptInEditor ( ) const

Definition at line 193 of file CommandInterpreter.cpp.

References lldb_private::Properties::GetPropertyAtIndexAs().

Referenced by SaveTranscript().

◆ GetOptionArgumentPosition()

int CommandInterpreter::GetOptionArgumentPosition ( const char * in_string)

Picks the number out of a string of the form "%NNN", otherwise return 0.

Definition at line 2479 of file CommandInterpreter.cpp.

Referenced by BuildAliasCommandArgs(), and BuildAliasResult().

◆ GetPlatform()

◆ GetProcessOutput()

void CommandInterpreter::GetProcessOutput ( )
protected

Definition at line 3186 of file CommandInterpreter.cpp.

References GetExecutionContext(), and m_debugger.

Referenced by IOHandlerInputComplete().

◆ GetPromptOnQuit()

bool CommandInterpreter::GetPromptOnQuit ( ) const

◆ GetPythonCommandsFromIOHandler()

void CommandInterpreter::GetPythonCommandsFromIOHandler ( const char * prompt,
IOHandlerDelegate & delegate,
void * baton = nullptr )

◆ GetQuitExitCode()

int CommandInterpreter::GetQuitExitCode ( bool & exited) const

Returns the exit code that the user has specified when running the 'quit' command.

Parameters
[out]exitedSet to true if the user has called quit with a custom exit code.

Definition at line 249 of file CommandInterpreter.cpp.

References m_quit_exit_code.

◆ GetRepeatPreviousCommand()

bool CommandInterpreter::GetRepeatPreviousCommand ( ) const

Definition at line 277 of file CommandInterpreter.cpp.

References lldb_private::Properties::GetPropertyAtIndexAs().

Referenced by HandleCommand().

◆ GetRequireCommandOverwrite()

bool CommandInterpreter::GetRequireCommandOverwrite ( ) const

◆ GetSaveSessionDirectory()

FileSpec CommandInterpreter::GetSaveSessionDirectory ( ) const

Definition at line 204 of file CommandInterpreter.cpp.

References lldb_private::Properties::GetPropertyAtIndexAs().

Referenced by SaveTranscript().

◆ GetSaveSessionOnQuit()

bool CommandInterpreter::GetSaveSessionOnQuit ( ) const

◆ GetSaveTranscript()

bool CommandInterpreter::GetSaveTranscript ( ) const

◆ GetSpaceReplPrompts()

bool CommandInterpreter::GetSpaceReplPrompts ( ) const

◆ GetStaticBroadcasterClass()

llvm::StringRef CommandInterpreter::GetStaticBroadcasterClass ( )
static

◆ GetStatistics()

llvm::json::Value CommandInterpreter::GetStatistics ( )

Definition at line 3791 of file CommandInterpreter.cpp.

References m_command_usages.

◆ GetStopCmdSourceOnError()

bool CommandInterpreter::GetStopCmdSourceOnError ( ) const

◆ GetSynchronous()

bool CommandInterpreter::GetSynchronous ( )

◆ GetTranscript()

const StructuredData::Array & CommandInterpreter::GetTranscript ( ) const

Definition at line 3798 of file CommandInterpreter.cpp.

References m_transcript.

◆ GetUserCommandObject()

◆ GetUserCommands()

const CommandObject::CommandMap & lldb_private::CommandInterpreter::GetUserCommands ( ) const
inline

Definition at line 607 of file CommandInterpreter.h.

References m_user_dict.

Referenced by GetUserCommandObject().

◆ GetUserMultiwordCommands()

const CommandObject::CommandMap & lldb_private::CommandInterpreter::GetUserMultiwordCommands ( ) const
inline

Definition at line 611 of file CommandInterpreter.h.

References m_user_mw_dict.

Referenced by GetUserCommandObject().

◆ HandleCommand() [1/2]

bool CommandInterpreter::HandleCommand ( const char * command_line,
LazyBool add_to_history,
CommandReturnObject & result,
bool force_repeat_command = false )

Definition at line 1961 of file CommandInterpreter.cpp.

References lldb_private::CommandReturnObject::AppendError(), lldb_private::CommandReturnObject::AppendErrorWithFormat(), lldb_private::telemetry::CommandInfo::args, lldb_private::telemetry::CommandInfo::command_id, lldb_private::telemetry::CommandInfo::command_name, lldb_private::Commands, lldb_private::telemetry::LLDBConfig::detailed_command_telemetry, lldb_private::telemetry::ScopedDispatcher< Info >::DispatchNow(), lldb_private::telemetry::ScopedDispatcher< Info >::DispatchOnExit(), elapsed(), lldb_private::eLazyBoolCalculate, lldb_private::eLazyBoolYes, lldb::eReturnStatusSuccessFinishNoResult, error(), lldb_private::telemetry::CommandInfo::error_data, lldb_private::CommandObject::Execute(), lldb_private::CommandHistory::g_repeat_char, lldb_private::StatsDuration::get(), lldb_private::CommandObject::GetCommandName(), lldb_private::telemetry::TelemetryManager::GetConfig(), GetDebugger(), lldb_private::CommandReturnObject::GetErrorString(), GetExecutionContext(), lldb_private::telemetry::TelemetryManager::GetInstance(), lldb_private::GetLog(), lldb_private::telemetry::CommandInfo::GetNextID(), lldb_private::CommandReturnObject::GetOutputString(), lldb_private::CommandObject::GetRepeatCommand(), GetRepeatPreviousCommand(), GetSaveTranscript(), lldb_private::CommandReturnObject::GetStatus(), INTERRUPT_REQUESTED, k_white_space, LLDB_LOGF, LLDB_SCOPED_TIMERF, m_command_history, m_command_source_depth, m_comment_char, m_debugger, m_repeat_command, m_transcript, m_transcript_stream, lldb_private::telemetry::CommandInfo::original_command, PreprocessCommand(), ResolveCommandImpl(), lldb_private::telemetry::CommandInfo::ret_status, lldb_private::CommandReturnObject::SetCommand(), lldb_private::CommandReturnObject::SetDiagnosticIndent(), lldb_private::CommandObject::SetOriginalCommandString(), lldb_private::CommandReturnObject::SetStatus(), lldb_private::CommandReturnObject::Succeeded(), lldb_private::telemetry::CommandInfo::target_uuid, and lldb_private::CommandObject::WantsRawCommandString().

◆ HandleCommand() [2/2]

bool CommandInterpreter::HandleCommand ( const char * command_line,
LazyBool add_to_history,
const ExecutionContext & override_context,
CommandReturnObject & result )

◆ HandleCommands() [1/2]

void CommandInterpreter::HandleCommands ( const StringList & commands,
const CommandInterpreterRunOptions & options,
CommandReturnObject & result )

Definition at line 2721 of file CommandInterpreter.cpp.

References lldb_private::CommandReturnObject::AppendErrorWithFormat(), lldb_private::CommandReturnObject::AppendErrorWithFormatv(), lldb_private::CommandReturnObject::AppendMessage(), lldb_private::CommandReturnObject::AppendMessageWithFormat(), lldb_private::CommandReturnObject::AppendMessageWithFormatv(), DidProcessStopAbnormally(), lldb::eReturnStatusSuccessContinuingNoResult, lldb::eReturnStatusSuccessContinuingResult, lldb::eReturnStatusSuccessFinishResult, lldb_private::CommandInterpreterRunOptions::GetAddToHistory(), lldb_private::CommandReturnObject::GetDidChangeProcessState(), lldb_private::CommandInterpreterRunOptions::GetEchoCommands(), lldb_private::CommandReturnObject::GetErrorString(), lldb_private::CommandReturnObject::GetImmediateErrorStream(), lldb_private::CommandReturnObject::GetImmediateOutputStream(), lldb_private::CommandReturnObject::GetInteractive(), lldb_private::CommandReturnObject::GetOutputString(), lldb_private::CommandInterpreterRunOptions::GetPrintResults(), lldb_private::StringList::GetSize(), lldb_private::CommandReturnObject::GetStatus(), lldb_private::CommandInterpreterRunOptions::GetStopOnContinue(), lldb_private::CommandInterpreterRunOptions::GetStopOnCrash(), lldb_private::CommandInterpreterRunOptions::GetStopOnError(), lldb_private::StringList::GetStringAtIndex(), HandleCommand(), lldb_private::CommandInterpreterRunOptions::m_add_to_history, m_command_source_depth, m_debugger, lldb_private::CommandReturnObject::SetInteractive(), lldb_private::CommandReturnObject::SetStatus(), lldb_private::CommandReturnObject::SetSuppressImmediateOutput(), and lldb_private::CommandReturnObject::Succeeded().

◆ HandleCommands() [2/2]

void CommandInterpreter::HandleCommands ( const StringList & commands,
const ExecutionContext & context,
const CommandInterpreterRunOptions & options,
CommandReturnObject & result )

Execute a list of commands in sequence.

Parameters
[in]commandsThe list of commands to execute.
[in,out]contextThe execution context in which to run the commands.
[in]optionsThis object holds the options used to control when to stop, whether to execute commands, etc.
[out]resultThis is marked as succeeding with no output if all commands execute safely, and failed with some explanation if we aborted executing the commands at some point.

Definition at line 2712 of file CommandInterpreter.cpp.

References HandleCommands(), OverrideExecutionContext(), and RestoreExecutionContext().

Referenced by lldb_private::BreakpointOptions::BreakpointOptionsCallbackFunction(), HandleCommands(), and lldb_private::Target::StopHookCommandLine::HandleStop().

◆ HandleCommandsFromFile() [1/2]

void CommandInterpreter::HandleCommandsFromFile ( FileSpec & file,
const CommandInterpreterRunOptions & options,
CommandReturnObject & result )

Definition at line 2861 of file CommandInterpreter.cpp.

References lldb_private::CommandReturnObject::AppendErrorWithFormat(), lldb_private::CommandReturnObject::AppendErrorWithFormatv(), lldb_private::ConstString::AsCString(), lldb_private::IOHandler::CommandInterpreter, lldb_private::FileSpec::CopyByRemovingLastPathComponent(), Debugger, eHandleCommandFlagEchoCommand, eHandleCommandFlagEchoCommentCommand, eHandleCommandFlagPrintErrors, eHandleCommandFlagPrintResult, eHandleCommandFlagStopOnContinue, eHandleCommandFlagStopOnCrash, eHandleCommandFlagStopOnError, lldb_private::eLazyBoolCalculate, lldb_private::eLazyBoolYes, lldb_private::File::eOpenOptionReadOnly, lldb::eReturnStatusSuccessFinishNoResult, error(), lldb_private::Debugger::GetAsyncExecution(), GetDebugger(), lldb_private::FileSpec::GetFilename(), lldb_private::Debugger::GetOutputFileSP(), lldb_private::FileSpec::GetPath(), lldb_private::Debugger::GetPrompt(), GetStopCmdSourceOnError(), lldb_private::CommandInterpreterRunOptions::GetStopOnCrash(), lldb_private::Debugger::GetUseColor(), lldb_private::FileSystem::Instance(), m_command_source_depth, m_command_source_dirs, m_command_source_flags, lldb_private::CommandInterpreterRunOptions::m_echo_commands, lldb_private::CommandInterpreterRunOptions::m_echo_comment_commands, lldb_private::CommandInterpreterRunOptions::m_print_errors, lldb_private::CommandInterpreterRunOptions::m_print_results, lldb_private::CommandInterpreterRunOptions::m_stop_on_continue, lldb_private::CommandInterpreterRunOptions::m_stop_on_error, lldb_private::FileSystem::Open(), lldb_private::Debugger::RunIOHandlerSync(), lldb_private::Debugger::SetAsyncExecution(), and lldb_private::CommandReturnObject::SetStatus().

◆ HandleCommandsFromFile() [2/2]

void CommandInterpreter::HandleCommandsFromFile ( FileSpec & file,
const ExecutionContext & context,
const CommandInterpreterRunOptions & options,
CommandReturnObject & result )

Execute a list of commands from a file.

Parameters
[in]fileThe file from which to read in commands.
[in,out]contextThe execution context in which to run the commands.
[in]optionsThis object holds the options used to control when to stop, whether to execute commands, etc.
[out]resultThis is marked as succeeding with no output if all commands execute safely, and failed with some explanation if we aborted executing the commands at some point.

Definition at line 2853 of file CommandInterpreter.cpp.

References HandleCommandsFromFile(), OverrideExecutionContext(), and RestoreExecutionContext().

Referenced by HandleCommandsFromFile(), and SourceInitFile().

◆ HandleCompletion()

◆ HandleCompletionMatches()

◆ HasAliases()

bool CommandInterpreter::HasAliases ( ) const

Definition at line 2353 of file CommandInterpreter.cpp.

References m_alias_dict.

Referenced by GetCommandSP(), and HasAliasOptions().

◆ HasAliasOptions()

bool CommandInterpreter::HasAliasOptions ( ) const

Definition at line 2363 of file CommandInterpreter.cpp.

References HasAliases().

◆ HasCommands()

bool CommandInterpreter::HasCommands ( ) const

Definition at line 2349 of file CommandInterpreter.cpp.

References m_command_dict.

Referenced by GetCommandSP().

◆ HasUserCommands()

bool CommandInterpreter::HasUserCommands ( ) const

Definition at line 2355 of file CommandInterpreter.cpp.

References m_user_dict.

Referenced by GetCommandSP().

◆ HasUserMultiwordCommands()

bool CommandInterpreter::HasUserMultiwordCommands ( ) const

Definition at line 2359 of file CommandInterpreter.cpp.

References m_user_mw_dict.

Referenced by GetCommandSP().

◆ IncreaseCommandUsage()

void lldb_private::CommandInterpreter::IncreaseCommandUsage ( const CommandObject & cmd_obj)
inline

◆ Initialize()

◆ InterruptCommand()

bool CommandInterpreter::InterruptCommand ( )

Definition at line 3210 of file CommandInterpreter.cpp.

References eInProgress, eInterrupted, and m_command_state.

Referenced by IOHandlerInterrupt().

◆ IOHandlerGetControlSequence()

llvm::StringRef lldb_private::CommandInterpreter::IOHandlerGetControlSequence ( char ch)
inlineoverrideprotectedvirtual

Reimplemented from lldb_private::IOHandlerDelegate.

Definition at line 690 of file CommandInterpreter.h.

◆ IOHandlerInputComplete()

void CommandInterpreter::IOHandlerInputComplete ( IOHandler & io_handler,
std::string & data )
overrideprotectedvirtual

Called when a line or lines have been retrieved.

This function can handle the current line and possibly call IOHandler::SetIsDone(true) when the IO handler is done like when "quit" is entered as a command, of when an empty line is received. It is up to the delegate to determine when a line should cause a IOHandler to exit.

Implements lldb_private::IOHandlerDelegate.

Definition at line 3267 of file CommandInterpreter.cpp.

References DidProcessStopAbnormally(), EchoCommandNonInteractive(), lldb::eCommandInterpreterResultCommandError, lldb::eCommandInterpreterResultInferiorCrash, lldb::eCommandInterpreterResultQuitRequested, lldb::eCommandInterpreterResultSuccess, lldb::eCommandReturnObjectPrintCallbackSkipped, eHandleCommandFlagAllowRepeats, eHandleCommandFlagPrintErrors, eHandleCommandFlagPrintResult, eHandleCommandFlagStopOnContinue, eHandleCommandFlagStopOnCrash, eHandleCommandFlagStopOnError, lldb_private::eLazyBoolCalculate, lldb::eReturnStatusFailed, lldb::eReturnStatusInvalid, lldb::eReturnStatusQuit, lldb::eReturnStatusStarted, lldb::eReturnStatusSuccessContinuingNoResult, lldb::eReturnStatusSuccessContinuingResult, lldb::eReturnStatusSuccessFinishNoResult, lldb::eReturnStatusSuccessFinishResult, error(), FinishHandlingCommand(), GetDebugger(), lldb_private::IOHandler::GetFlags(), lldb_private::IOHandler::GetIsInteractive(), lldb_private::IOHandler::GetOutputStreamFileSP(), GetProcessOutput(), lldb_private::IOHandler::GetPrompt(), lldb_private::Debugger::GetShowInlineDiagnostics(), HandleCommand(), lldb_private::ExecutionContext::HasTargetScope(), m_debugger, m_print_callback, m_result, OverrideExecutionContext(), PrintCommandOutput(), lldb_private::Stream::Printf(), RestoreExecutionContext(), lldb_private::IOHandler::SetIsDone(), StartHandlingCommand(), lldb_private::Flags::Test(), and WasInterrupted().

◆ IOHandlerInterrupt()

◆ IsActive()

bool CommandInterpreter::IsActive ( )

Definition at line 3533 of file CommandInterpreter.cpp.

References m_command_io_handler_sp, and m_debugger.

◆ IsInteractive()

bool CommandInterpreter::IsInteractive ( )

Definition at line 3485 of file CommandInterpreter.cpp.

References GetIOHandler().

◆ LoadCommandDictionary()

void CommandInterpreter::LoadCommandDictionary ( )

◆ OutputFormattedHelpText() [1/2]

void CommandInterpreter::OutputFormattedHelpText ( Stream & stream,
llvm::StringRef command_word,
llvm::StringRef separator,
llvm::StringRef help_text,
size_t max_word_len )

◆ OutputFormattedHelpText() [2/2]

◆ OutputHelpText()

void CommandInterpreter::OutputHelpText ( Stream & stream,
llvm::StringRef command_word,
llvm::StringRef separator,
llvm::StringRef help_text,
uint32_t max_word_len )

◆ OverrideExecutionContext()

void CommandInterpreter::OverrideExecutionContext ( const ExecutionContext & override_context)
private

◆ PreprocessCommand()

Status CommandInterpreter::PreprocessCommand ( std::string & command)

Definition at line 1829 of file CommandInterpreter.cpp.

References error(), and PreprocessToken().

Referenced by HandleCommand().

◆ PreprocessToken()

◆ PrintCommandOutput()

◆ PrintWarningsIfNecessary()

void lldb_private::CommandInterpreter::PrintWarningsIfNecessary ( Stream & s,
const std::string & cmd_name )
inline

◆ ProcessEmbeddedScriptCommands()

const char * CommandInterpreter::ProcessEmbeddedScriptCommands ( const char * arg)

Definition at line 544 of file CommandInterpreter.cpp.

◆ RemoveAlias()

bool CommandInterpreter::RemoveAlias ( llvm::StringRef alias_name)

Definition at line 1486 of file CommandInterpreter.cpp.

References m_alias_dict.

◆ RemoveAllUser()

void lldb_private::CommandInterpreter::RemoveAllUser ( )
inline

Definition at line 363 of file CommandInterpreter.h.

References m_user_dict.

◆ RemoveAllUserMultiword()

void lldb_private::CommandInterpreter::RemoveAllUserMultiword ( )
inline

Definition at line 359 of file CommandInterpreter.h.

References m_user_mw_dict.

◆ RemoveCommand()

bool CommandInterpreter::RemoveCommand ( llvm::StringRef cmd,
bool force = false )

Remove a command if it is removable (python or regex command).

If force is provided, the command is removed regardless of its removable status.

Definition at line 1495 of file CommandInterpreter.cpp.

References m_command_dict.

◆ RemoveUser()

bool CommandInterpreter::RemoveUser ( llvm::StringRef alias_name)

Definition at line 1508 of file CommandInterpreter.cpp.

References m_user_dict.

◆ RemoveUserMultiword()

bool CommandInterpreter::RemoveUserMultiword ( llvm::StringRef multiword_name)

Definition at line 1517 of file CommandInterpreter.cpp.

References m_user_mw_dict.

Referenced by CommandObjectCommandsContainerDelete::DoExecute().

◆ ResolveCommand()

◆ ResolveCommandImpl()

◆ RestoreExecutionContext()

void CommandInterpreter::RestoreExecutionContext ( )
private

◆ RunCommandInterpreter()

◆ SaveTranscript()

bool CommandInterpreter::SaveTranscript ( CommandReturnObject & result,
std::optional< std::string > output_file = std::nullopt )

◆ SetBatchCommandMode()

bool lldb_private::CommandInterpreter::SetBatchCommandMode ( bool value)
inline

Definition at line 526 of file CommandInterpreter.h.

References m_batch_command_mode.

Referenced by SourceInitFile().

◆ SetEchoCommands()

void CommandInterpreter::SetEchoCommands ( bool enable)

◆ SetEchoCommentCommands()

void CommandInterpreter::SetEchoCommentCommands ( bool enable)

◆ SetOpenTranscriptInEditor()

void CommandInterpreter::SetOpenTranscriptInEditor ( bool enable)

◆ SetPrintCallback()

void CommandInterpreter::SetPrintCallback ( CommandReturnObjectCallback callback)

Definition at line 3802 of file CommandInterpreter.cpp.

References m_print_callback.

◆ SetPromptOnQuit()

void CommandInterpreter::SetPromptOnQuit ( bool enable)

◆ SetQuitExitCode()

bool CommandInterpreter::SetQuitExitCode ( int exit_code)
nodiscard

Sets the exit code for the quit command.

Parameters
[in]exit_codeThe exit code that the driver should return on exit.
Returns
True if the exit code was successfully set; false if the interpreter doesn't allow custom exit codes.
See also
AllowExitCodeOnQuit

Definition at line 242 of file CommandInterpreter.cpp.

References m_allow_exit_code, and m_quit_exit_code.

◆ SetReachedMaximumDepth()

void lldb_private::CommandInterpreter::SetReachedMaximumDepth ( )
inline

Definition at line 537 of file CommandInterpreter.h.

References eNoOmission, eUnwarnedOmission, and m_max_depth_warning.

◆ SetSaveSessionDirectory()

void CommandInterpreter::SetSaveSessionDirectory ( llvm::StringRef path)

◆ SetSaveSessionOnQuit()

void CommandInterpreter::SetSaveSessionOnQuit ( bool enable)

◆ SetSaveTranscript()

void CommandInterpreter::SetSaveTranscript ( bool enable)

◆ SetSynchronous()

void CommandInterpreter::SetSynchronous ( bool value)
protected

Definition at line 3009 of file CommandInterpreter.cpp.

References m_synchronous_execution.

Referenced by CommandInterpreter().

◆ SkipAppInitFiles()

void lldb_private::CommandInterpreter::SkipAppInitFiles ( bool skip_app_init_files)
inline

Definition at line 511 of file CommandInterpreter.h.

References m_skip_app_init_files.

Referenced by lldb::SBDebugger::Create().

◆ SkipLLDBInitFiles()

void lldb_private::CommandInterpreter::SkipLLDBInitFiles ( bool skip_lldbinit_files)
inline

Definition at line 507 of file CommandInterpreter.h.

References m_skip_lldbinit_files.

Referenced by lldb::SBDebugger::Create().

◆ SourceInitFile()

◆ SourceInitFileCwd()

◆ SourceInitFileGlobal()

◆ SourceInitFileHome()

void CommandInterpreter::SourceInitFileHome ( CommandReturnObject & result,
bool is_repl )

We will first see if there is an application specific ".lldbinit" file whose name is "~/.lldbinit" followed by a "-" and the name of the program.

If this file doesn't exist, we fall back to the REPL init file or the default home init file in "~/.lldbinit".

Definition at line 2604 of file CommandInterpreter.cpp.

References lldb::eReturnStatusSuccessFinishNoResult, GetDebugger(), GetHomeInitFile(), GetHomeREPLInitFile(), lldb_private::FileSpec::GetPath(), lldb_private::FileSystem::Instance(), m_skip_app_init_files, m_skip_lldbinit_files, lldb_private::CommandReturnObject::SetStatus(), and SourceInitFile().

◆ StartHandlingCommand()

void CommandInterpreter::StartHandlingCommand ( )
private

◆ UpdatePrompt()

◆ UpdateUseColor()

void CommandInterpreter::UpdateUseColor ( bool use_color)

Definition at line 2321 of file CommandInterpreter.cpp.

References m_command_io_handler_sp.

Referenced by lldb_private::Debugger::SetUseColor().

◆ UserCommandExists()

bool CommandInterpreter::UserCommandExists ( llvm::StringRef cmd) const

Determine whether a root-level user command with this name exists.

Definition at line 1458 of file CommandInterpreter.cpp.

References m_user_dict.

Referenced by AddUserCommand().

◆ UserMultiwordCommandExists()

bool CommandInterpreter::UserMultiwordCommandExists ( llvm::StringRef cmd) const

Determine whether a root-level user multiword command with this name exists.

Definition at line 1462 of file CommandInterpreter.cpp.

References m_user_mw_dict.

◆ VerifyUserMultiwordCmdPath()

CommandObjectMultiword * CommandInterpreter::VerifyUserMultiwordCmdPath ( Args & path,
bool leaf_is_command,
Status & result )

Look up the command pointed to by path encoded in the arguments of the incoming command object.

If all the path components exist and are all actual commands - not aliases, and the leaf command is a multiword command, return the command. Otherwise return nullptr, and put a useful diagnostic in the Status object.

Parameters
[in]pathAn Args object holding the path in its arguments
[in]leaf_is_commandIf true, return the container of the leaf name rather than looking up the whole path as a leaf command. The leaf needn't exist in this case.
[in,out]resultIf the path is not found, this error shows where we got off track.
Returns
If found, a pointer to the CommandObjectMultiword pointed to by path, or to the container of the leaf element is is_leaf_command. Returns nullptr under two circumstances: 1) The command in not found (check error.Fail) 2) is_leaf is true and the path has only a leaf. We don't have a dummy "contains everything MWC, so we return null here, but in this case error.Success is true.

Definition at line 988 of file CommandInterpreter.cpp.

References lldb_private::Status::Clear(), lldb_private::Status::FromErrorString(), lldb_private::Status::FromErrorStringWithFormat(), lldb_private::Args::GetArgumentAtIndex(), lldb_private::Args::GetArgumentCount(), lldb_private::CommandObjectMultiword::GetAsMultiwordCommand(), GetCommandSPExact(), and lldb_private::CommandObjectMultiword::GetSubcommandSPExact().

Referenced by lldb_private::CommandCompletions::CompleteModifiableCmdPathArgs(), CommandObjectCommandsContainerAdd::DoExecute(), CommandObjectCommandsContainerDelete::DoExecute(), CommandObjectCommandsScriptAdd::DoExecute(), and CommandObjectCommandsScriptDelete::DoExecute().

◆ WasInterrupted()

bool CommandInterpreter::WasInterrupted ( ) const
protected

◆ Debugger

Member Data Documentation

◆ g_argument

const char * CommandInterpreter::g_argument = "<argument>"
static

◆ g_need_argument

const char * CommandInterpreter::g_need_argument = "<need-argument>"
static

Definition at line 266 of file CommandInterpreter.h.

Referenced by lldb_private::CommandAlias::GetAliasExpansion().

◆ g_no_argument

const char * CommandInterpreter::g_no_argument = "<no-argument>"
static

◆ m_alias_dict

◆ m_allow_exit_code

bool lldb_private::CommandInterpreter::m_allow_exit_code = false
private

Definition at line 799 of file CommandInterpreter.h.

Referenced by AllowExitCodeOnQuit(), and SetQuitExitCode().

◆ m_batch_command_mode

bool lldb_private::CommandInterpreter::m_batch_command_mode
private

◆ m_command_dict

◆ m_command_history

CommandHistory lldb_private::CommandInterpreter::m_command_history
private

◆ m_command_io_handler_sp

lldb::IOHandlerSP lldb_private::CommandInterpreter::m_command_io_handler_sp
private

Definition at line 773 of file CommandInterpreter.h.

Referenced by Clear(), GetIOHandler(), IsActive(), UpdatePrompt(), and UpdateUseColor().

◆ m_command_source_depth

uint32_t lldb_private::CommandInterpreter::m_command_source_depth
private

◆ m_command_source_dirs

std::vector<FileSpec> lldb_private::CommandInterpreter::m_command_source_dirs
private

A stack of directory paths.

When not empty, the last one is the directory of the file that's currently sourced.

Definition at line 788 of file CommandInterpreter.h.

Referenced by GetCurrentSourceDir(), and HandleCommandsFromFile().

◆ m_command_source_flags

std::vector<uint32_t> lldb_private::CommandInterpreter::m_command_source_flags
private

Definition at line 789 of file CommandInterpreter.h.

Referenced by HandleCommandsFromFile().

◆ m_command_state

std::atomic<CommandHandlingState> lldb_private::CommandInterpreter::m_command_state
private

◆ m_command_usages

CommandUsageMap lldb_private::CommandInterpreter::m_command_usages
private

Definition at line 803 of file CommandInterpreter.h.

Referenced by GetStatistics(), and IncreaseCommandUsage().

◆ m_comment_char

char lldb_private::CommandInterpreter::m_comment_char
private

◆ m_debugger

◆ m_iohandler_nesting_level

int lldb_private::CommandInterpreter::m_iohandler_nesting_level = 0
private

◆ m_max_depth_warning

ChildrenOmissionWarningStatus lldb_private::CommandInterpreter::m_max_depth_warning
private

Whether we reached the maximum child nesting depth and whether the user has been told.

Definition at line 781 of file CommandInterpreter.h.

Referenced by CommandInterpreter(), PrintWarningsIfNecessary(), and SetReachedMaximumDepth().

◆ m_overriden_exe_contexts

std::stack<ExecutionContext> lldb_private::CommandInterpreter::m_overriden_exe_contexts
private

◆ m_print_callback

CommandReturnObjectCallback lldb_private::CommandInterpreter::m_print_callback
private

An optional callback to handle printing the CommandReturnObject.

Definition at line 793 of file CommandInterpreter.h.

Referenced by IOHandlerInputComplete(), and SetPrintCallback().

◆ m_quit_exit_code

std::optional<int> lldb_private::CommandInterpreter::m_quit_exit_code
private

Definition at line 797 of file CommandInterpreter.h.

Referenced by AllowExitCodeOnQuit(), GetQuitExitCode(), and SetQuitExitCode().

◆ m_repeat_command

std::string lldb_private::CommandInterpreter::m_repeat_command
private

Definition at line 771 of file CommandInterpreter.h.

Referenced by HandleCommand().

◆ m_result

CommandInterpreterRunResult lldb_private::CommandInterpreter::m_result
private

Definition at line 790 of file CommandInterpreter.h.

Referenced by IOHandlerInputComplete(), and RunCommandInterpreter().

◆ m_skip_app_init_files

bool lldb_private::CommandInterpreter::m_skip_app_init_files
private

Definition at line 761 of file CommandInterpreter.h.

Referenced by CommandInterpreter(), SkipAppInitFiles(), and SourceInitFileHome().

◆ m_skip_lldbinit_files

bool lldb_private::CommandInterpreter::m_skip_lldbinit_files
private

◆ m_synchronous_execution

bool lldb_private::CommandInterpreter::m_synchronous_execution
private

Definition at line 759 of file CommandInterpreter.h.

Referenced by CommandInterpreter(), GetSynchronous(), and SetSynchronous().

◆ m_transcript

StructuredData::Array lldb_private::CommandInterpreter::m_transcript
private

Contains a list of handled commands and their details.

Each element in the list is a dictionary with the following keys/values:

  • "command" (string): The command that was given by the user.
  • "commandName" (string): The name of the executed command.
  • "commandArguments" (string): The arguments of the executed command.
  • "output" (string): The output of the command. Empty ("") if no output.
  • "error" (string): The error of the command. Empty ("") if no error.
  • "durationInSeconds" (float): The time it took to execute the command.
  • "timestampInEpochSeconds" (int): The timestamp when the command is executed.

Turn on settings interpreter.save-transcript for LLDB to populate this list. Otherwise this list is empty.

Definition at line 822 of file CommandInterpreter.h.

Referenced by GetTranscript(), and HandleCommand().

◆ m_transcript_stream

StreamString lldb_private::CommandInterpreter::m_transcript_stream
private

Turn on settings interpreter.save-transcript for LLDB to populate this stream.

Otherwise this stream is empty.

Definition at line 807 of file CommandInterpreter.h.

Referenced by HandleCommand(), and SaveTranscript().

◆ m_truncation_warning

ChildrenOmissionWarningStatus lldb_private::CommandInterpreter::m_truncation_warning
private

Whether we truncated a value's list of children and whether the user has been told.

Definition at line 778 of file CommandInterpreter.h.

Referenced by ChildrenTruncated(), CommandInterpreter(), and PrintWarningsIfNecessary().

◆ m_user_dict

◆ m_user_mw_dict


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