[Lldb-commits] [lldb] r374008 - Revert "ProcessInstanceInfoMatch: Don't match processes with no name if a name match was requested"

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Mon Oct 7 18:17:00 PDT 2019


Author: jdevlieghere
Date: Mon Oct  7 18:16:59 2019
New Revision: 374008

URL: http://llvm.org/viewvc/llvm-project?rev=374008&view=rev
Log:
Revert "ProcessInstanceInfoMatch: Don't match processes with no name if a name match was requested"

This breaks TestProcessAttach and TestHelloWorld on Darwin.

Modified:
    lldb/trunk/source/Utility/ProcessInfo.cpp
    lldb/trunk/unittests/Utility/ProcessInstanceInfoTest.cpp

Modified: lldb/trunk/source/Utility/ProcessInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/ProcessInfo.cpp?rev=374008&r1=374007&r2=374008&view=diff
==============================================================================
--- lldb/trunk/source/Utility/ProcessInfo.cpp (original)
+++ lldb/trunk/source/Utility/ProcessInfo.cpp Mon Oct  7 18:16:59 2019
@@ -244,7 +244,7 @@ void ProcessInstanceInfo::DumpAsTableRow
 }
 
 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)

Modified: lldb/trunk/unittests/Utility/ProcessInstanceInfoTest.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Utility/ProcessInstanceInfoTest.cpp?rev=374008&r1=374007&r2=374008&view=diff
==============================================================================
--- lldb/trunk/unittests/Utility/ProcessInstanceInfoTest.cpp (original)
+++ lldb/trunk/unittests/Utility/ProcessInstanceInfoTest.cpp Mon Oct  7 18:16:59 2019
@@ -91,20 +91,3 @@ TEST(ProcessInstanceInfo, DumpTable_inva
 )",
       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));
-}




More information about the lldb-commits mailing list