summaryrefslogtreecommitdiffstats
path: root/lldb/source/Utility
diff options
context:
space:
mode:
authorPavel Labath <pavel@labath.sk>2019-10-11 10:56:54 +0000
committerPavel Labath <pavel@labath.sk>2019-10-11 10:56:54 +0000
commita8b18baa0f9e49bb5c957e28027f5c5adae28cda (patch)
tree959e1e5d184ce1c9b2b19570e30c2ec050556adc /lldb/source/Utility
parent30c2441a3262228990b5317eb3bc2b24ff06d316 (diff)
downloadbcm5719-llvm-a8b18baa0f9e49bb5c957e28027f5c5adae28cda.tar.gz
bcm5719-llvm-a8b18baa0f9e49bb5c957e28027f5c5adae28cda.zip
ProcessInstanceInfoMatch: Don't match processes with no name if a name match was requested, take 2
Summary: The previous attempt at making nameless process not match when searching for a given name failed because the macos implementation was depending on this detail in its partial matching strategy. Doing partial matching to avoid expensive lookups is a perfectly valid thing to do, the way it was implemented seems somewhat unexpected. This patch implements it differently by providing special methods in the ProcessInstanceInfoMatch which match only a subset of fields, and changes mac host code to use those instead. Then, it re-applies r373925 to get make the ProcessInstanceInfoMatch with a name *not* match a nameless process. Reviewers: JDevlieghere, teemperor, jingham Subscribers: wallace, lldb-commits Differential Revision: https://reviews.llvm.org/D68631 llvm-svn: 374529
Diffstat (limited to 'lldb/source/Utility')
-rw-r--r--lldb/source/Utility/ProcessInfo.cpp28
1 files changed, 18 insertions, 10 deletions
diff --git a/lldb/source/Utility/ProcessInfo.cpp b/lldb/source/Utility/ProcessInfo.cpp
index 832e5efae29..fa418f333be 100644
--- a/lldb/source/Utility/ProcessInfo.cpp
+++ b/lldb/source/Utility/ProcessInfo.cpp
@@ -243,8 +243,14 @@ void ProcessInstanceInfo::DumpAsTableRow(Stream &s, UserIDResolver &resolver,
}
}
+bool ProcessInstanceInfoMatch::ArchitectureMatches(
+ const ArchSpec &arch_spec) const {
+ return !m_match_info.GetArchitecture().IsValid() ||
+ m_match_info.GetArchitecture().IsCompatibleMatch(arch_spec);
+}
+
bool ProcessInstanceInfoMatch::NameMatches(const char *process_name) const {
- if (m_name_match_type == NameMatch::Ignore || process_name == nullptr)
+ if (m_name_match_type == NameMatch::Ignore)
return true;
const char *match_name = m_match_info.GetName();
if (!match_name)
@@ -253,11 +259,8 @@ bool ProcessInstanceInfoMatch::NameMatches(const char *process_name) const {
return lldb_private::NameMatches(process_name, m_name_match_type, match_name);
}
-bool ProcessInstanceInfoMatch::Matches(
+bool ProcessInstanceInfoMatch::ProcessIDsMatch(
const ProcessInstanceInfo &proc_info) const {
- if (!NameMatches(proc_info.GetName()))
- return false;
-
if (m_match_info.ProcessIDIsValid() &&
m_match_info.GetProcessID() != proc_info.GetProcessID())
return false;
@@ -265,7 +268,11 @@ bool ProcessInstanceInfoMatch::Matches(
if (m_match_info.ParentProcessIDIsValid() &&
m_match_info.GetParentProcessID() != proc_info.GetParentProcessID())
return false;
+ return true;
+}
+bool ProcessInstanceInfoMatch::UserIDsMatch(
+ const ProcessInstanceInfo &proc_info) const {
if (m_match_info.UserIDIsValid() &&
m_match_info.GetUserID() != proc_info.GetUserID())
return false;
@@ -281,13 +288,14 @@ bool ProcessInstanceInfoMatch::Matches(
if (m_match_info.EffectiveGroupIDIsValid() &&
m_match_info.GetEffectiveGroupID() != proc_info.GetEffectiveGroupID())
return false;
-
- if (m_match_info.GetArchitecture().IsValid() &&
- !m_match_info.GetArchitecture().IsCompatibleMatch(
- proc_info.GetArchitecture()))
- return false;
return true;
}
+bool ProcessInstanceInfoMatch::Matches(
+ const ProcessInstanceInfo &proc_info) const {
+ return ArchitectureMatches(proc_info.GetArchitecture()) &&
+ ProcessIDsMatch(proc_info) && UserIDsMatch(proc_info) &&
+ NameMatches(proc_info.GetName());
+}
bool ProcessInstanceInfoMatch::MatchAllProcesses() const {
if (m_name_match_type != NameMatch::Ignore)
OpenPOWER on IntegriCloud