LLDB mainline
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
lldb_private::CommandInterpreter Class Reference

#include <CommandInterpreter.h>

Inheritance diagram for lldb_private::CommandInterpreter:
Inheritance graph
[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
}
 
- 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)
 
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)
 
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.
 
virtual llvm::StringRef GetBroadcasterClass () const
 This needs to be filled in if you are going to register the broadcaster with the broadcaster manager and do broadcaster class matching.
 
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 ()
 
virtual 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 IOHandlerInputComplete (IOHandler &io_handler, std::string &data)=0
 Called when a line or lines have been retrieved.
 
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 llvm::StringRef IOHandlerGetControlSequence (char ch)
 
virtual const char * IOHandlerGetCommandPrefix ()
 
virtual const char * IOHandlerGetHelpPrologue ()
 
virtual bool IOHandlerInterrupt (IOHandler &io_handler)
 

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
 
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
 
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

◆ CommandUsageMap

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

Command usage statistics.

Definition at line 786 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 727 of file CommandInterpreter.h.

◆ CommandTypes

Enumerator
eCommandTypesBuiltin 
eCommandTypesUserDef 
eCommandTypesUserMW 
eCommandTypesAliases 
eCommandTypesHidden 
eCommandTypesAllThem 

Definition at line 248 of file CommandInterpreter.h.

Constructor & Destructor Documentation

◆ CommandInterpreter()

CommandInterpreter::CommandInterpreter ( Debugger debugger,
bool  synchronous_execution 
)

◆ ~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 1382 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 1140 of file CommandInterpreter.cpp.

References lldbassert, and m_command_dict.

◆ AddUserCommand()

Status CommandInterpreter::AddUserCommand ( llvm::StringRef  name,
const lldb::CommandObjectSP cmd_sp,
bool  can_replace 
)

◆ AliasExists()

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

Determine whether an alias command with this name exists.

Definition at line 1369 of file CommandInterpreter.cpp.

References m_alias_dict.

Referenced by lldb::SBCommandInterpreter::AliasExists(), and CommandObjectCommandsUnalias::DoExecute().

◆ 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 232 of file CommandInterpreter.cpp.

References m_allow_exit_code, and m_quit_exit_code.

Referenced by lldb::SBCommandInterpreter::AllowExitCodeOnQuit().

◆ BuildAliasCommandArgs()

void CommandInterpreter::BuildAliasCommandArgs ( CommandObject alias_cmd_obj,
const char *  alias_name,
Args cmd_args,
std::string &  raw_input_string,
CommandReturnObject result 
)

◆ BuildAliasResult()

CommandObject * CommandInterpreter::BuildAliasResult ( llvm::StringRef  alias_name,
std::string &  raw_input_string,
std::string &  alias_result,
CommandReturnObject result 
)

◆ ChildrenTruncated()

void lldb_private::CommandInterpreter::ChildrenTruncated ( )
inline

Definition at line 527 of file CommandInterpreter.h.

References eNoOmission, eUnwarnedOmission, and m_truncation_warning.

◆ Clear()

void CommandInterpreter::Clear ( )

Definition at line 537 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 1335 of file CommandInterpreter.cpp.

References m_command_dict.

Referenced by AddUserCommand(), lldb::SBCommandInterpreter::CommandExists(), CommandObjectCommandsUnalias::DoExecute(), and CommandObjectCommandsDelete::DoExecute().

◆ Confirm()

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

◆ DidProcessStopAbnormally()

bool CommandInterpreter::DidProcessStopAbnormally ( ) const
protected

◆ 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 3059 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

◆ GetAliasCommandObject()

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

◆ GetAliases()

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

◆ 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 2161 of file CommandInterpreter.cpp.

References lldb_private::CommandHistory::GetSize(), lldb_private::CommandHistory::GetStringAtIndex(), and m_command_history.

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

◆ GetBatchCommandMode()

bool lldb_private::CommandInterpreter::GetBatchCommandMode ( )
inline

Definition at line 519 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 273 of file CommandInterpreter.h.

References GetStaticBroadcasterClass().

◆ GetCommandHistory()

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

Definition at line 557 of file CommandInterpreter.h.

References m_command_history.

Referenced by CommandObjectSessionHistory::DoExecute().

◆ 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()

CommandObject * CommandInterpreter::GetCommandObjectForCommand ( llvm::StringRef &  command_line)

◆ GetCommandPrefix()

const char * CommandInterpreter::GetCommandPrefix ( )

◆ GetCommands()

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

◆ GetCommandSP()

CommandObjectSP CommandInterpreter::GetCommandSP ( llvm::StringRef  cmd,
bool  include_aliases = true,
bool  exact = true,
StringList matches = nullptr,
StringList descriptions = nullptr 
) const
protected

◆ GetCommandSPExact()

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

◆ GetCurrentSourceDir()

FileSpec CommandInterpreter::GetCurrentSourceDir ( )

◆ GetDebugger()

Debugger & lldb_private::CommandInterpreter::GetDebugger ( )
inline

Definition at line 466 of file CommandInterpreter.h.

References m_debugger.

Referenced by lldb_private::CommandCompletions::BreakpointNames(), lldb_private::CommandCompletions::Breakpoints(), lldb_private::OptionGroupPlatform::CreatePlatformWithOptions(), lldb_private::CommandPluginInterfaceImplementation::DoExecute(), lldb_private::CommandObjectDisassemble::DoExecute(), sddarwinlog_private::EnableCommand::DoExecute(), sddarwinlog_private::StatusCommand::DoExecute(), CommandObjectScriptingRun::DoExecute(), lldb_private::CommandCompletions::FrameIndexes(), GetCommandPrefix(), lldb::SBCommandInterpreter::GetDebugger(), lldb_private::CommandObject::GetDebugger(), lldb_private::CommandObject::GetDefaultThread(), lldb_private::CommandObject::GetDummyTarget(), GetHelp(), lldb::SBCommandInterpreter::GetIOHandlerControlSequence(), GetLLDBCommandsFromIOHandler(), lldb::SBCommandInterpreter::GetProcess(), GetPythonCommandsFromIOHandler(), lldb_private::CommandObject::GetTarget(), HandleCommand(), HandleCommandsFromFile(), lldb_private::CommandObject::HandleCompletion(), lldb_private::Options::HandleOptionArgumentCompletion(), LookupSymbolInModule(), lldb_private::CommandCompletions::Modules(), CommandObjectScriptingObjectParsed::CommandOptions::OptionParsingStarting(), PrintCommandOutput(), lldb_private::CommandCompletions::RemoteDiskDirectories(), lldb_private::CommandCompletions::RemoteDiskFiles(), sddarwinlog_private::RunEnableCommand(), CommandObjectScriptingObjectParsed::CommandOptions::SetOptionValue(), lldb_private::CommandCompletions::SettingsNames(), lldb_private::CommandCompletions::SourceFiles(), SourceInitFileHome(), lldb::SBCommandInterpreter::SourceInitFileInCurrentWorkingDirectory(), lldb::SBCommandInterpreter::SourceInitFileInGlobalDirectory(), lldb::SBCommandInterpreter::SourceInitFileInHomeDirectory(), lldb_private::CommandCompletions::Symbols(), and lldb::SBCommandInterpreter::WasInterrupted().

◆ GetEchoCommands()

bool CommandInterpreter::GetEchoCommands ( ) const

Definition at line 210 of file CommandInterpreter.cpp.

Referenced by CommandObjectCommandsSource::DoExecute().

◆ GetEchoCommentCommands()

bool CommandInterpreter::GetEchoCommentCommands ( ) const

Definition at line 221 of file CommandInterpreter.cpp.

Referenced by CommandObjectCommandsSource::DoExecute().

◆ GetExecutionContext()

ExecutionContext CommandInterpreter::GetExecutionContext ( ) const

◆ GetExpandRegexAliases()

bool CommandInterpreter::GetExpandRegexAliases ( ) const

◆ GetHelp()

void CommandInterpreter::GetHelp ( CommandReturnObject result,
uint32_t  types = eCommandTypesAllThem 
)

◆ GetIOHandler()

lldb::IOHandlerSP CommandInterpreter::GetIOHandler ( bool  force_create = false,
CommandInterpreterRunOptions options = nullptr 
)

◆ GetLLDBCommandsFromIOHandler()

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

◆ GetOpenTranscriptInEditor()

bool CommandInterpreter::GetOpenTranscriptInEditor ( ) const

Definition at line 189 of file CommandInterpreter.cpp.

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 2331 of file CommandInterpreter.cpp.

Referenced by BuildAliasCommandArgs(), and BuildAliasResult().

◆ GetPlatform()

PlatformSP CommandInterpreter::GetPlatform ( bool  prefer_target_platform)

◆ GetProcessOutput()

void CommandInterpreter::GetProcessOutput ( )
protected

◆ 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 245 of file CommandInterpreter.cpp.

References m_quit_exit_code.

Referenced by lldb::SBCommandInterpreter::GetQuitStatus(), and lldb::SBCommandInterpreter::HasCustomQuitExitCode().

◆ GetRepeatPreviousCommand()

bool CommandInterpreter::GetRepeatPreviousCommand ( ) const

Definition at line 273 of file CommandInterpreter.cpp.

Referenced by HandleCommand().

◆ GetRequireCommandOverwrite()

bool CommandInterpreter::GetRequireCommandOverwrite ( ) const

Definition at line 279 of file CommandInterpreter.cpp.

Referenced by CommandObjectCommandsScriptAdd::DoExecute().

◆ GetSaveSessionDirectory()

FileSpec CommandInterpreter::GetSaveSessionDirectory ( ) const

Definition at line 200 of file CommandInterpreter.cpp.

Referenced by SaveTranscript().

◆ GetSaveSessionOnQuit()

bool CommandInterpreter::GetSaveSessionOnQuit ( ) const

Definition at line 178 of file CommandInterpreter.cpp.

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

◆ GetSaveTranscript()

bool CommandInterpreter::GetSaveTranscript ( ) const

Definition at line 167 of file CommandInterpreter.cpp.

Referenced by HandleCommand().

◆ GetSpaceReplPrompts()

bool CommandInterpreter::GetSpaceReplPrompts ( ) const

Definition at line 267 of file CommandInterpreter.cpp.

Referenced by lldb_private::REPL::IOHandlerInputComplete().

◆ GetStaticBroadcasterClass()

llvm::StringRef CommandInterpreter::GetStaticBroadcasterClass ( )
static

◆ GetStatistics()

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

◆ GetStopCmdSourceOnError()

bool CommandInterpreter::GetStopCmdSourceOnError ( ) const

Definition at line 261 of file CommandInterpreter.cpp.

Referenced by HandleCommandsFromFile().

◆ GetSynchronous()

bool CommandInterpreter::GetSynchronous ( )

◆ GetTranscript()

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

◆ GetUserCommandObject()

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

◆ GetUserCommands()

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

Definition at line 602 of file CommandInterpreter.h.

References m_user_dict.

Referenced by GetUserCommandObject().

◆ GetUserMultiwordCommands()

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

Definition at line 606 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 
)

◆ 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 2578 of file CommandInterpreter.cpp.

References lldb_private::CommandReturnObject::AppendErrorWithFormat(), lldb_private::CommandReturnObject::AppendMessage(), lldb_private::CommandReturnObject::AppendMessageWithFormat(), DidProcessStopAbnormally(), lldb::eReturnStatusSuccessContinuingNoResult, lldb::eReturnStatusSuccessContinuingResult, lldb::eReturnStatusSuccessFinishResult, lldb_private::CommandInterpreterRunOptions::GetAddToHistory(), lldb_private::Debugger::GetAsyncExecution(), lldb_private::CommandReturnObject::GetDidChangeProcessState(), lldb_private::CommandInterpreterRunOptions::GetEchoCommands(), lldb_private::CommandReturnObject::GetErrorData(), lldb_private::CommandReturnObject::GetImmediateErrorStream(), lldb_private::CommandReturnObject::GetImmediateOutputStream(), lldb_private::CommandReturnObject::GetInteractive(), lldb_private::CommandReturnObject::GetOutputData(), lldb_private::CommandInterpreterRunOptions::GetPrintResults(), lldb_private::Debugger::GetPrompt(), lldb_private::StringList::GetSize(), lldb_private::CommandReturnObject::GetStatus(), lldb_private::CommandInterpreterRunOptions::GetStopOnContinue(), lldb_private::CommandInterpreterRunOptions::GetStopOnCrash(), lldb_private::CommandInterpreterRunOptions::GetStopOnError(), lldb_private::StringList::GetStringAtIndex(), lldb_private::Debugger::GetUseColor(), HandleCommand(), lldb_private::CommandInterpreterRunOptions::m_add_to_history, m_command_source_depth, m_debugger, lldb_private::Debugger::SetAsyncExecution(), 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 2568 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 2719 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(), 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::GetOutputFile(), 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::File::Printf(), 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 2711 of file CommandInterpreter.cpp.

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

Referenced by CommandObjectCommandsSource::DoExecute(), CommandObjectSettingsRead::DoExecute(), HandleCommandsFromFile(), lldb::SBCommandInterpreter::HandleCommandsFromFile(), and SourceInitFile().

◆ HandleCompletion()

void CommandInterpreter::HandleCompletion ( CompletionRequest request)

◆ HandleCompletionMatches()

void CommandInterpreter::HandleCompletionMatches ( CompletionRequest request)

◆ HasAliases()

bool CommandInterpreter::HasAliases ( ) const

◆ HasAliasOptions()

bool CommandInterpreter::HasAliasOptions ( ) const

Definition at line 2215 of file CommandInterpreter.cpp.

References HasAliases().

Referenced by lldb::SBCommandInterpreter::HasAliasOptions().

◆ HasCommands()

bool CommandInterpreter::HasCommands ( ) const

◆ HasUserCommands()

bool CommandInterpreter::HasUserCommands ( ) const

Definition at line 2209 of file CommandInterpreter.cpp.

References m_user_dict.

Referenced by CommandObjectCommandsScriptDelete::DoExecute(), and GetCommandSP().

◆ HasUserMultiwordCommands()

bool CommandInterpreter::HasUserMultiwordCommands ( ) const

◆ IncreaseCommandUsage()

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

◆ Initialize()

void CommandInterpreter::Initialize ( )

◆ InterruptCommand()

bool CommandInterpreter::InterruptCommand ( )

◆ IOHandlerGetControlSequence()

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

Reimplemented from lldb_private::IOHandlerDelegate.

Definition at line 683 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 3123 of file CommandInterpreter.cpp.

References DidProcessStopAbnormally(), EchoCommandNonInteractive(), lldb::eCommandInterpreterResultCommandError, lldb::eCommandInterpreterResultInferiorCrash, lldb::eCommandInterpreterResultQuitRequested, lldb::eCommandInterpreterResultSuccess, 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(), lldb_private::IOHandler::GetFlags(), lldb_private::IOHandler::GetIsInteractive(), lldb_private::IOHandler::GetOutputMutex(), lldb_private::IOHandler::GetOutputStreamFileSP(), GetProcessOutput(), lldb_private::IOHandler::GetPrompt(), lldb_private::Debugger::GetSelectedExecutionContext(), lldb_private::Debugger::GetUseColor(), HandleCommand(), lldb_private::ExecutionContext::HasTargetScope(), lldb_private::CommandInterpreterRunResult::IncrementNumberOfErrors(), lldb_private::CommandInterpreterRunResult::IsResult(), m_debugger, m_result, OverrideExecutionContext(), PrintCommandOutput(), RestoreExecutionContext(), lldb_private::IOHandler::SetIsDone(), lldb_private::CommandInterpreterRunResult::SetResult(), StartHandlingCommand(), lldb_private::Flags::Test(), and WasInterrupted().

◆ IOHandlerInterrupt()

bool CommandInterpreter::IOHandlerInterrupt ( IOHandler io_handler)
overridevirtual

◆ IsActive()

bool CommandInterpreter::IsActive ( )

◆ IsInteractive()

bool CommandInterpreter::IsInteractive ( )

Definition at line 3315 of file CommandInterpreter.cpp.

References GetIOHandler().

Referenced by lldb::SBCommandInterpreter::IsInteractive().

◆ 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]

void CommandInterpreter::OutputFormattedHelpText ( Stream strm,
llvm::StringRef  prefix,
llvm::StringRef  help_text 
)

◆ 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 1746 of file CommandInterpreter.cpp.

References error(), and PreprocessToken().

Referenced by HandleCommand().

◆ PreprocessToken()

Status CommandInterpreter::PreprocessToken ( std::string &  token)

◆ PrintCommandOutput()

void CommandInterpreter::PrintCommandOutput ( IOHandler io_handler,
llvm::StringRef  str,
bool  is_stdout 
)
private

◆ 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 541 of file CommandInterpreter.cpp.

◆ RemoveAlias()

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

Definition at line 1401 of file CommandInterpreter.cpp.

References m_alias_dict.

Referenced by CommandObjectCommandsUnalias::DoExecute().

◆ RemoveAllUser()

void lldb_private::CommandInterpreter::RemoveAllUser ( )
inline

Definition at line 360 of file CommandInterpreter.h.

References m_user_dict.

Referenced by CommandObjectCommandsScriptClear::DoExecute().

◆ RemoveAllUserMultiword()

void lldb_private::CommandInterpreter::RemoveAllUserMultiword ( )
inline

Definition at line 356 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 1410 of file CommandInterpreter.cpp.

References m_command_dict.

Referenced by CommandObjectCommandsDelete::DoExecute().

◆ RemoveUser()

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

Definition at line 1423 of file CommandInterpreter.cpp.

References m_user_dict.

Referenced by CommandObjectCommandsScriptDelete::DoExecute().

◆ RemoveUserMultiword()

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

Definition at line 1433 of file CommandInterpreter.cpp.

References m_user_mw_dict.

Referenced by CommandObjectCommandsContainerDelete::DoExecute().

◆ ResolveCommand()

void CommandInterpreter::ResolveCommand ( const char *  command_line,
CommandReturnObject result 
)

◆ ResolveCommandImpl()

CommandObject * CommandInterpreter::ResolveCommandImpl ( std::string &  command_line,
CommandReturnObject result 
)
private

◆ RestoreExecutionContext()

void CommandInterpreter::RestoreExecutionContext ( )
private

◆ RunCommandInterpreter()

CommandInterpreterRunResult CommandInterpreter::RunCommandInterpreter ( CommandInterpreterRunOptions options)

◆ SaveTranscript()

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

Save the current debugger session transcript to a file on disk.

Parameters
output_fileThe file path to which the session transcript will be written. Since the argument is optional, an arbitrary temporary file will be create when no argument is passed.
resultThis is used to pass function output and error messages.
Returns
true if the session transcript was successfully written to disk, false otherwise.

Definition at line 3251 of file CommandInterpreter.cpp.

References lldb_private::CommandReturnObject::AppendError(), lldb_private::CommandReturnObject::AppendErrorWithFormatv(), lldb_private::CommandReturnObject::AppendMessageWithFormat(), lldb_private::FileSpec::AppendPathComponent(), lldb_private::Commands, lldb_private::File::eOpenOptionCanCreate, lldb_private::File::eOpenOptionTruncate, lldb_private::File::eOpenOptionWriteOnly, lldb::eReturnStatusSuccessFinishNoResult, error(), lldb_private::StreamString::GetData(), lldb_private::Debugger::GetExternalEditor(), lldb_private::GetLog(), GetOpenTranscriptInEditor(), lldb_private::FileSpec::GetPath(), GetSaveSessionDirectory(), lldb_private::StreamString::GetSize(), lldb_private::FileSystem::Instance(), lldb_private::Host::IsInteractiveGraphicSession(), LLDB_LOG, m_debugger, m_transcript_stream, lldb_private::FileSystem::Open(), lldb_private::Host::OpenFileInExternalEditor(), lldb_private::FileSystem::Resolve(), and lldb_private::CommandReturnObject::SetStatus().

Referenced by lldb_private::Debugger::Destroy(), and CommandObjectSessionSave::DoExecute().

◆ SetBatchCommandMode()

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

Definition at line 521 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)

◆ SetPromptOnQuit()

void CommandInterpreter::SetPromptOnQuit ( bool  enable)

◆ SetQuitExitCode()

bool CommandInterpreter::SetQuitExitCode ( int  exit_code)

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 238 of file CommandInterpreter.cpp.

References m_allow_exit_code, and m_quit_exit_code.

Referenced by lldb_private::CommandObjectQuit::DoExecute().

◆ SetReachedMaximumDepth()

void lldb_private::CommandInterpreter::SetReachedMaximumDepth ( )
inline

Definition at line 532 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 2866 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 506 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 502 of file CommandInterpreter.h.

References m_skip_lldbinit_files.

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

◆ SourceInitFile()

void CommandInterpreter::SourceInitFile ( FileSpec  file,
CommandReturnObject result 
)
private

◆ SourceInitFileCwd()

void CommandInterpreter::SourceInitFileCwd ( CommandReturnObject result)

◆ SourceInitFileGlobal()

void CommandInterpreter::SourceInitFileGlobal ( CommandReturnObject result)

◆ 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 2460 of file CommandInterpreter.cpp.

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

Referenced by lldb::SBCommandInterpreter::SourceInitFileInHomeDirectory().

◆ StartHandlingCommand()

void CommandInterpreter::StartHandlingCommand ( )
private

◆ UpdatePrompt()

void CommandInterpreter::UpdatePrompt ( llvm::StringRef  prompt)

◆ UserCommandExists()

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

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

Definition at line 1373 of file CommandInterpreter.cpp.

References m_user_dict.

Referenced by AddUserCommand(), and lldb::SBCommandInterpreter::UserCommandExists().

◆ UserMultiwordCommandExists()

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

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

Definition at line 1377 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 956 of file CommandInterpreter.cpp.

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

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

◆ WasInterrupted()

bool CommandInterpreter::WasInterrupted ( ) const
protected

Friends And Related Function Documentation

◆ Debugger

friend class Debugger
friend

Definition at line 673 of file CommandInterpreter.h.

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 262 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

CommandObject::CommandMap lldb_private::CommandInterpreter::m_alias_dict
private

◆ m_allow_exit_code

bool lldb_private::CommandInterpreter::m_allow_exit_code = false
private

Definition at line 783 of file CommandInterpreter.h.

Referenced by AllowExitCodeOnQuit(), and SetQuitExitCode().

◆ m_batch_command_mode

bool lldb_private::CommandInterpreter::m_batch_command_mode
private

Definition at line 762 of file CommandInterpreter.h.

Referenced by GetBatchCommandMode(), and SetBatchCommandMode().

◆ m_command_dict

CommandObject::CommandMap lldb_private::CommandInterpreter::m_command_dict
private

◆ 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 760 of file CommandInterpreter.h.

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

◆ m_command_source_depth

uint32_t lldb_private::CommandInterpreter::m_command_source_depth
private

Definition at line 772 of file CommandInterpreter.h.

Referenced by HandleCommand(), HandleCommands(), and HandleCommandsFromFile().

◆ 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 775 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 776 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 787 of file CommandInterpreter.h.

Referenced by GetStatistics(), and IncreaseCommandUsage().

◆ m_comment_char

char lldb_private::CommandInterpreter::m_comment_char
private

◆ m_debugger

Debugger& lldb_private::CommandInterpreter::m_debugger
private

◆ 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 768 of file CommandInterpreter.h.

Referenced by PrintWarningsIfNecessary(), and SetReachedMaximumDepth().

◆ m_overriden_exe_contexts

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

◆ m_quit_exit_code

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

Definition at line 781 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 758 of file CommandInterpreter.h.

Referenced by HandleCommand().

◆ m_result

CommandInterpreterRunResult lldb_private::CommandInterpreter::m_result
private

Definition at line 777 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 748 of file CommandInterpreter.h.

Referenced by 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 746 of file CommandInterpreter.h.

Referenced by 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 806 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 791 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 765 of file CommandInterpreter.h.

Referenced by ChildrenTruncated(), and PrintWarningsIfNecessary().

◆ m_user_dict

CommandObject::CommandMap lldb_private::CommandInterpreter::m_user_dict
private

◆ m_user_mw_dict

CommandObject::CommandMap lldb_private::CommandInterpreter::m_user_mw_dict
private

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