Title: [206441] trunk/Tools
Revision
206441
Author
[email protected]
Date
2016-09-27 10:18:55 -0700 (Tue, 27 Sep 2016)

Log Message

Cannot run dump-class-layout; dies with "global name 'lldb' is not defined"
https://bugs.webkit.org/show_bug.cgi?id=162585

Reviewed by Simon Fraser.

Import the lldb module into the global namespace.

Currently dump-class-layout imports the lldb Python module using the import statement
from the helper function import_lldb. The import statement imports the names of the
specified module into the scope of import_lldb(); => the names imported from this
module cannot be accessed outside the scope of import_lldb(). Other functions in
this script assume that the lldb module was imported into the global scope. We should
import the module lldb into the global scope, if it exists, so that these functions
can find it. Otherwise, we should emit a human readable error message that explains
that we failed to import the lldb module.

Also remove some unnecessary semicolon characters.

* Scripts/dump-class-layout:
(import_lldb):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (206440 => 206441)


--- trunk/Tools/ChangeLog	2016-09-27 17:14:32 UTC (rev 206440)
+++ trunk/Tools/ChangeLog	2016-09-27 17:18:55 UTC (rev 206441)
@@ -1,3 +1,26 @@
+2016-09-27  Daniel Bates  <[email protected]>
+
+        Cannot run dump-class-layout; dies with "global name 'lldb' is not defined"
+        https://bugs.webkit.org/show_bug.cgi?id=162585
+
+        Reviewed by Simon Fraser.
+
+        Import the lldb module into the global namespace.
+
+        Currently dump-class-layout imports the lldb Python module using the import statement
+        from the helper function import_lldb. The import statement imports the names of the
+        specified module into the scope of import_lldb(); => the names imported from this
+        module cannot be accessed outside the scope of import_lldb(). Other functions in
+        this script assume that the lldb module was imported into the global scope. We should
+        import the module lldb into the global scope, if it exists, so that these functions
+        can find it. Otherwise, we should emit a human readable error message that explains
+        that we failed to import the lldb module.
+
+        Also remove some unnecessary semicolon characters.
+
+        * Scripts/dump-class-layout:
+        (import_lldb):
+
 2016-09-27  Jer Noble  <[email protected]>
 
         Remove deprecated ENCRYPTED_MEDIA implementation.

Modified: trunk/Tools/Scripts/dump-class-layout (206440 => 206441)


--- trunk/Tools/Scripts/dump-class-layout	2016-09-27 17:14:32 UTC (rev 206440)
+++ trunk/Tools/Scripts/dump-class-layout	2016-09-27 17:18:55 UTC (rev 206441)
@@ -42,11 +42,17 @@
     return subprocess.check_output(["xcode-select", "--print-path"])
 
 def import_lldb():
-    xcode_contents_path = os.path.split(developer_dir())[0];
-    lldb_framework_path = os.path.join(xcode_contents_path, "SharedFrameworks", "LLDB.framework", "Resources", "Python");
+    xcode_contents_path = os.path.split(developer_dir())[0]
+    lldb_framework_path = os.path.join(xcode_contents_path, "SharedFrameworks", "LLDB.framework", "Resources", "Python")
     sys.path.append(lldb_framework_path)
-    import lldb
 
+    LLDB_MODULE_NAME = "lldb"
+    try:
+        globals()[LLDB_MODULE_NAME] = __import__(LLDB_MODULE_NAME)
+    except ImportError:
+        print "Failed to import {} from {}".format(LLDB_MODULE_NAME, lldb_framework_path)
+        sys.exit(1)
+
 def find_build_directory():
     return
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to