[Lldb-commits] [lldb] bd323e4 - Revert "[lldb][bindings] Fix module_access handling of regex"

Stella Stamenova via lldb-commits lldb-commits at lists.llvm.org
Tue Sep 6 08:58:18 PDT 2022


Author: Stella Stamenova
Date: 2022-09-06T08:57:28-07:00
New Revision: bd323e42c84476f26bd2f8447f0b0f0dfc204bcb

URL: https://github.com/llvm/llvm-project/commit/bd323e42c84476f26bd2f8447f0b0f0dfc204bcb
DIFF: https://github.com/llvm/llvm-project/commit/bd323e42c84476f26bd2f8447f0b0f0dfc204bcb.diff

LOG: Revert "[lldb][bindings] Fix module_access handling of regex"

This reverts commit 75f05fccbbdd91393bdc7b6183b9dd2b1e859f8e.

This commit broke the windows lldb bot: https://lab.llvm.org/buildbot/#/builders/83/builds/23284

Added: 
    

Modified: 
    lldb/bindings/interface/SBTarget.i
    lldb/test/API/python_api/target/TestTargetAPI.py

Removed: 
    


################################################################################
diff  --git a/lldb/bindings/interface/SBTarget.i b/lldb/bindings/interface/SBTarget.i
index 7eee99e54848d..a6a764944d02e 100644
--- a/lldb/bindings/interface/SBTarget.i
+++ b/lldb/bindings/interface/SBTarget.i
@@ -1000,10 +1000,10 @@ public:
 
             def __getitem__(self, key):
                 num_modules = self.sbtarget.GetNumModules()
-                if isinstance(key, int):
+                if type(key) is int:
                     if key < num_modules:
                         return self.sbtarget.GetModuleAtIndex(key)
-                elif isinstance(key, str):
+                elif type(key) is str:
                     if key.find('/') == -1:
                         for idx in range(num_modules):
                             module = self.sbtarget.GetModuleAtIndex(idx)
@@ -1024,16 +1024,16 @@ public:
                                     return module
                     except:
                         return None
-                elif isinstance(key, uuid.UUID):
+                elif type(key) is uuid.UUID:
                     for idx in range(num_modules):
                         module = self.sbtarget.GetModuleAtIndex(idx)
                         if module.uuid == key:
                             return module
-                elif isinstance(key, re.Pattern):
+                elif type(key) is re.SRE_Pattern:
                     matching_modules = []
                     for idx in range(num_modules):
                         module = self.sbtarget.GetModuleAtIndex(idx)
-                        re_match = key.search(module.file.fullpath)
+                        re_match = key.search(module.path.fullpath)
                         if re_match:
                             matching_modules.append(module)
                     return matching_modules

diff  --git a/lldb/test/API/python_api/target/TestTargetAPI.py b/lldb/test/API/python_api/target/TestTargetAPI.py
index e575f30508e09..0b2514416bede 100644
--- a/lldb/test/API/python_api/target/TestTargetAPI.py
+++ b/lldb/test/API/python_api/target/TestTargetAPI.py
@@ -2,7 +2,6 @@
 Test SBTarget APIs.
 """
 
-import re
 import unittest2
 import os
 import lldb
@@ -517,14 +516,3 @@ def test_is_loaded(self):
             module = target.GetModuleAtIndex(i)
             self.assertTrue(target.IsLoaded(module), "Running the target should "
                             "have loaded its modules.")
-
-    def test_module_subscript_regex(self):
-        """Exercise SBTarget.module subscripting with regex."""
-        self.build()
-        exe = self.getBuildArtifact("a.out")
-        target = self.dbg.CreateTarget(exe)
-        self.assertTrue(target, VALID_TARGET)
-        modules = target.module[re.compile(r"/a[.]out$")]
-        self.assertEqual(len(modules), 1)
-        exe_mod = modules[0]
-        self.assertEqual(exe_mod.file.fullpath, exe)


        


More information about the lldb-commits mailing list