Title: [270904] trunk/Tools
Revision
270904
Author
[email protected]
Date
2020-12-16 12:51:22 -0800 (Wed, 16 Dec 2020)

Log Message

Use python3 in Tools/Scripts/dump-class-layout
https://bugs.webkit.org/show_bug.cgi?id=219945

Reviewed by Simon Fraser.

Newer LLDB python module only contains python3 version. So Tools/Scripts/dump-class-layout does not work.
This patch makes Tools/Scripts/dump-class-layout working with python3.

* Scripts/dump-class-layout:
(webkit_build_dir): Deleted.
(main): Deleted.
(main.or): Deleted.
* lldb/lldb_dump_class_layout.py:
(ClassLayoutBase.dump):
(LLDBDebuggerInstance.__init__):
(LLDBDebuggerInstance._get_first_file_architecture):
(LLDBDebuggerInstance.layout_for_classname):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (270903 => 270904)


--- trunk/Tools/ChangeLog	2020-12-16 20:42:28 UTC (rev 270903)
+++ trunk/Tools/ChangeLog	2020-12-16 20:51:22 UTC (rev 270904)
@@ -1,3 +1,23 @@
+2020-12-16  Yusuke Suzuki  <[email protected]>
+
+        Use python3 in Tools/Scripts/dump-class-layout
+        https://bugs.webkit.org/show_bug.cgi?id=219945
+
+        Reviewed by Simon Fraser.
+
+        Newer LLDB python module only contains python3 version. So Tools/Scripts/dump-class-layout does not work.
+        This patch makes Tools/Scripts/dump-class-layout working with python3.
+
+        * Scripts/dump-class-layout:
+        (webkit_build_dir): Deleted.
+        (main): Deleted.
+        (main.or): Deleted.
+        * lldb/lldb_dump_class_layout.py:
+        (ClassLayoutBase.dump):
+        (LLDBDebuggerInstance.__init__):
+        (LLDBDebuggerInstance._get_first_file_architecture):
+        (LLDBDebuggerInstance.layout_for_classname):
+
 2020-12-16  Jonathan Bedard  <[email protected]>
 
         [webkitscmpy] Include remote directories when packaging

Modified: trunk/Tools/Scripts/dump-class-layout (270903 => 270904)


--- trunk/Tools/Scripts/dump-class-layout	2020-12-16 20:42:28 UTC (rev 270903)
+++ trunk/Tools/Scripts/dump-class-layout	2020-12-16 20:51:22 UTC (rev 270904)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 # Copyright (C) 2011-2015 Apple Inc. All rights reserved.
 #
@@ -29,7 +29,6 @@
 import argparse
 import os
 import subprocess
-from sets import Set
 
 up = os.path.dirname
 tools_directory = up(up(os.path.abspath(__file__)))

Modified: trunk/Tools/lldb/lldb_dump_class_layout.py (270903 => 270904)


--- trunk/Tools/lldb/lldb_dump_class_layout.py	2020-12-16 20:42:28 UTC (rev 270903)
+++ trunk/Tools/lldb/lldb_dump_class_layout.py	2020-12-16 20:51:22 UTC (rev 270904)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 # -*- coding: utf-8 -*-
 #
 # Copyright (C) 2018 Apple Inc. All rights reserved.
@@ -131,7 +131,7 @@
         return '\n'.join(self.as_string_list(colorize))
 
     def dump(self, colorize=True):
-        print self.as_string(colorize)
+        print(self.as_string(colorize))
 
 
 class ClassLayout(ClassLayoutBase):
@@ -387,11 +387,11 @@
 
         self.target = self.debugger.CreateTargetWithFileAndArch(str(self.binary_path), architecture)
         if not self.target:
-            print "Failed to make target for " + self.binary_path
+            print("Failed to make target for " + self.binary_path)
 
         self.module = self.target.GetModuleAtIndex(0)
         if not self.module:
-            print "Failed to get first module in " + self.binary_path
+            print("Failed to get first module in " + self.binary_path)
 
     def __del__(self):
         if lldb:
@@ -399,7 +399,7 @@
 
     def _get_first_file_architecture(self):
         p = re.compile('shared library +(\w+)$')
-        file_result = subprocess.check_output(["file", self.binary_path]).split('\n')
+        file_result = subprocess.check_output(["file", self.binary_path], encoding='UTF-8').split('\n')
         arches = []
         for line in file_result:
             match = p.search(line)
@@ -417,5 +417,5 @@
             # There can be more that one type with a given name, but for now just return the first one.
             return ClassLayout(self.target, types.GetTypeAtIndex(0))
 
-        print 'error: no type matches "%s" in "%s"' % (classname, self.module.file)
+        print('error: no type matches "%s" in "%s"' % (classname, self.module.file))
         return None
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to