Bug 1483323 part 1 - Fix initializing the SpiderMonkey gdb UnwinderTypeCache r=tromey
authorJim Porter <jporter@mozilla.com>
Wed, 05 Sep 2018 18:51:22 +0000
changeset 435022 c32643cc46b693e3e3e8f6f1f4ab8f376dfb1641
parent 435021 9b7d4a94002a49f12b5d25030569e3b4c381718c
child 435023 4fb8cbcedcb130e9f6126c7c222855191dc45150
push id107530
push userapavel@mozilla.com
push dateThu, 06 Sep 2018 04:44:27 +0000
treeherdermozilla-inbound@5f5d7a3ce332 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstromey
bugs1483323
milestone64.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1483323 part 1 - Fix initializing the SpiderMonkey gdb UnwinderTypeCache r=tromey Differential Revision: https://phabricator.services.mozilla.com/D4607
js/src/gdb/mozilla/unwind.py
--- a/js/src/gdb/mozilla/unwind.py
+++ b/js/src/gdb/mozilla/unwind.py
@@ -39,16 +39,17 @@ def debug(something):
 # Maps frametype enum base names to corresponding class.
 SizeOfFramePrefix = {
     'FrameType::IonJS': 'ExitFrameLayout',
     'FrameType::BaselineJS': 'JitFrameLayout',
     'FrameType::BaselineStub': 'BaselineStubFrameLayout',
     'FrameType::IonStub': 'JitStubFrameLayout',
     'FrameType::CppToJSJit': 'JitFrameLayout',
     'FrameType::WasmToJSJit': 'JitFrameLayout',
+    'FrameType::JSJitToWasm': 'JitFrameLayout',
     'FrameType::Rectifier': 'RectifierFrameLayout',
     'FrameType::IonAccessorIC': 'IonAccessorICFrameLayout',
     'FrameType::IonICCall': 'IonICCallFrameLayout',
     'FrameType::Exit': 'ExitFrameLayout',
     'FrameType::Bailout': 'JitFrameLayout',
 }
 
 
@@ -65,45 +66,49 @@ class UnwinderTypeCache(object):
     # symbols until absolutely needed.  Without this, the loading
     # approach taken by the gdb-tests would cause spurious exceptions.
     def __getattr__(self, name):
         if self.d is None:
             self.initialize()
         return self.d[name]
 
     def value(self, name):
-        return long(gdb.parse_and_eval('js::jit::' + name))
+        return long(gdb.lookup_symbol(name)[0].value())
+
+    def jit_value(self, name):
+        return self.value('js::jit::' + name)
 
     def initialize(self):
         self.d = {}
-        self.d['FRAMETYPE_MASK'] = (1 << self.value('FRAMETYPE_BITS')) - 1
-        self.d['FRAMESIZE_SHIFT'] = self.value('FRAMESIZE_SHIFT')
-        self.d['FRAME_HEADER_SIZE_SHIFT'] = self.value('FRAME_HEADER_SIZE_SHIFT')
-        self.d['FRAME_HEADER_SIZE_MASK'] = self.value('FRAME_HEADER_SIZE_MASK')
+        self.d['FRAMETYPE_MASK'] = (1 << self.jit_value('FRAMETYPE_BITS')) - 1
+        self.d['FRAMESIZE_SHIFT'] = self.jit_value('FRAMESIZE_SHIFT')
+        self.d['FRAME_HEADER_SIZE_SHIFT'] = self.jit_value('FRAME_HEADER_SIZE_SHIFT')
+        self.d['FRAME_HEADER_SIZE_MASK'] = self.jit_value('FRAME_HEADER_SIZE_MASK')
 
         self.compute_frame_info()
         commonFrameLayout = gdb.lookup_type('js::jit::CommonFrameLayout')
         self.d['typeCommonFrameLayout'] = commonFrameLayout
         self.d['typeCommonFrameLayoutPointer'] = commonFrameLayout.pointer()
         self.d['per_tls_context'] = gdb.lookup_global_symbol('js::TlsContext')
 
         self.d['void_starstar'] = gdb.lookup_type('void').pointer().pointer()
         self.d['mod_ExecutableAllocator'] = jsjitExecutableAllocatorCache()
 
         jitframe = gdb.lookup_type("js::jit::JitFrameLayout")
         self.d['jitFrameLayoutPointer'] = jitframe.pointer()
 
-        self.d['CalleeToken_Function'] = self.value("CalleeToken_Function")
-        self.d['CalleeToken_FunctionConstructing'] = self.value("CalleeToken_FunctionConstructing")
-        self.d['CalleeToken_Script'] = self.value("CalleeToken_Script")
+        self.d['CalleeToken_Function'] = self.jit_value("CalleeToken_Function")
+        self.d['CalleeToken_FunctionConstructing'] = self.jit_value(
+            "CalleeToken_FunctionConstructing")
+        self.d['CalleeToken_Script'] = self.jit_value("CalleeToken_Script")
         self.d['JSFunction'] = gdb.lookup_type("JSFunction").pointer()
         self.d['JSScript'] = gdb.lookup_type("JSScript").pointer()
         self.d['Value'] = gdb.lookup_type("JS::Value")
 
-        self.d['SOURCE_SLOT'] = long(gdb.parse_and_eval('js::ScriptSourceObject::SOURCE_SLOT'))
+        self.d['SOURCE_SLOT'] = self.value('js::ScriptSourceObject::SOURCE_SLOT')
         self.d['NativeObject'] = gdb.lookup_type("js::NativeObject").pointer()
         self.d['HeapSlot'] = gdb.lookup_type("js::HeapSlot").pointer()
         self.d['ScriptSource'] = gdb.lookup_type("js::ScriptSource").pointer()
 
     # Compute maps related to jit frames.
     def compute_frame_info(self):
         t = gdb.lookup_type('enum js::jit::FrameType')
         for field in t.fields():
@@ -449,17 +454,17 @@ class UnwinderState(object):
     # Unwind an exit frame.  Returns None if this cannot be done;
     # otherwise returns the newly-created unwind info for gdb.
     def unwind_exit_frame(self, pc, pending_frame):
         if self.activation == 0:
             # Reached the end of the list.
             return None
         elif self.activation is None:
             cx = self.get_tls_context()
-            self.activation = cx['jitActivation']
+            self.activation = cx['jitActivation']['value']
         else:
             self.activation = self.activation['prevJitActivation_']
 
         packedExitFP = self.activation['packedExitFP_']
         if packedExitFP == 0:
             return None
 
         exit_sp = pending_frame.read_register(self.SP_REGISTER)