Example #1
0
 def con_desc(self):
     target = self.debugger.GetSelectedTarget()
     stg_con_info_table_type = find_first_type(self.debugger, 'StgConInfoTable_')
     # stg_con_info_table_type = target.FindFirstType('StgConInfoTable_') # waiting on bug 11574
     con_info = self.info_table.Cast(stg_con_info_table_type)
     con_info_ptr = con_info.AddressOf()
     char_type = self.info_table.GetType().GetBasicType(lldb.eBasicTypeChar)
     base = con_info_ptr.GetValueForExpressionPath('[1]')
     offset = con_info_ptr.GetValueForExpressionPath('[1].con_desc').GetValueAsUnsigned()
     summary = base.CreateValueFromAddress('con_desc', base.GetLoadAddress()+offset, char_type).AddressOf().GetSummary()
     return z_code.decode(summary.strip('"')) if summary else None
Example #2
0
    def info_table(self):
        target = self.debugger.GetSelectedTarget()

        # lldb doesn't support negative subscripts, this would be cleaner as '.header.info[-1]'
        info_table = self.obj.GetValueForExpressionPath('.header.info')
        info_table_sym = target.ResolveSymbolContextForAddress(info_table.Dereference().GetAddress(), lldb.eSymbolContextSymbol).GetSymbol()

        # cast it back to the info table
        stg_info_table_type = find_first_type(self.debugger, 'StgInfoTable_')
        info_table_ptr = info_table.GetValueAsUnsigned() - 16
        offset_info_table = info_table.CreateValueFromAddress(z_code.decode(info_table_sym.GetName()), info_table_ptr, stg_info_table_type)

        return InfoTable(self.debugger, offset_info_table)
Example #3
0
 def con_desc(self):
     target = self.debugger.GetSelectedTarget()
     stg_con_info_table_type = find_first_type(self.debugger,
                                               'StgConInfoTable_')
     # stg_con_info_table_type = target.FindFirstType('StgConInfoTable_') # waiting on bug 11574
     con_info = self.info_table.Cast(stg_con_info_table_type)
     con_info_ptr = con_info.AddressOf()
     char_type = self.info_table.GetType().GetBasicType(lldb.eBasicTypeChar)
     base = con_info_ptr.GetValueForExpressionPath('[1]')
     offset = con_info_ptr.GetValueForExpressionPath(
         '[1].con_desc').GetValueAsUnsigned()
     summary = base.CreateValueFromAddress(
         'con_desc',
         base.GetLoadAddress() + offset,
         char_type).AddressOf().GetSummary()
     return z_code.decode(summary.strip('"')) if summary else None
Example #4
0
    def info_table(self):
        target = self.debugger.GetSelectedTarget()

        # lldb doesn't support negative subscripts, this would be cleaner as '.header.info[-1]'
        info_table = self.obj.GetValueForExpressionPath('.header.info')
        info_table_sym = target.ResolveSymbolContextForAddress(
            info_table.Dereference().GetAddress(),
            lldb.eSymbolContextSymbol).GetSymbol()

        # cast it back to the info table
        stg_info_table_type = find_first_type(self.debugger, 'StgInfoTable_')
        info_table_ptr = info_table.GetValueAsUnsigned() - 16
        offset_info_table = info_table.CreateValueFromAddress(
            z_code.decode(info_table_sym.GetName()), info_table_ptr,
            stg_info_table_type)

        return InfoTable(self.debugger, offset_info_table)