003 File Manager
Current Path:
/usr/src/contrib/llvm-project/lldb/include/lldb/Utility
usr
/
src
/
contrib
/
llvm-project
/
lldb
/
include
/
lldb
/
Utility
/
📁
..
📄
AnsiTerminal.h
(4.97 KB)
📄
ArchSpec.h
(17.08 KB)
📄
Args.h
(13.72 KB)
📄
Baton.h
(2.25 KB)
📄
Broadcaster.h
(17.55 KB)
📄
CompletionRequest.h
(9.23 KB)
📄
Connection.h
(6.42 KB)
📄
ConstString.h
(17.92 KB)
📄
DataBuffer.h
(3.39 KB)
📄
DataBufferHeap.h
(3.65 KB)
📄
DataBufferLLVM.h
(1.17 KB)
📄
DataEncoder.h
(8.45 KB)
📄
DataExtractor.h
(39.18 KB)
📄
Endian.h
(865 B)
📄
Environment.h
(2.68 KB)
📄
Event.h
(6.64 KB)
📄
FileSpec.h
(15.41 KB)
📄
Flags.h
(3.39 KB)
📄
GDBRemote.h
(4.15 KB)
📄
IOObject.h
(1.38 KB)
📄
Iterable.h
(5.5 KB)
📄
LLDBAssert.h
(911 B)
📄
Listener.h
(5.2 KB)
📄
Log.h
(10.51 KB)
📄
Logging.h
(2.27 KB)
📄
NameMatches.h
(716 B)
📄
Predicate.h
(8.08 KB)
📄
ProcessInfo.h
(7.92 KB)
📄
RangeMap.h
(23.05 KB)
📄
RegisterValue.h
(7.08 KB)
📄
RegularExpression.h
(3.2 KB)
📄
Reproducer.h
(13.25 KB)
📄
ReproducerInstrumentation.h
(39.38 KB)
📄
Scalar.h
(11.27 KB)
📄
SelectHelper.h
(2.53 KB)
📄
SharedCluster.h
(1.69 KB)
📄
State.h
(2.54 KB)
📄
Status.h
(7.31 KB)
📄
Stream.h
(14.34 KB)
📄
StreamCallback.h
(978 B)
📄
StreamString.h
(1.23 KB)
📄
StreamTee.h
(4.52 KB)
📄
StringExtractor.h
(3.13 KB)
📄
StringExtractorGDBRemote.h
(6.12 KB)
📄
StringLexer.h
(1.31 KB)
📄
StringList.h
(3.47 KB)
📄
StructuredData.h
(15.49 KB)
📄
TildeExpressionResolver.h
(2.42 KB)
📄
Timeout.h
(2.45 KB)
📄
Timer.h
(1.87 KB)
📄
TraceOptions.h
(1.79 KB)
📄
UUID.h
(3.74 KB)
📄
UriParser.h
(1.01 KB)
📄
UserID.h
(2.8 KB)
📄
UserIDResolver.h
(1.8 KB)
📄
VASPrintf.h
(636 B)
📄
VMRange.h
(3.06 KB)
📄
XcodeSDK.h
(2.85 KB)
Editing: ProcessInfo.h
//===-- ProcessInfo.h -------------------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #ifndef LLDB_UTILITY_PROCESSINFO_H #define LLDB_UTILITY_PROCESSINFO_H #include "lldb/Utility/ArchSpec.h" #include "lldb/Utility/Args.h" #include "lldb/Utility/Environment.h" #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/NameMatches.h" #include "lldb/Utility/Reproducer.h" #include "llvm/Support/YAMLTraits.h" #include <vector> namespace lldb_private { class UserIDResolver; // ProcessInfo // // A base class for information for a process. This can be used to fill // out information for a process prior to launching it, or it can be used for // an instance of a process and can be filled in with the existing values for // that process. class ProcessInfo { public: ProcessInfo(); ProcessInfo(const char *name, const ArchSpec &arch, lldb::pid_t pid); void Clear(); const char *GetName() const; llvm::StringRef GetNameAsStringRef() const; FileSpec &GetExecutableFile() { return m_executable; } void SetExecutableFile(const FileSpec &exe_file, bool add_exe_file_as_first_arg); const FileSpec &GetExecutableFile() const { return m_executable; } uint32_t GetUserID() const { return m_uid; } uint32_t GetGroupID() const { return m_gid; } bool UserIDIsValid() const { return m_uid != UINT32_MAX; } bool GroupIDIsValid() const { return m_gid != UINT32_MAX; } void SetUserID(uint32_t uid) { m_uid = uid; } void SetGroupID(uint32_t gid) { m_gid = gid; } ArchSpec &GetArchitecture() { return m_arch; } const ArchSpec &GetArchitecture() const { return m_arch; } void SetArchitecture(const ArchSpec &arch) { m_arch = arch; } lldb::pid_t GetProcessID() const { return m_pid; } void SetProcessID(lldb::pid_t pid) { m_pid = pid; } bool ProcessIDIsValid() const { return m_pid != LLDB_INVALID_PROCESS_ID; } void Dump(Stream &s, Platform *platform) const; Args &GetArguments() { return m_arguments; } const Args &GetArguments() const { return m_arguments; } llvm::StringRef GetArg0() const; void SetArg0(llvm::StringRef arg); void SetArguments(const Args &args, bool first_arg_is_executable); void SetArguments(char const **argv, bool first_arg_is_executable); Environment &GetEnvironment() { return m_environment; } const Environment &GetEnvironment() const { return m_environment; } protected: template <class T> friend struct llvm::yaml::MappingTraits; FileSpec m_executable; std::string m_arg0; // argv[0] if supported. If empty, then use m_executable. // Not all process plug-ins support specifying an argv[0] that differs from // the resolved platform executable (which is in m_executable) Args m_arguments; // All program arguments except argv[0] Environment m_environment; uint32_t m_uid; uint32_t m_gid; ArchSpec m_arch; lldb::pid_t m_pid; }; // ProcessInstanceInfo // // Describes an existing process and any discoverable information that pertains // to that process. class ProcessInstanceInfo : public ProcessInfo { public: ProcessInstanceInfo() : ProcessInfo(), m_euid(UINT32_MAX), m_egid(UINT32_MAX), m_parent_pid(LLDB_INVALID_PROCESS_ID) {} ProcessInstanceInfo(const char *name, const ArchSpec &arch, lldb::pid_t pid) : ProcessInfo(name, arch, pid), m_euid(UINT32_MAX), m_egid(UINT32_MAX), m_parent_pid(LLDB_INVALID_PROCESS_ID) {} void Clear() { ProcessInfo::Clear(); m_euid = UINT32_MAX; m_egid = UINT32_MAX; m_parent_pid = LLDB_INVALID_PROCESS_ID; } uint32_t GetEffectiveUserID() const { return m_euid; } uint32_t GetEffectiveGroupID() const { return m_egid; } bool EffectiveUserIDIsValid() const { return m_euid != UINT32_MAX; } bool EffectiveGroupIDIsValid() const { return m_egid != UINT32_MAX; } void SetEffectiveUserID(uint32_t uid) { m_euid = uid; } void SetEffectiveGroupID(uint32_t gid) { m_egid = gid; } lldb::pid_t GetParentProcessID() const { return m_parent_pid; } void SetParentProcessID(lldb::pid_t pid) { m_parent_pid = pid; } bool ParentProcessIDIsValid() const { return m_parent_pid != LLDB_INVALID_PROCESS_ID; } void Dump(Stream &s, UserIDResolver &resolver) const; static void DumpTableHeader(Stream &s, bool show_args, bool verbose); void DumpAsTableRow(Stream &s, UserIDResolver &resolver, bool show_args, bool verbose) const; protected: friend struct llvm::yaml::MappingTraits<ProcessInstanceInfo>; uint32_t m_euid; uint32_t m_egid; lldb::pid_t m_parent_pid; }; typedef std::vector<ProcessInstanceInfo> ProcessInstanceInfoList; // ProcessInstanceInfoMatch // // A class to help matching one ProcessInstanceInfo to another. class ProcessInstanceInfoMatch { public: ProcessInstanceInfoMatch() : m_match_info(), m_name_match_type(NameMatch::Ignore), m_match_all_users(false) {} ProcessInstanceInfoMatch(const char *process_name, NameMatch process_name_match_type) : m_match_info(), m_name_match_type(process_name_match_type), m_match_all_users(false) { m_match_info.GetExecutableFile().SetFile(process_name, FileSpec::Style::native); } ProcessInstanceInfo &GetProcessInfo() { return m_match_info; } const ProcessInstanceInfo &GetProcessInfo() const { return m_match_info; } bool GetMatchAllUsers() const { return m_match_all_users; } void SetMatchAllUsers(bool b) { m_match_all_users = b; } NameMatch GetNameMatchType() const { return m_name_match_type; } void SetNameMatchType(NameMatch name_match_type) { m_name_match_type = name_match_type; } /// Return true iff the architecture in this object matches arch_spec. bool ArchitectureMatches(const ArchSpec &arch_spec) const; /// Return true iff the process name in this object matches process_name. bool NameMatches(const char *process_name) const; /// Return true iff the process ID and parent process IDs in this object match /// the ones in proc_info. bool ProcessIDsMatch(const ProcessInstanceInfo &proc_info) const; /// Return true iff the (both effective and real) user and group IDs in this /// object match the ones in proc_info. bool UserIDsMatch(const ProcessInstanceInfo &proc_info) const; bool Matches(const ProcessInstanceInfo &proc_info) const; bool MatchAllProcesses() const; void Clear(); protected: ProcessInstanceInfo m_match_info; NameMatch m_name_match_type; bool m_match_all_users; }; namespace repro { class ProcessInfoRecorder : public AbstractRecorder { public: ProcessInfoRecorder(const FileSpec &filename, std::error_code &ec) : AbstractRecorder(filename, ec) {} static llvm::Expected<std::unique_ptr<ProcessInfoRecorder>> Create(const FileSpec &filename); void Record(const ProcessInstanceInfoList &process_infos); }; class ProcessInfoProvider : public repro::Provider<ProcessInfoProvider> { public: struct Info { static const char *name; static const char *file; }; ProcessInfoProvider(const FileSpec &directory) : Provider(directory) {} ProcessInfoRecorder *GetNewProcessInfoRecorder(); void Keep() override; void Discard() override; static char ID; private: std::unique_ptr<llvm::raw_fd_ostream> m_stream_up; std::vector<std::unique_ptr<ProcessInfoRecorder>> m_process_info_recorders; }; llvm::Optional<ProcessInstanceInfoList> GetReplayProcessInstanceInfoList(); } // namespace repro } // namespace lldb_private LLVM_YAML_IS_SEQUENCE_VECTOR(lldb_private::ProcessInstanceInfo) namespace llvm { namespace yaml { template <> struct MappingTraits<lldb_private::ProcessInstanceInfo> { static void mapping(IO &io, lldb_private::ProcessInstanceInfo &PII); }; } // namespace yaml } // namespace llvm #endif // LLDB_UTILITY_PROCESSINFO_H
Upload File
Create Folder