stx/gdb/commands.py
changeset 4 ca45a88235bd
parent 2 ef575a931434
--- a/stx/gdb/commands.py	Thu Apr 09 15:03:16 2015 +0100
+++ b/stx/gdb/commands.py	Thu Apr 09 15:04:14 2015 +0100
@@ -8,29 +8,34 @@
 
     @staticmethod
     def decorate(frame):
-        if frame.function().name == '__jInterpret':
+    	function = frame.function()
+    	if function == None:
+	    return CFrameDecorator_jit(frame)
+        if function.name == '__jInterpret':
             return CFrameDecorator_jInterpret(frame)
         else:
             c , s = stx.util.demangle(frame.name())
             if (c != None):
                 if (s != None):
-                    return CFrameDecorator_stcMethod(frame, c, s) 
+                    return CFrameDecorator_stcMethod(frame, c, s)
             return CFrameDecorator(frame)
-    
+
     def __str__(self):
         kind = self.kind()
         if kind != None:
             kind = "%2s" % kind
         else:
             kind = '  '
-        return "%3s 0x%8x %s ( %s)" % ( 
-            kind , 
-            self.pc(), 
-            self.name() , 
+        return "%3s 0x%8x %s ( %s)" % (
+            kind ,
+            self.pc(),
+            self.name() ,
             self.args_string() )
 
     def older(self):
         older = self._obj.older()
+        if older == None:
+            return None
         # special case, because of longjmp(), parent frame-point might point
         # to clean area, filled by 0xa5a5a5a5 (malloc() does this)
         if older.pc() != 0xa5a5a5a5:
@@ -49,17 +54,17 @@
         """Returns a top-level block (i.e., block for the function)"""
         b = self._obj.block()
         while b.function == None:
-            b = b.superblock            
+            b = b.superblock
         return b
-    
+
     def args_string(self):
-        """Returns a string representation of arguments"""    
+        """Returns a string representation of arguments"""
         s = ''
         for sym in self.function_block():
             if sym.is_argument:
                 s = s + self.arg_string(sym) + ' '
         return s
-    
+
     def arg_string(self, sym):
         """Given an argument symbol, returns its string representation"""
         val = self._obj.read_var(sym, self._obj.block())
@@ -70,6 +75,18 @@
     def kind(self):
         return "J-I"
 
+class CFrameDecorator_jit ( CFrameDecorator ):
+
+    def kind(self):
+        return "?-J"
+
+    def function_block(self):
+    	return []
+
+    def name(self):
+    	return "???"
+
+
 class CFrameDecorator_stcMethod ( CFrameDecorator ):
     def __init__(self, frame, className = None, selectorValue = None):
         CFrameDecorator.__init__(self, frame)
@@ -78,36 +95,36 @@
         if (c == None or s == None):
             c, s = stx.util.demangle(frame.name())
         self.klassName = c
-        self.selectorValue = s 
+        self.selectorValue = s
 
     def name(self):
         return "%s >> #%s" % ( self.klassName, self.selectorValue )
 
 
     def kind(self):
-        return "S-S"
-        
+        return "S-C"
+
 class Backtrace ( gdb.Command ):
     '''
-    Prints a VM backtrace. 
+    Prints a VM backtrace.
 
     Print additional information for well-known VM functions such
     as __interpret, __jinterpret, etc.
     '''
-    
+
     def __init__ ( self ):
         super (Backtrace, self).__init__("btx", gdb.COMMAND_STACK)
-    
+
     def invoke ( self , args , from_tty ):
         try:
             argv = gdb.string_to_argv(args)
             limit = None
             if len(argv) == 1:
                 limit = int(argv[0])
-            fno = 0        
+            fno = 0
             frame = CFrameDecorator.decorate(gdb.newest_frame())
             framesel = gdb.selected_frame()
-            while ( frame != None ) and ( limit == None or fno < limit ):            
+            while ( frame != None ) and ( limit == None or fno < limit ):
                 if frame.target() == framesel:
                     star = '*'
                 else: