Title: [294171] trunk/Tools
Revision
294171
Author
[email protected]
Date
2022-05-13 14:12:31 -0700 (Fri, 13 May 2022)

Log Message

Use None for architecture when dump-class-layout does not have `-a` option
https://bugs.webkit.org/show_bug.cgi?id=240395

Reviewed by Saam Barati and Simon Fraser.

We can pass None to architecture, then SBDebugger::CreateTargetWithFileAndArch
will call CreateTarget with nullptr architecture string. Then, TargetList constructs
ArchSpec based on currently selected platform automatically and it covers most of cases.
I tried it, and it worked with watchOS, macOS, iOS so far.
So, we should just pass None to CreateTargetWithFileAndArch by default.

* Tools/lldb/lldb_dump_class_layout.py:
(LLDBDebuggerInstance.__init__):
(LLDBDebuggerInstance.__del__):
(LLDBDebuggerInstance._get_first_file_architecture): Deleted.

Canonical link: https://commits.webkit.org/250539@main

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (294170 => 294171)


--- trunk/Tools/ChangeLog	2022-05-13 19:38:21 UTC (rev 294170)
+++ trunk/Tools/ChangeLog	2022-05-13 21:12:31 UTC (rev 294171)
@@ -1,3 +1,21 @@
+2022-05-13  Yusuke Suzuki  <[email protected]>
+
+        Use None for architecture when dump-class-layout does not have `-a` option
+        https://bugs.webkit.org/show_bug.cgi?id=240395
+
+        Reviewed by Saam Barati and Simon Fraser.
+
+        We can pass None to architecture, then SBDebugger::CreateTargetWithFileAndArch
+        will call CreateTarget with nullptr architecture string. Then, TargetList constructs
+        ArchSpec based on currently selected platform automatically and it covers most of cases.
+        I tried it, and it worked with watchOS, macOS, iOS so far.
+        So, we should just pass None to CreateTargetWithFileAndArch by default.
+
+        * lldb/lldb_dump_class_layout.py:
+        (LLDBDebuggerInstance.__init__):
+        (LLDBDebuggerInstance.__del__):
+        (LLDBDebuggerInstance._get_first_file_architecture): Deleted.
+
 2022-05-13  Commit Queue  <[email protected]>
 
         Unreviewed, reverting r294113.

Modified: trunk/Tools/lldb/lldb_dump_class_layout.py (294170 => 294171)


--- trunk/Tools/lldb/lldb_dump_class_layout.py	2022-05-13 19:38:21 UTC (rev 294170)
+++ trunk/Tools/lldb/lldb_dump_class_layout.py	2022-05-13 21:12:31 UTC (rev 294171)
@@ -381,11 +381,7 @@
 
         self.debugger = lldb.SBDebugger.Create()
         self.debugger.SetAsync(False)
-        architecture = self.architecture
-        if not architecture:
-            architecture = self._get_first_file_architecture()
-
-        self.target = self.debugger.CreateTargetWithFileAndArch(str(self.binary_path), architecture)
+        self.target = self.debugger.CreateTargetWithFileAndArch(str(self.binary_path), self.architecture)
         if not self.target:
             print("Failed to make target for " + self.binary_path)
 
@@ -397,20 +393,6 @@
         if lldb:
             lldb.SBDebugger.Destroy(self.debugger)
 
-    def _get_first_file_architecture(self):
-        p = re.compile(r'shared library +(\w+)$')
-        file_result = subprocess.check_output(["file", self.binary_path], encoding='UTF-8').split('\n')
-        arches = []
-        for line in file_result:
-            match = p.search(line)
-            if match:
-                arches.append(match.group(1))
-
-        if len(arches) > 0:
-            return arches[0]
-
-        return lldb.LLDB_ARCH_DEFAULT
-
     def layout_for_classname(self, classname):
         types = self.module.FindTypes(classname)
         if types.GetSize():
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to