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

#include "lldb/Utility/Args.h"

Collaboration diagram for lldb_private::Args:
Collaboration graph
[legend]

Classes

struct  ArgEntry
 

Public Types

using const_iterator = std::vector< ArgEntry >::const_iterator
 

Public Member Functions

 Args (llvm::StringRef command=llvm::StringRef())
 Construct with an option command string. More...
 
 Args (const Args &rhs)
 
 Args (const StringList &list)
 
 Args (llvm::ArrayRef< llvm::StringRef > args)
 
Argsoperator= (const Args &rhs)
 
 ~Args ()
 Destructor. More...
 
 Args (const Environment &env)
 
 operator Environment () const
 
void Dump (Stream &s, const char *label_name="argv") const
 Dump all entries to the stream s using label label_name. More...
 
void SetCommandString (llvm::StringRef command)
 Sets the command string contained by this object. More...
 
bool GetCommandString (std::string &command) const
 
bool GetQuotedCommandString (std::string &command) const
 
size_t GetArgumentCount () const
 Gets the number of arguments left in this command object. More...
 
bool empty () const
 
const char * GetArgumentAtIndex (size_t idx) const
 Gets the NULL terminated C string argument pointer for the argument at index idx. More...
 
llvm::ArrayRef< ArgEntryentries () const
 
const_iterator begin () const
 
const_iterator end () const
 
size_t size () const
 
const ArgEntryoperator[] (size_t n) const
 
char ** GetArgumentVector ()
 Gets the argument vector. More...
 
const char ** GetConstArgumentVector () const
 Gets the argument vector. More...
 
llvm::ArrayRef< const char * > GetArgumentArrayRef () const
 Gets the argument as an ArrayRef. More...
 
void AppendArgument (llvm::StringRef arg_str, char quote_char='\0')
 Appends a new argument to the end of the list argument list. More...
 
void AppendArguments (const Args &rhs)
 
void AppendArguments (const char **argv)
 
void InsertArgumentAtIndex (size_t idx, llvm::StringRef arg_str, char quote_char='\0')
 Insert the argument value at index idx to arg_str. More...
 
void ReplaceArgumentAtIndex (size_t idx, llvm::StringRef arg_str, char quote_char='\0')
 Replaces the argument value at index idx to arg_str if idx is a valid argument index. More...
 
void DeleteArgumentAtIndex (size_t idx)
 Deletes the argument value at index if idx is a valid argument index. More...
 
void SetArguments (size_t argc, const char **argv)
 Sets the argument vector value, optionally copying all arguments into an internal buffer. More...
 
void SetArguments (const char **argv)
 
void Shift ()
 Shifts the first argument C string value of the array off the argument array. More...
 
void Unshift (llvm::StringRef arg_str, char quote_char='\0')
 Inserts a class owned copy of arg_str at the beginning of the argument vector. More...
 
void Clear ()
 Clear the arguments. More...
 

Static Public Member Functions

static lldb::Encoding StringToEncoding (llvm::StringRef s, lldb::Encoding fail_value=lldb::eEncodingInvalid)
 
static uint32_t StringToGenericRegister (llvm::StringRef s)
 
static std::string GetShellSafeArgument (const FileSpec &shell, llvm::StringRef unsafe_arg)
 
static void EncodeEscapeSequences (const char *src, std::string &dst)
 EncodeEscapeSequences will change the textual representation of common escape sequences like "\n" (two characters) into a single '
'. More...
 
static void ExpandEscapedCharacters (const char *src, std::string &dst)
 ExpandEscapeSequences will change a string of possibly non-printable characters and expand them into text. More...
 
static std::string EscapeLLDBCommandArgument (const std::string &arg, char quote_char)
 

Private Attributes

std::vector< ArgEntrym_entries
 
std::vector< char * > m_argv
 The arguments as C strings with a trailing nullptr element. More...
 

Friends

struct llvm::yaml::MappingTraits< Args >
 

Detailed Description

A command line argument class.

The Args class is designed to be fed a command line. The command line is copied into an internal buffer and then split up into arguments. Arguments are space delimited if there are no quotes (single, double, or backtick quotes) surrounding the argument. Spaces can be escaped using a \ character to avoid having to surround an argument that contains a space with quotes.

Definition at line 33 of file Args.h.

Member Typedef Documentation

◆ const_iterator

Definition at line 132 of file Args.h.

Constructor & Destructor Documentation

◆ Args() [1/5]

Args::Args ( llvm::StringRef  command = llvm::StringRef())

Construct with an option command string.

Parameters
[in]commandA NULL terminated command that will be copied and split up into arguments.
See also
Args::SetCommandString(llvm::StringRef)

Definition at line 169 of file Args.cpp.

References SetCommandString().

◆ Args() [2/5]

Args::Args ( const Args rhs)

Definition at line 171 of file Args.cpp.

◆ Args() [3/5]

Args::Args ( const StringList list)
explicit

Definition at line 173 of file Args.cpp.

References AppendArgument(), and string().

◆ Args() [4/5]

Args::Args ( llvm::ArrayRef< llvm::StringRef >  args)
explicit

Definition at line 178 of file Args.cpp.

References AppendArgument().

◆ ~Args()

Args::~Args ( )
default

Destructor.

◆ Args() [5/5]

lldb_private::Args::Args ( const Environment env)
inlineexplicit

Member Function Documentation

◆ AppendArgument()

void Args::AppendArgument ( llvm::StringRef  arg_str,
char  quote_char = '\0' 
)

◆ AppendArguments() [1/2]

void Args::AppendArguments ( const Args rhs)

◆ AppendArguments() [2/2]

void Args::AppendArguments ( const char **  argv)

Definition at line 304 of file Args.cpp.

References ArgvToArgc(), m_argv, and m_entries.

◆ begin()

const_iterator lldb_private::Args::begin ( ) const
inline

Definition at line 134 of file Args.h.

References m_entries.

Referenced by FindOriginalIndex().

◆ Clear()

void Args::Clear ( )

◆ DeleteArgumentAtIndex()

void Args::DeleteArgumentAtIndex ( size_t  idx)

Deletes the argument value at index if idx is a valid argument index.

Parameters
[in]idxThe index of the argument that will have its value replaced.

Definition at line 345 of file Args.cpp.

References m_argv, and m_entries.

Referenced by lldb_private::Options::ParseAlias().

◆ Dump()

void Args::Dump ( Stream s,
const char *  label_name = "argv" 
) const

Dump all entries to the stream s using label label_name.

If label_name is nullptr, the dump operation is skipped.

Parameters
[in]sThe stream to which to dump all arguments in the argument vector.
[in]label_nameThe label_name to use as the label printed for each entry of the args like so: {label_name}[{index}]={value}

Definition at line 199 of file Args.cpp.

References lldb_private::Stream::EOL(), lldb_private::Stream::Format(), lldb_private::Stream::Indent(), and m_entries.

Referenced by lldb_private::ProcessInfo::Dump().

◆ empty()

bool lldb_private::Args::empty ( ) const
inline

◆ EncodeEscapeSequences()

void Args::EncodeEscapeSequences ( const char *  src,
std::string dst 
)
static

EncodeEscapeSequences will change the textual representation of common escape sequences like "\n" (two characters) into a single '
'.

It does this for all of the supported escaped sequences and for the \0ooo (octal) and \xXX (hex). The resulting "dst" string will contain the character versions of all supported escape sequences. The common supported escape sequences are: "\a", "\b", "\f", "\n", "\r", "\t", "\v", "\'", "\"", "\".

Definition at line 446 of file Args.cpp.

◆ end()

const_iterator lldb_private::Args::end ( ) const
inline

Definition at line 135 of file Args.h.

References m_entries.

Referenced by CommandObjectSourceList::GetRepeatCommand(), and ReconstituteArgsAfterParsing().

◆ entries()

llvm::ArrayRef<ArgEntry> lldb_private::Args::entries ( ) const
inline

◆ EscapeLLDBCommandArgument()

std::string Args::EscapeLLDBCommandArgument ( const std::string arg,
char  quote_char 
)
static

Definition at line 596 of file Args.cpp.

References string().

◆ ExpandEscapedCharacters()

void Args::ExpandEscapedCharacters ( const char *  src,
std::string dst 
)
static

ExpandEscapeSequences will change a string of possibly non-printable characters and expand them into text.

So '
' will turn into two characters like "\n" which is suitable for human reading. When a character is not printable and isn't one of the common in escape sequences listed in the help for EncodeEscapeSequences, then it will be encoded as octal. Printable characters are left alone.

Definition at line 545 of file Args.cpp.

◆ GetArgumentArrayRef()

llvm::ArrayRef<const char *> lldb_private::Args::GetArgumentArrayRef ( ) const
inline

Gets the argument as an ArrayRef.

Note that the return value does not have a nullptr const char * at the end, as the size of the list is embedded in the ArrayRef object.

Definition at line 171 of file Args.h.

References m_argv.

Referenced by CommandObjectLogEnable::DoExecute(), CommandObjectLogDisable::DoExecute(), and lldb_private::CommandObjectMultiwordBreakpoint::VerifyIDs().

◆ GetArgumentAtIndex()

const char * Args::GetArgumentAtIndex ( size_t  idx) const

Gets the NULL terminated C string argument pointer for the argument at index idx.

Returns
The NULL terminated C string argument pointer if idx is a valid argument index, NULL otherwise.

Definition at line 259 of file Args.cpp.

References m_argv.

Referenced by CompleteEnableDisable(), lldb_private::platform_android::PlatformAndroidRemoteGDBServer::ConnectRemote(), lldb_private::platform_android::PlatformAndroid::ConnectRemote(), PlatformAppleSimulator::ConnectRemote(), lldb_private::platform_gdb_server::PlatformRemoteGDBServer::ConnectRemote(), lldb_private::CommandObjectQuit::DoExecute(), CommandObjectRenderScriptScriptGroupBreakpointSet::DoExecute(), lldb_private::CommandObjectIterateOverThreads::DoExecute(), lldb_private::CommandObjectMultipleThreads::DoExecute(), CommandObjectPlatformSelect::DoExecute(), CommandObjectTargetCreate::DoExecute(), CommandObjectThreadStepWithTypeAndScope::DoExecute(), CommandObjectTargetSelect::DoExecute(), CommandObjectSettingsRemove::DoExecute(), CommandObjectSettingsReplace::DoExecute(), CommandObjectProcessConnect::DoExecute(), CommandObjectSettingsInsertBefore::DoExecute(), CommandObjectTypeFormatterDelete::DoExecute(), CommandObjectObjC_ClassTable_Dump::DoExecute(), CommandObjectThreadUntil::DoExecute(), CommandObjectSettingsInsertAfter::DoExecute(), CommandObjectTypeFormatterClear::DoExecute(), CommandObjectMultiwordObjC_TaggedPointer_Info::DoExecute(), CommandObjectFrameRecognizerDelete::DoExecute(), CommandObjectSettingsAppend::DoExecute(), CommandObjectTargetModulesSearchPathsAdd::DoExecute(), CommandObjectProcessSignal::DoExecute(), CommandObjectTypeFormatterList< TypeFormatImpl >::DoExecute(), CommandObjectFrameRecognizerInfo::DoExecute(), CommandObjectPlatformPutFile::DoExecute(), CommandObjectSettingsClear::DoExecute(), CommandObjectThreadSelect::DoExecute(), CommandObjectTargetModulesSearchPathsInsert::DoExecute(), CommandObjectProcessSaveCore::DoExecute(), CommandObjectTargetModulesSearchPathsQuery::DoExecute(), CommandObjectThreadPlanDiscard::DoExecute(), CommandObjectPlatformInstall::DoExecute(), CommandObjectTargetModulesDumpObjfile::DoExecute(), CommandObjectThreadPlanPrune::DoExecute(), CommandObjectTargetModulesDumpSymtab::DoExecute(), CommandObjectTargetModulesDumpSections::DoExecute(), CommandObjectTargetModulesDumpSymfile::DoExecute(), CommandObjectTargetModulesDumpLineTable::DoExecute(), CommandObjectTargetModulesLoad::DoExecute(), CommandObjectTargetModulesShowUnwind::DoExecute(), CommandObjectTargetModulesLookup::DoExecute(), CommandObjectRenderScriptRuntimeReductionBreakpointSet::DoExecute(), CommandObjectRenderScriptRuntimeKernelBreakpointSet::DoExecute(), CommandObjectRenderScriptRuntimeKernelBreakpointAll::DoExecute(), CommandObjectRenderScriptRuntimeAllocationDump::DoExecute(), CommandObjectRenderScriptRuntimeAllocationLoad::DoExecute(), CommandObjectRenderScriptRuntimeAllocationSave::DoExecute(), CommandObjectTargetStopHookDelete::DoExecute(), CommandObjectTargetStopHookEnableDisable::DoExecute(), CommandObjectProcessGDBRemotePacketXferSize::DoExecute(), CommandObjectProcessGDBRemotePacketSend::DoExecute(), lldb_private::ProcessInstanceInfo::Dump(), lldb_private::ProcessInstanceInfo::DumpAsTableRow(), lldb_private::CompletionRequest::GetCursorArgumentPrefix(), lldb_private::Options::HandleOptionArgumentCompletion(), CommandObjectBreakpointRead::CommandOptions::HandleOptionArgumentCompletion(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::LaunchProcess(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerPlatform::LaunchProcess(), sddarwinlog_private::ParseAutoEnableOptions(), CommandObjectProcessHandle::PrintSignalInformation(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::SendArgumentsPacket(), lldb_private::OptionValueArray::SetArgs(), lldb_private::ProcessInfo::SetArguments(), lldb_private::OptionValuePathMappings::SetValueFromString(), lldb_private::OptionValueFileSpecList::SetValueFromString(), CoreSimulatorSupport::Device::Spawn(), and lldb_private::UnwindLLDB::UnwindLLDB().

◆ GetArgumentCount()

size_t lldb_private::Args::GetArgumentCount ( ) const
inline

Gets the number of arguments left in this command object.

Returns
The number or arguments in this object.

Definition at line 118 of file Args.h.

References m_entries.

Referenced by AppendArgument(), lldb_private::CompletionRequest::CompletionRequest(), lldb_private::ObjCLanguageRuntime::ObjCExceptionPrecondition::ConfigurePrecondition(), lldb_private::platform_android::PlatformAndroidRemoteGDBServer::ConnectRemote(), PlatformAppleSimulator::ConnectRemote(), lldb_private::platform_gdb_server::PlatformRemoteGDBServer::ConnectRemote(), lldb_private::process_gdb_remote::ProcessGDBRemote::ConnectToDebugserver(), lldb_private::CommandObjectGUI::DoExecute(), lldb_private::CommandObjectQuit::DoExecute(), lldb_private::CommandObjectVersion::DoExecute(), lldb_private::CommandObjectApropos::DoExecute(), CommandObjectMemoryTagRead::DoExecute(), CommandObjectRenderScriptScriptGroupBreakpointSet::DoExecute(), CommandObjectPluginLoad::DoExecute(), lldb_private::CommandObjectIterateOverThreads::DoExecute(), lldb_private::CommandObjectHelp::DoExecute(), lldb_private::CommandObjectMultipleThreads::DoExecute(), CommandObjectCommandsSource::DoExecute(), CommandObjectLogEnable::DoExecute(), CommandObjectProcessLaunch::DoExecute(), CommandObjectRegisterRead::DoExecute(), CommandObjectPlatformSelect::DoExecute(), CommandObjectMemoryTagWrite::DoExecute(), CommandObjectWatchpointList::DoExecute(), CommandObjectTargetCreate::DoExecute(), CommandObjectWatchpointEnable::DoExecute(), CommandObjectFrameSelect::DoExecute(), CommandObjectLogTimerEnable::DoExecute(), CommandObjectPlatformDisconnect::DoExecute(), CommandObjectRegisterWrite::DoExecute(), CommandObjectMemoryRead::DoExecute(), CommandObjectProcessAttach::DoExecute(), CommandObjectWatchpointDisable::DoExecute(), CommandObjectThreadStepWithTypeAndScope::DoExecute(), CommandObjectLogTimerIncrement::DoExecute(), CommandObjectTargetList::DoExecute(), CommandObjectTargetSelect::DoExecute(), CommandObjectWatchpointCommandDelete::DoExecute(), CommandObjectSettingsList::DoExecute(), CommandObjectProcessContinue::DoExecute(), CommandObjectSourceInfo::DoExecute(), CommandObjectTargetDelete::DoExecute(), CommandObjectWatchpointCommandList::DoExecute(), CommandObjectSettingsRemove::DoExecute(), CommandObjectWatchpointIgnore::DoExecute(), CommandObjectThreadContinue::DoExecute(), CommandObjectWatchpointModify::DoExecute(), CommandObjectProcessConnect::DoExecute(), CommandObjectSettingsInsertBefore::DoExecute(), CommandObjectTypeFormatterDelete::DoExecute(), CommandObjectTargetVariable::DoExecute(), CommandObjectObjC_ClassTable_Dump::DoExecute(), CommandObjectProcessMinidumpDump::DoExecute(), CommandObjectThreadUntil::DoExecute(), CommandObjectSettingsInsertAfter::DoExecute(), CommandObjectProcessKDPPacketSend::DoExecute(), CommandObjectTypeFormatterClear::DoExecute(), CommandObjectSourceList::DoExecute(), CommandObjectMultiwordObjC_TaggedPointer_Info::DoExecute(), CommandObjectFrameRecognizerDelete::DoExecute(), CommandObjectSettingsAppend::DoExecute(), CommandObjectMemoryFind::DoExecute(), CommandObjectTargetModulesSearchPathsAdd::DoExecute(), CommandObjectProcessSignal::DoExecute(), CommandObjectTypeFormatterList< TypeFormatImpl >::DoExecute(), CommandObjectFrameRecognizerInfo::DoExecute(), CommandObjectSettingsClear::DoExecute(), CommandObjectProcessInterrupt::DoExecute(), CommandObjectThreadSelect::DoExecute(), CommandObjectPlatformProcessLaunch::DoExecute(), CommandObjectProcessKill::DoExecute(), CommandObjectTargetModulesSearchPathsInsert::DoExecute(), CommandObjectTargetModulesSearchPathsList::DoExecute(), CommandObjectPlatformProcessList::DoExecute(), CommandObjectProcessSaveCore::DoExecute(), CommandObjectTargetModulesSearchPathsQuery::DoExecute(), CommandObjectMemoryWrite::DoExecute(), CommandObjectProcessStatus::DoExecute(), CommandObjectCommandsScriptAdd::DoExecute(), CommandObjectPlatformProcessInfo::DoExecute(), CommandObjectProcessHandle::DoExecute(), CommandObjectCommandsScriptList::DoExecute(), CommandObjectMemoryHistory::DoExecute(), CommandObjectCommandsScriptClear::DoExecute(), CommandObjectMemoryRegion::DoExecute(), CommandObjectCommandsScriptDelete::DoExecute(), CommandObjectThreadPlanList::DoExecute(), CommandObjectBreakpointNameConfigure::DoExecute(), CommandObjectThreadPlanDiscard::DoExecute(), CommandObjectPlatformInstall::DoExecute(), CommandObjectTargetModulesDumpObjfile::DoExecute(), CommandObjectThreadPlanPrune::DoExecute(), CommandObjectTargetModulesDumpSymtab::DoExecute(), CommandObjectTargetModulesDumpSections::DoExecute(), CommandObjectTargetModulesDumpClangAST::DoExecute(), CommandObjectTargetModulesDumpSymfile::DoExecute(), CommandObjectTargetModulesDumpLineTable::DoExecute(), CommandObjectTargetModulesAdd::DoExecute(), CommandObjectTargetModulesLoad::DoExecute(), CommandObjectTargetModulesList::DoExecute(), CommandObjectTargetModulesShowUnwind::DoExecute(), CommandObjectTargetModulesLookup::DoExecute(), CommandObjectRenderScriptRuntimeReductionBreakpointSet::DoExecute(), CommandObjectRenderScriptRuntimeKernelBreakpointSet::DoExecute(), CommandObjectTargetSymbolsAdd::DoExecute(), CommandObjectRenderScriptRuntimeKernelBreakpointAll::DoExecute(), CommandObjectRenderScriptRuntimeAllocationDump::DoExecute(), CommandObjectRenderScriptRuntimeAllocationLoad::DoExecute(), CommandObjectRenderScriptRuntimeAllocationSave::DoExecute(), CommandObjectTargetStopHookDelete::DoExecute(), CommandObjectTargetStopHookEnableDisable::DoExecute(), CommandObjectProcessGDBRemoteSpeedTest::DoExecute(), CommandObjectProcessGDBRemotePacketHistory::DoExecute(), CommandObjectProcessGDBRemotePacketXferSize::DoExecute(), CommandObjectProcessGDBRemotePacketSend::DoExecute(), lldb_private::ProcessInstanceInfo::Dump(), lldb_private::ProcessInstanceInfo::DumpAsTableRow(), empty(), lldb_private::CommandObjectMultiword::Execute(), CommandObjectTypeSummaryAdd::Execute_StringSummary(), lldb_private::OptionValueArgs::GetArgs(), lldb_private::OptionValueDictionary::GetArgs(), lldb_private::OptionValueArray::GetArgs(), lldb_private::CommandObjectMultiword::GetRepeatCommand(), lldb_private::CommandObjectMultiword::HandleCompletion(), lldb::SBCommandInterpreter::HandleCompletionWithDescriptions(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::LaunchProcess(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerPlatform::LaunchProcess(), lldb_private::Options::ParseAlias(), sddarwinlog_private::ParseAutoEnableOptions(), CommandObjectProcessHandle::PrintSignalInformation(), lldb_private::OptionValueDictionary::SetArgs(), lldb_private::OptionValueArray::SetArgs(), lldb_private::OptionValuePathMappings::SetValueFromString(), lldb_private::OptionValueFileSpecList::SetValueFromString(), size(), CoreSimulatorSupport::Device::Spawn(), lldb_private::process_gdb_remote::GDBRemoteCommunication::StartDebugserverProcess(), lldb_private::UnwindLLDB::UnwindLLDB(), and lldb_private::CommandObjectMultiwordWatchpoint::VerifyWatchpointIDs().

◆ GetArgumentVector()

char ** Args::GetArgumentVector ( )

Gets the argument vector.

The value returned by this function can be used by any function that takes and vector. The return value is just like argv in the standard C entry point function:

int main (int argc, const char **argv);
Returns
An array of NULL terminated C string argument pointers that also has a terminating NULL C string pointer

Definition at line 265 of file Args.cpp.

References m_argv.

Referenced by CommandPluginInterfaceImplementation::DoExecute().

◆ GetCommandString()

bool Args::GetCommandString ( std::string command) const

◆ GetConstArgumentVector()

const char ** Args::GetConstArgumentVector ( ) const

Gets the argument vector.

The value returned by this function can be used by any function that takes and vector. The return value is just like argv in the standard C entry point function:

int main (int argc, const char **argv);
Returns
An array of NULL terminate C string argument pointers that also has a terminating NULL C string pointer

Definition at line 275 of file Args.cpp.

References m_argv.

Referenced by ChildFunc(), lldb_private::ProcessLaunchInfo::ConvertArgumentsForLaunchingInShell(), lldb_private::CommandObjectParsed::Execute(), LaunchProcessPosixSpawn(), and operator Environment().

◆ GetQuotedCommandString()

bool Args::GetQuotedCommandString ( std::string command) const

Definition at line 224 of file Args.cpp.

References m_entries.

◆ GetShellSafeArgument()

std::string Args::GetShellSafeArgument ( const FileSpec shell,
llvm::StringRef  unsafe_arg 
)
static

◆ InsertArgumentAtIndex()

void Args::InsertArgumentAtIndex ( size_t  idx,
llvm::StringRef  arg_str,
char  quote_char = '\0' 
)

Insert the argument value at index idx to arg_str.

Parameters
[in]idxThe index of where to insert the argument.
[in]arg_strThe new argument.
[in]quote_charIf the argument was originally quoted, put in the quote char here.

Definition at line 322 of file Args.cpp.

References m_argv, and m_entries.

Referenced by AppendArgument(), lldb_private::ProcessInfo::SetExecutableFile(), and Unshift().

◆ operator Environment()

lldb_private::Args::operator Environment ( ) const
inlineexplicit

Definition at line 80 of file Args.h.

References GetConstArgumentVector().

◆ operator=()

Args & Args::operator= ( const Args rhs)

Definition at line 183 of file Args.cpp.

References Clear(), m_argv, and m_entries.

◆ operator[]()

const ArgEntry& lldb_private::Args::operator[] ( size_t  n) const
inline

Definition at line 138 of file Args.h.

References m_entries.

◆ ReplaceArgumentAtIndex()

void Args::ReplaceArgumentAtIndex ( size_t  idx,
llvm::StringRef  arg_str,
char  quote_char = '\0' 
)

Replaces the argument value at index idx to arg_str if idx is a valid argument index.

Parameters
[in]idxThe index of the argument that will have its value replaced.
[in]arg_strThe new argument.
[in]quote_charIf the argument was originally quoted, put in the quote char here.

Definition at line 333 of file Args.cpp.

References m_argv, and m_entries.

Referenced by lldb_private::platform_android::PlatformAndroidRemoteGDBServer::ConnectRemote(), and lldb_private::CommandObjectParsed::Execute().

◆ SetArguments() [1/2]

void Args::SetArguments ( const char **  argv)

Definition at line 370 of file Args.cpp.

References ArgvToArgc(), and SetArguments().

◆ SetArguments() [2/2]

void Args::SetArguments ( size_t  argc,
const char **  argv 
)

Sets the argument vector value, optionally copying all arguments into an internal buffer.

Sets the arguments to match those found in argv. All argument strings will be copied into an internal buffers.

Definition at line 353 of file Args.cpp.

References Clear(), m_argv, and m_entries.

Referenced by Args(), lldb_private::ProcessInfo::SetArguments(), and SetArguments().

◆ SetCommandString()

void Args::SetCommandString ( llvm::StringRef  command)

Sets the command string contained by this object.

The command string will be copied and split up into arguments that can be accessed via the accessor functions.

Parameters
[in]commandA command StringRef that will be copied and split up into arguments.
See also
Args::GetArgumentCount() const
Args::GetArgumentAtIndex (size_t) const
Args::GetArgumentVector ()
Args::Shift ()
Args::Unshift (const char *)

Definition at line 243 of file Args.cpp.

References Clear(), ltrimForArgs(), m_argv, m_entries, ParseSingleArgument(), and string().

Referenced by Args().

◆ Shift()

void Args::Shift ( )

Shifts the first argument C string value of the array off the argument array.

The string value will be freed, so a copy of the string should be made by calling Args::GetArgumentAtIndex (size_t) const first and copying the returned value before calling Args::Shift().

See also
Args::GetArgumentAtIndex (size_t) const

Definition at line 281 of file Args.cpp.

References m_argv, and m_entries.

Referenced by CommandObjectLogEnable::DoExecute(), CommandObjectMemoryTagWrite::DoExecute(), CommandObjectLogDisable::DoExecute(), CommandObjectTargetModulesSearchPathsInsert::DoExecute(), CommandObjectMemoryWrite::DoExecute(), lldb_private::CommandObjectMultiword::Execute(), lldb_private::CommandObjectMultiword::HandleCompletion(), sddarwinlog_private::ParseAutoEnableOptions(), and lldb_private::CompletionRequest::ShiftArguments().

◆ size()

size_t lldb_private::Args::size ( ) const
inline

◆ StringToEncoding()

lldb::Encoding Args::StringToEncoding ( llvm::StringRef  s,
lldb::Encoding  fail_value = lldb::eEncodingInvalid 
)
static

◆ StringToGenericRegister()

uint32_t Args::StringToGenericRegister ( llvm::StringRef  s)
static

◆ Unshift()

void Args::Unshift ( llvm::StringRef  arg_str,
char  quote_char = '\0' 
)

Inserts a class owned copy of arg_str at the beginning of the argument vector.

A copy arg_str will be made.

Parameters
[in]arg_strThe argument to push on the front of the argument stack.
[in]quote_charIf the argument was originally quoted, put in the quote char here.

Definition at line 289 of file Args.cpp.

References InsertArgumentAtIndex().

Friends And Related Function Documentation

◆ llvm::yaml::MappingTraits< Args >

friend struct llvm::yaml::MappingTraits< Args >
friend

Definition at line 290 of file Args.h.

Member Data Documentation

◆ m_argv

std::vector<char *> lldb_private::Args::m_argv
private

The arguments as C strings with a trailing nullptr element.

These strings are owned by the ArgEntry object in m_entries with the same index.

Definition at line 297 of file Args.h.

Referenced by AppendArguments(), Clear(), DeleteArgumentAtIndex(), GetArgumentArrayRef(), GetArgumentAtIndex(), GetArgumentVector(), GetConstArgumentVector(), InsertArgumentAtIndex(), operator=(), ReplaceArgumentAtIndex(), SetArguments(), SetCommandString(), and Shift().

◆ m_entries

std::vector<ArgEntry> lldb_private::Args::m_entries
private

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