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

A command line argument class. More...

#include "lldb/Utility/Args.h"

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)
 
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
 
char GetArgumentQuoteCharAtIndex (size_t idx) 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_cstr. More...
 
void ReplaceArgumentAtIndex (size_t idx, llvm::StringRef arg_str, char quote_char='\0')
 Replaces the argument value at index idx to arg_cstr 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_cstr at the beginning of the argument vector. More...
 
void Clear ()
 

Static Public Member Functions

static const char * StripSpaces (std::string &s, bool leading=true, bool trailing=true, bool return_null_if_empty=true)
 
static bool UInt64ValueIsValidForByteSize (uint64_t uval64, size_t total_byte_size)
 
static bool SInt64ValueIsValidForByteSize (int64_t sval64, size_t total_byte_size)
 
static lldb::Encoding StringToEncoding (llvm::StringRef s, lldb::Encoding fail_value=lldb::eEncodingInvalid)
 
static uint32_t StringToGenericRegister (llvm::StringRef s)
 
static const char * GetShellSafeArgument (const FileSpec &shell, const char *unsafe_arg, std::string &safe_arg)
 
static void EncodeEscapeSequences (const char *src, std::string &dst)
 
static void ExpandEscapedCharacters (const char *src, std::string &dst)
 
static std::string EscapeLLDBCommandArgument (const std::string &arg, char quote_char)
 

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 32 of file Args.h.

Member Typedef Documentation

◆ const_iterator

Definition at line 126 of file Args.h.

Constructor & Destructor Documentation

◆ Args() [1/4]

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

Referenced by lldb_private::OptionsWithRaw::OptionsWithRaw().

◆ Args() [2/4]

Args::Args ( const Args rhs)

Definition at line 171 of file Args.cpp.

◆ Args() [3/4]

Args::Args ( const StringList list)
explicit

Definition at line 173 of file Args.cpp.

References AppendArgument(), and lldb_private::StringList::GetSize().

◆ ~Args()

Args::~Args ( )

Destructor.

Definition at line 192 of file Args.cpp.

Referenced by lldb_private::Args::ArgEntry::IsQuoted().

◆ Args() [4/4]

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 307 of file Args.cpp.

References ArgvToArgc().

◆ begin()

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

◆ 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 355 of file Args.cpp.

Referenced by GetArgumentArrayRef(), and 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 194 of file Args.cpp.

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

Referenced by lldb_private::ProcessInfo::Dump(), and operator Environment().

◆ empty()

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

◆ EncodeEscapeSequences()

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

Definition at line 482 of file Args.cpp.

Referenced by SInt64ValueIsValidForByteSize().

◆ end()

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

◆ entries()

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

◆ EscapeLLDBCommandArgument()

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

◆ ExpandEscapedCharacters()

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

Definition at line 581 of file Args.cpp.

References isprint().

Referenced by SInt64ValueIsValidForByteSize().

◆ 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 165 of file Args.h.

References AppendArgument(), AppendArguments(), Clear(), DeleteArgumentAtIndex(), InsertArgumentAtIndex(), ReplaceArgumentAtIndex(), SetArguments(), Shift(), StripSpaces(), and Unshift().

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

◆ 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 256 of file Args.cpp.

Referenced by lldb_private::CommandInterpreter::BuildAliasCommandArgs(), lldb_private::CommandInterpreter::BuildAliasResult(), lldb_private::CompletionRequest::CompletionRequest(), lldb_private::platform_android::PlatformAndroidRemoteGDBServer::ConnectRemote(), PlatformAppleSimulator::ConnectRemote(), lldb_private::platform_android::PlatformAndroid::ConnectRemote(), lldb_private::platform_gdb_server::PlatformRemoteGDBServer::ConnectRemote(), lldb_private::CommandObjectQuit::DoExecute(), CommandObjectRenderScriptScriptGroupBreakpointSet::DoExecute(), CommandObjectIterateOverThreads::DoExecute(), CommandObjectSettingsSet::DoExecute(), CommandObjectPlatformSelect::DoExecute(), CommandObjectTargetCreate::DoExecute(), CommandObjectTargetSelect::DoExecute(), CommandObjectSettingsList::DoExecute(), CommandObjectObjC_ClassTable_Dump::DoExecute(), CommandObjectThreadStepWithTypeAndScope::DoExecute(), CommandObjectSettingsRemove::DoExecute(), CommandObjectMultiwordObjC_TaggedPointer_Info::DoExecute(), CommandObjectSettingsReplace::DoExecute(), CommandObjectWatchpointSetVariable::DoExecute(), CommandObjectPlatformGetFile::DoExecute(), CommandObjectTypeFormatterDelete::DoExecute(), CommandObjectTargetVariable::DoExecute(), CommandObjectSettingsInsertBefore::DoExecute(), CommandObjectProcessConnect::DoExecute(), CommandObjectPlatformGetSize::DoExecute(), CommandObjectPlatformPutFile::DoExecute(), CommandObjectFrameRecognizerDelete::DoExecute(), CommandObjectTypeFormatterClear::DoExecute(), CommandObjectSettingsInsertAfter::DoExecute(), CommandObjectFrameRecognizerInfo::DoExecute(), CommandObjectSettingsAppend::DoExecute(), CommandObjectTargetModulesSearchPathsAdd::DoExecute(), CommandObjectTypeFormatterList< TypeFilterImpl >::DoExecute(), CommandObjectProcessSignal::DoExecute(), CommandObjectThreadUntil::DoExecute(), CommandObjectSettingsClear::DoExecute(), CommandObjectTargetModulesSearchPathsInsert::DoExecute(), CommandObjectProcessSaveCore::DoExecute(), CommandObjectTargetModulesSearchPathsQuery::DoExecute(), CommandObjectThreadSelect::DoExecute(), CommandObjectPlatformInstall::DoExecute(), CommandObjectTargetModulesDumpObjfile::DoExecute(), CommandObjectTypeCategoryEnable::DoExecute(), CommandObjectThreadPlanDiscard::DoExecute(), CommandObjectTypeCategoryDelete::DoExecute(), CommandObjectTargetModulesDumpSymtab::DoExecute(), CommandObjectTypeCategoryDisable::DoExecute(), CommandObjectTargetModulesDumpSections::DoExecute(), CommandObjectTypeCategoryList::DoExecute(), CommandObjectTargetModulesDumpSymfile::DoExecute(), CommandObjectTargetModulesDumpLineTable::DoExecute(), CommandObjectTargetModulesLoad::DoExecute(), CommandObjectTargetModulesList::DoExecute(), CommandObjectTargetModulesLookup::DoExecute(), CommandObjectRenderScriptRuntimeReductionBreakpointSet::DoExecute(), CommandObjectRenderScriptRuntimeKernelBreakpointSet::DoExecute(), CommandObjectRenderScriptRuntimeKernelBreakpointAll::DoExecute(), CommandObjectRenderScriptRuntimeAllocationDump::DoExecute(), CommandObjectRenderScriptRuntimeAllocationLoad::DoExecute(), CommandObjectTargetStopHookDelete::DoExecute(), CommandObjectRenderScriptRuntimeAllocationSave::DoExecute(), CommandObjectTargetStopHookEnableDisable::DoExecute(), CommandObjectProcessGDBRemotePacketXferSize::DoExecute(), CommandObjectProcessGDBRemotePacketSend::DoExecute(), lldb_private::ProcessInstanceInfo::Dump(), lldb_private::ProcessInstanceInfo::DumpAsTableRow(), empty(), lldb_private::CommandInterpreter::GetCommandSPExact(), GetMacOSXProcessUserAndGroup(), CommandObjectSettingsSet::HandleArgumentCompletion(), lldb_private::CommandInterpreter::HandleCompletion(), lldb_private::CommandInterpreter::HandleCompletionMatches(), lldb_private::Options::HandleOptionArgumentCompletion(), CommandObjectProcessAttach::CommandOptions::HandleOptionArgumentCompletion(), CommandObjectPlatformProcessAttach::CommandOptions::HandleOptionArgumentCompletion(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerPlatform::LaunchProcess(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::LaunchProcess(), sddarwinlog_private::ParseAutoEnableOptions(), CommandObjectProcessHandle::PrintSignalInformation(), lldb_private::process_gdb_remote::GDBRemoteCommunicationClient::SendArgumentsPacket(), lldb_private::OptionValueArray::SetArgs(), lldb_private::ProcessInfo::SetArguments(), and lldb_private::UnwindLLDB::UnwindLLDB().

◆ GetArgumentCount()

size_t Args::GetArgumentCount ( ) const

Gets the number of arguments left in this command object.

Returns
The number or arguments in this object.

Definition at line 254 of file Args.cpp.

Referenced by AppendArgument(), lldb_private::CommandInterpreter::BuildAliasCommandArgs(), lldb_private::CommandInterpreter::BuildAliasResult(), CommandObjectTypeFormatList::CommandObjectTypeFormatList(), CommandObjectTypeSynthClear::CommandObjectTypeSynthClear(), 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(), CommandObjectRenderScriptScriptGroupBreakpointSet::DoExecute(), CommandObjectPluginLoad::DoExecute(), lldb_private::CommandObjectHelp::DoExecute(), CommandObjectIterateOverThreads::DoExecute(), CommandObjectProcessLaunch::DoExecute(), CommandObjectLogEnable::DoExecute(), CommandObjectRegisterRead::DoExecute(), CommandObjectSettingsSet::DoExecute(), CommandObjectPlatformSelect::DoExecute(), CommandObjectWatchpointList::DoExecute(), CommandObjectTargetCreate::DoExecute(), CommandObjectCommandsSource::DoExecute(), CommandObjectLogTimer::DoExecute(), CommandObjectWatchpointEnable::DoExecute(), CommandObjectFrameSelect::DoExecute(), CommandObjectRegisterWrite::DoExecute(), CommandObjectPlatformDisconnect::DoExecute(), CommandObjectMemoryRead::DoExecute(), CommandObjectWatchpointDisable::DoExecute(), CommandObjectProcessAttach::DoExecute(), CommandObjectWatchpointDelete::DoExecute(), CommandObjectTargetList::DoExecute(), CommandObjectWatchpointCommandDelete::DoExecute(), CommandObjectTargetSelect::DoExecute(), CommandObjectCommandsAlias::DoExecute(), CommandObjectSettingsList::DoExecute(), CommandObjectSourceInfo::DoExecute(), CommandObjectObjC_ClassTable_Dump::DoExecute(), CommandObjectThreadStepWithTypeAndScope::DoExecute(), CommandObjectWatchpointIgnore::DoExecute(), CommandObjectWatchpointCommandList::DoExecute(), CommandObjectTargetDelete::DoExecute(), CommandObjectProcessContinue::DoExecute(), CommandObjectSettingsRemove::DoExecute(), CommandObjectTypeFormatAdd::DoExecute(), CommandObjectMultiwordObjC_TaggedPointer_Info::DoExecute(), CommandObjectProcessMinidumpDump::DoExecute(), CommandObjectWatchpointModify::DoExecute(), CommandObjectWatchpointSetVariable::DoExecute(), CommandObjectPlatformGetFile::DoExecute(), CommandObjectTypeFormatterDelete::DoExecute(), CommandObjectTargetVariable::DoExecute(), CommandObjectThreadContinue::DoExecute(), CommandObjectSettingsInsertBefore::DoExecute(), CommandObjectProcessConnect::DoExecute(), CommandObjectProcessKDPPacketSend::DoExecute(), CommandObjectPlatformGetSize::DoExecute(), CommandObjectFrameRecognizerDelete::DoExecute(), CommandObjectTypeFormatterClear::DoExecute(), CommandObjectSourceList::DoExecute(), CommandObjectSettingsInsertAfter::DoExecute(), CommandObjectPlatformProcessLaunch::DoExecute(), CommandObjectCommandsAddRegex::DoExecute(), CommandObjectMemoryFind::DoExecute(), CommandObjectFrameRecognizerInfo::DoExecute(), CommandObjectSettingsAppend::DoExecute(), CommandObjectTargetModulesSearchPathsAdd::DoExecute(), CommandObjectTypeFormatterList< TypeFilterImpl >::DoExecute(), CommandObjectPlatformProcessList::DoExecute(), CommandObjectProcessSignal::DoExecute(), CommandObjectThreadUntil::DoExecute(), CommandObjectSettingsClear::DoExecute(), CommandObjectProcessInterrupt::DoExecute(), CommandObjectTargetModulesSearchPathsInsert::DoExecute(), CommandObjectProcessKill::DoExecute(), CommandObjectTargetModulesSearchPathsList::DoExecute(), CommandObjectProcessSaveCore::DoExecute(), CommandObjectTargetModulesSearchPathsQuery::DoExecute(), CommandObjectMemoryWrite::DoExecute(), CommandObjectThreadSelect::DoExecute(), CommandObjectPlatformProcessInfo::DoExecute(), CommandObjectProcessHandle::DoExecute(), CommandObjectMemoryHistory::DoExecute(), CommandObjectCommandsScriptAdd::DoExecute(), CommandObjectMemoryRegion::DoExecute(), CommandObjectPlatformInstall::DoExecute(), CommandObjectCommandsScriptDelete::DoExecute(), CommandObjectBreakpointNameConfigure::DoExecute(), CommandObjectTargetModulesDumpObjfile::DoExecute(), CommandObjectThreadPlanDiscard::DoExecute(), CommandObjectTargetModulesDumpSymtab::DoExecute(), CommandObjectTargetModulesDumpSections::DoExecute(), CommandObjectTargetModulesDumpClangAST::DoExecute(), CommandObjectTargetModulesDumpSymfile::DoExecute(), CommandObjectTargetModulesDumpLineTable::DoExecute(), CommandObjectTargetModulesAdd::DoExecute(), CommandObjectTargetModulesLoad::DoExecute(), CommandObjectTargetModulesList::DoExecute(), CommandObjectTargetModulesLookup::DoExecute(), CommandObjectRenderScriptRuntimeReductionBreakpointSet::DoExecute(), CommandObjectTargetSymbolsAdd::DoExecute(), CommandObjectRenderScriptRuntimeKernelBreakpointSet::DoExecute(), CommandObjectRenderScriptRuntimeKernelBreakpointAll::DoExecute(), CommandObjectRenderScriptRuntimeAllocationDump::DoExecute(), CommandObjectRenderScriptRuntimeAllocationLoad::DoExecute(), CommandObjectTargetStopHookDelete::DoExecute(), CommandObjectRenderScriptRuntimeAllocationSave::DoExecute(), CommandObjectTargetStopHookEnableDisable::DoExecute(), CommandObjectProcessGDBRemoteSpeedTest::DoExecute(), CommandObjectProcessGDBRemotePacketHistory::DoExecute(), CommandObjectProcessGDBRemotePacketXferSize::DoExecute(), CommandObjectProcessGDBRemotePacketSend::DoExecute(), lldb_private::ProcessInstanceInfo::Dump(), lldb_private::ProcessInstanceInfo::DumpAsTableRow(), empty(), lldb_private::CommandObjectMultiword::Execute(), lldb_private::OptionValueArgs::GetArgs(), lldb_private::OptionValueDictionary::GetArgs(), lldb_private::OptionValueArray::GetArgs(), lldb_private::CommandInterpreter::GetCommandSPExact(), GetMacOSXProcessUserAndGroup(), lldb_private::CommandObjectMultiword::GetRepeatCommand(), CommandObjectCommandsAlias::HandleAliasingNormalCommand(), CommandObjectSettingsSet::HandleArgumentCompletion(), lldb_private::CommandObjectMultiword::HandleCompletion(), lldb_private::CommandInterpreter::HandleCompletion(), lldb_private::CommandInterpreter::HandleCompletionMatches(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerPlatform::LaunchProcess(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::LaunchProcess(), operator Environment(), 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().

◆ GetArgumentQuoteCharAtIndex()

char Args::GetArgumentQuoteCharAtIndex ( size_t  idx) const

Definition at line 262 of file Args.cpp.

Referenced by entries().

◆ 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 268 of file Args.cpp.

Referenced by CommandPluginInterfaceImplementation::DoExecute(), operator[](), and lldb_private::darwin_process_launcher::PosixSpawnChildForPTraceDebugging().

◆ 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 278 of file Args.cpp.

Referenced by ChildFunc(), lldb_private::ProcessLaunchInfo::ConvertArgumentsForLaunchingInShell(), ProcessFreeBSD::DoLaunch(), lldb_private::CommandObjectParsed::Execute(), lldb_private::darwin_process_launcher::LaunchInferior(), LaunchInNewTerminalWithAppleScript(), LaunchProcessPosixSpawn(), operator Environment(), operator[](), and ProcessVmReadvSupported().

◆ GetQuotedCommandString()

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

Definition at line 219 of file Args.cpp.

Referenced by operator Environment().

◆ GetShellSafeArgument()

const char * Args::GetShellSafeArgument ( const FileSpec shell,
const char *  unsafe_arg,
std::string &  safe_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_cstr.

Parameters
[in]idxThe index of where to insert the argument.
[in]arg_cstrThe new argument as a NULL terminated C string.
[in]quote_charIf the argument was originally quoted, put in the quote char here.
Returns
The NULL terminated C string of the copy of arg_cstr.

Definition at line 325 of file Args.cpp.

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

◆ operator Environment()

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

◆ operator=()

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

Definition at line 178 of file Args.cpp.

References Clear().

Referenced by lldb_private::Args::ArgEntry::IsQuoted().

◆ operator[]()

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

Definition at line 132 of file Args.h.

References GetArgumentVector(), and GetConstArgumentVector().

◆ ReplaceArgumentAtIndex()

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

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

Parameters
[in]idxThe index of the argument that will have its value replaced.
[in]arg_cstrThe new argument as a NULL terminated C string.
[in]quote_charIf the argument was originally quoted, put in the quote char here.

Definition at line 336 of file Args.cpp.

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

◆ SetArguments() [1/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 363 of file Args.cpp.

References Clear().

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

◆ SetArguments() [2/2]

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

Definition at line 380 of file Args.cpp.

References ArgvToArgc(), 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 238 of file Args.cpp.

References Clear(), ltrimForArgs(), and ParseSingleArgument().

Referenced by Args(), and operator Environment().

◆ Shift()

void Args::Shift ( )

◆ SInt64ValueIsValidForByteSize()

static bool lldb_private::Args::SInt64ValueIsValidForByteSize ( int64_t  sval64,
size_t  total_byte_size 
)
inlinestatic

◆ 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

◆ StripSpaces()

const char * Args::StripSpaces ( std::string &  s,
bool  leading = true,
bool  trailing = true,
bool  return_null_if_empty = true 
)
static

Definition at line 390 of file Args.cpp.

References k_white_space.

Referenced by GetArgumentArrayRef(), and lldb_private::REPL::IOHandlerInputComplete().

◆ UInt64ValueIsValidForByteSize()

static bool lldb_private::Args::UInt64ValueIsValidForByteSize ( uint64_t  uval64,
size_t  total_byte_size 
)
inlinestatic

Definition at line 262 of file Args.h.

◆ Unshift()

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

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

A copy arg_cstr will be made.

Parameters
[in]arg_cstrThe 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 292 of file Args.cpp.

References InsertArgumentAtIndex().

Referenced by lldb_private::CommandInterpreter::BuildAliasCommandArgs(), lldb_private::CommandInterpreter::BuildAliasResult(), and GetArgumentArrayRef().


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