16#include "llvm/ADT/SmallString.h"
25 : m_executable(), m_arguments(), m_environment(), m_arch(), m_listener_sp(),
26 m_hijack_listener_sp(), m_shadow_listener_sp() {}
30 : m_executable(name), m_arguments(), m_environment(), m_arch(arch),
31 m_pid(pid), m_listener_sp(), m_hijack_listener_sp(),
32 m_shadow_listener_sp() {}
54 s <<
"Executable: " <<
GetName() <<
"\n";
66 bool add_exe_file_as_first_arg) {
69 if (add_exe_file_as_first_arg) {
70 llvm::SmallString<128> filename;
72 if (!filename.empty())
85 bool first_arg_is_executable) {
89 if (first_arg_is_executable) {
105 if (first_arg_is_executable) {
135 for (uint32_t i = 0; i < argc; i++) {
138 s.
Printf(
" arg[%u] = %s\n", i, arg);
140 s.
Printf(
"arg[%u] = %s\n", i, arg);
173 if (show_args || verbose)
179 s.
Printf(
"PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE "
183 "====== ====== ========== ========== ========== ========== "
184 "============================== ============================\n");
186 s.
Printf(
"PID PARENT USER TRIPLE %s\n",
188 s.
PutCString(
"====== ====== ========== ============================== "
189 "============================\n");
194 bool show_args,
bool verbose)
const {
207 const char *format =
"{0,-10} ";
208 if (!(this->*isValid)()) {
212 uint32_t
id = (this->*getID)();
213 if (
auto name = (resolver.*getName)(
id))
238 if (verbose || show_args) {
241 for (uint32_t i = 0; i < argc; i++) {
An architecture specification class.
bool IsValid() const
Tests if this ArchSpec is valid.
void Clear()
Clears the object state.
void DumpTriple(llvm::raw_ostream &s) const
bool IsCompatibleMatch(const ArchSpec &rhs) const
Shorthand for IsMatch(rhs, CompatibleMatch).
A command line argument class.
void Dump(Stream &s, const char *label_name="argv") const
Dump all entries to the stream s using label label_name.
void SetArguments(size_t argc, const char **argv)
Sets the argument vector value, optionally copying all arguments into an internal buffer.
size_t GetArgumentCount() const
Gets the number of arguments left in this command object.
const char * GetArgumentAtIndex(size_t idx) const
Gets the NULL terminated C string argument pointer for the argument at index idx.
void InsertArgumentAtIndex(size_t idx, llvm::StringRef arg_str, char quote_char='\0')
Insert the argument value at index idx to arg_str.
void Clear()
Clear the arguments.
llvm::StringRef GetStringRef() const
Get the string value as a llvm::StringRef.
const char * GetCString() const
Get the string value as a C string.
void SetFile(llvm::StringRef path, Style style)
Change the file specified with a new path.
const ConstString & GetFilename() const
Filename string const get accessor.
size_t GetPath(char *path, size_t max_path_length, bool denormalize=true) const
Extract the full path to the file.
void Clear()
Clears the object state.
void Dump(llvm::raw_ostream &s) const
Dump this object to a Stream.
void SetExecutableFile(const FileSpec &exe_file, bool add_exe_file_as_first_arg)
Environment m_environment
lldb::ScriptedMetadataSP m_scripted_metadata_sp
bool ProcessIDIsValid() const
void SetArg0(llvm::StringRef arg)
const char * GetName() const
void Dump(Stream &s, Platform *platform) const
lldb::pid_t GetProcessID() const
llvm::StringRef GetArg0() const
void SetArguments(const Args &args, bool first_arg_is_executable)
bool UserIDIsValid() const
uint32_t GetUserID() const
llvm::StringRef GetNameAsStringRef() const
uint32_t GetGroupID() const
bool IsScriptedProcess() const
bool GroupIDIsValid() const
ArchSpec & GetArchitecture()
bool MatchAllProcesses() const
bool NameMatches(const char *process_name) const
Return true iff the process name in this object matches process_name.
NameMatch m_name_match_type
bool Matches(const ProcessInstanceInfo &proc_info) const
bool ProcessIDsMatch(const ProcessInstanceInfo &proc_info) const
Return true iff the process ID and parent process IDs in this object match the ones in proc_info.
ProcessInstanceInfo m_match_info
bool UserIDsMatch(const ProcessInstanceInfo &proc_info) const
Return true iff the (both effective and real) user and group IDs in this object match the ones in pro...
bool ArchitectureMatches(const ArchSpec &arch_spec) const
Return true iff the architecture in this object matches arch_spec.
uint32_t GetEffectiveUserID() const
static void DumpTableHeader(Stream &s, bool show_args, bool verbose)
lldb::pid_t GetParentProcessID() const
bool ParentProcessIDIsValid() const
uint32_t GetEffectiveGroupID() const
bool EffectiveUserIDIsValid() const
bool EffectiveGroupIDIsValid() const
void Dump(Stream &s, UserIDResolver &resolver) const
void DumpAsTableRow(Stream &s, UserIDResolver &resolver, bool show_args, bool verbose) const
const char * GetData() const
A stream class that can stream formatted output to a file.
void Format(const char *format, Args &&... args)
llvm::raw_ostream & AsRawOstream()
Returns a raw_ostream that forwards the data to this Stream object.
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
size_t EOL()
Output and End of Line character to the stream.
An abstract interface for things that know how to map numeric user/group IDs into names.
std::optional< llvm::StringRef > GetGroupName(id_t gid)
std::optional< llvm::StringRef > GetUserName(id_t uid)
#define LLDB_INVALID_PROCESS_ID
A class that represents a running process on the host machine.
bool NameMatches(llvm::StringRef name, NameMatch match_type, llvm::StringRef match)