Revert "ProcessInstanceInfoMatch: Don't match processes with no name if a name match was requested"

This breaks TestProcessAttach and TestHelloWorld on Darwin.

llvm-svn: 374008
This commit is contained in:
Jonas Devlieghere 2019-10-08 01:16:59 +00:00
parent 68491f5072
commit e21399b02e
2 changed files with 1 additions and 18 deletions

View File

@ -244,7 +244,7 @@ void ProcessInstanceInfo::DumpAsTableRow(Stream &s, UserIDResolver &resolver,
}
bool ProcessInstanceInfoMatch::NameMatches(const char *process_name) const {
if (m_name_match_type == NameMatch::Ignore)
if (m_name_match_type == NameMatch::Ignore || process_name == nullptr)
return true;
const char *match_name = m_match_info.GetName();
if (!match_name)

View File

@ -91,20 +91,3 @@ TEST(ProcessInstanceInfo, DumpTable_invalidUID) {
)",
s.GetData());
}
TEST(ProcessInstanceInfoMatch, Name) {
ProcessInstanceInfo info_bar, info_empty;
info_bar.GetExecutableFile().SetFile("/foo/bar", FileSpec::Style::posix);
ProcessInstanceInfoMatch match;
match.SetNameMatchType(NameMatch::Equals);
match.GetProcessInfo().GetExecutableFile().SetFile("bar",
FileSpec::Style::posix);
EXPECT_TRUE(match.Matches(info_bar));
EXPECT_FALSE(match.Matches(info_empty));
match.GetProcessInfo().GetExecutableFile() = FileSpec();
EXPECT_TRUE(match.Matches(info_bar));
EXPECT_TRUE(match.Matches(info_empty));
}