<s> """<STR_LIT>""" <EOL> import lldb <EOL> import ctypes <EOL> import lldb . runtime . objc . objc_runtime <EOL> import lldb . formatters . metrics <EOL> import struct <EOL> import time <EOL> import datetime <EOL> import CFString <EOL> import lldb . formatters . Logger <EOL> statistics = lldb . formatters . metrics . Metrics ( ) <EOL> statistics . add_metric ( '<STR_LIT>' ) <EOL> statistics . add_metric ( '<STR_LIT>' ) <EOL> statistics . add_metric ( '<STR_LIT>' ) <EOL> statistics . add_metric ( '<STR_LIT>' ) <EOL> python_epoch = time . gmtime ( <NUM_LIT:0> ) . tm_year <EOL> osx_epoch = datetime . date ( <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:1> ) . timetuple ( ) <EOL> def mkgmtime ( t ) : <EOL> logger = lldb . formatters . Logger . Logger ( ) <EOL> return time . mktime ( t ) - time . timezone <EOL> osx_epoch = mkgmtime ( osx_epoch ) <EOL> def osx_to_python_time ( osx ) : <EOL> logger = lldb . formatters . Logger . Logger ( ) <EOL> if python_epoch <= <NUM_LIT> : <EOL> return osx + osx_epoch <EOL> else : <EOL> return osx - osx_epoch <EOL> def xcode_format_time ( X ) : <EOL> logger = lldb . formatters . Logger . Logger ( ) <EOL> return time . strftime ( '<STR_LIT>' , X ) <EOL> def xcode_format_count ( X ) : <EOL> logger = lldb . formatters . Logger . Logger ( ) <EOL> return xcode_format_time ( time . localtime ( X ) ) <EOL> class NSTaggedDate_SummaryProvider : <EOL> def adjust_for_architecture ( self ) : <EOL> pass <EOL> def __init__ ( self , valobj , info_bits , data , params ) : <EOL> logger = lldb . formatters . Logger . Logger ( ) <EOL> self . valobj = valobj ; <EOL> self . sys_params = params <EOL> self . update ( ) ; <EOL> self . data = ( ( data << <NUM_LIT:8> ) | ( info_bits << <NUM_LIT:4> ) ) <EOL> def update ( self ) : <EOL> logger = lldb . formatters . Logger . Logger ( ) <EOL> self . adjust_for_architecture ( ) ; <EOL> def value ( self ) : <EOL> logger = lldb . formatters . Logger . Logger ( ) <EOL> value_double = struct . unpack ( '<STR_LIT:d>' , struct . pack ( '<STR_LIT>' , self . data ) ) [ <NUM_LIT:0> ] <EOL> return xcode_format_count ( osx_to_python_time ( value_double ) ) <EOL> class NSUntaggedDate_SummaryProvider : <EOL> def adjust_for_architecture ( self ) : <EOL> pass <EOL> def __init__ ( self , valobj , params ) : <EOL> logger = lldb . formatters . Logger . Logger ( ) <EOL> self . valobj = valobj ; <EOL> self . sys_params = params <EOL> if not ( self . sys_params . types_cache . double ) : <EOL> self . sys_params . types_cache . double = self . valobj . GetType ( ) . GetBasicType ( lldb . eBasicTypeDouble ) <EOL> self . update ( ) <EOL> def update ( self ) : <EOL> logger = lldb . formatters . Logger . Logger ( ) <EOL> self . adjust_for_architecture ( ) ; <EOL> def offset ( self ) : <EOL> logger = lldb . formatters . Logger . Logger ( ) <EOL> return self . sys_params . pointer_size <EOL> def value ( self ) : <EOL> logger = lldb . formatters . Logger . Logger ( ) <EOL> value = self . valobj . CreateChildAtOffset ( "<STR_LIT:value>" , <EOL> self . offset ( ) , <EOL> self . sys_params . types_cache . double ) <EOL> value_double = struct . unpack ( '<STR_LIT:d>' , struct . pack ( '<STR_LIT>' , value . GetValueAsUnsigned ( <NUM_LIT:0> ) ) ) [ <NUM_LIT:0> ] <EOL> return xcode_format_count ( osx_to_python_time ( value_double ) ) <EOL> class NSCalendarDate_SummaryProvider : <EOL> def adjust_for_architecture ( self ) : <EOL> pass <EOL> def __init__ ( self , valobj , params ) : <EOL> logger = lldb . formatters . Logger . Logger ( ) <EOL> self . valobj = valobj ; <EOL> self . sys_params = params <EOL> if not ( self . sys_params . types_cache . double ) : <EOL> self . sys_params . types_cache . double = self . valobj . GetType ( ) . GetBasicType ( lldb . eBasicTypeDouble ) <EOL> self . update ( ) <EOL> def update ( self ) : <EOL> logger = lldb . formatters . Logger . Logger ( ) <EOL> self . adjust_for_architecture ( ) ; <EOL> def offset ( self ) : <EOL> logger = lldb . formatters . Logger . Logger ( ) <EOL> return <NUM_LIT:2> * self . sys_params . pointer_size <EOL> def value ( self ) : <EOL> logger = lldb . formatters . Logger . Logger ( ) <EOL> value = self . valobj . CreateChildAtOffset ( "<STR_LIT:value>" , <EOL> self . offset ( ) , <EOL> self . sys_params . types_cache . double ) <EOL> value_double = struct . unpack ( '<STR_LIT:d>' , struct . pack ( '<STR_LIT>' , value . GetValueAsUnsigned ( <NUM_LIT:0> ) ) ) [ <NUM_LIT:0> ] <EOL> return xcode_format_count ( osx_to_python_time ( value_double ) ) <EOL> class NSTimeZoneClass_SummaryProvider : <EOL> def adjust_for_architecture ( self ) : <EOL> pass <EOL> def __init__ ( self , valobj , params ) : <EOL> logger = lldb . formatters . Logger . Logger ( ) <EOL> self . valobj = valobj ; <EOL> self . sys_params = params <EOL> if not ( self . sys_params . types_cache . voidptr ) : <EOL> self . sys_params . types_cache . voidptr = self . valobj . GetType ( ) . GetBasicType ( lldb . eBasicTypeVoid ) . GetPointerType ( ) <EOL> self . update ( ) <EOL> def update ( self ) : <EOL> logger = lldb . formatters . Logger . Logger ( ) <EOL> self . adjust_for_architecture ( ) ; <EOL> def offset ( self ) : <EOL> logger = lldb . formatters . Logger . Logger ( ) <EOL> return self . sys_params . pointer_size <EOL> def timezone ( self ) : <EOL> logger = lldb . formatters . Logger . Logger ( ) <EOL> tz_string = self . valobj . CreateChildAtOffset ( "<STR_LIT>" , <EOL> self . offset ( ) , <EOL> self . sys_params . types_cache . voidptr ) <EOL> return CFString . CFString_SummaryProvider ( tz_string , None ) <EOL> class NSUnknownDate_SummaryProvider : <EOL> def adjust_for_architecture ( self ) : <EOL> pass <EOL> def __init__ ( self , valobj ) : <EOL> logger = lldb . formatters . Logger . Logger ( ) <EOL> self . valobj = valobj ; <EOL> self . update ( ) <EOL> def update ( self ) : <EOL> logger = lldb . formatters . Logger . Logger ( ) <EOL> self . adjust_for_architecture ( ) ; <EOL> def value ( self ) : <EOL> logger = lldb . formatters . Logger . Logger ( ) <EOL> stream = lldb . SBStream ( ) <EOL> self . valobj . GetExpressionPath ( stream ) <EOL> expr = "<STR_LIT>" + stream . GetData ( ) + "<STR_LIT>" <EOL> num_children_vo = self . valobj . CreateValueFromExpression ( "<STR_LIT:str>" , expr ) ; <EOL> if num_children_vo . IsValid ( ) : <EOL> return num_children_vo . GetSummary ( ) <EOL> return '<STR_LIT>' <EOL> def GetSummary_Impl ( valobj ) : <EOL> logger = lldb . formatters . Logger . Logger ( ) <EOL> global statistics <EOL> class_data , wrapper = lldb . runtime . objc . objc_runtime . Utilities . prepare_class_detection ( valobj , statistics ) <EOL> if wrapper : <EOL> return wrapper <EOL> name_string = class_data . class_name ( ) <EOL> logger >> "<STR_LIT>" + str ( name_string ) <EOL> if name_string == '<STR_LIT>' or name_string == '<STR_LIT>' or name_string == '<STR_LIT>' : <EOL> if class_data . is_tagged ( ) : <EOL> wrapper = NSTaggedDate_SummaryProvider ( valobj , class_data . info_bits ( ) , class_data . value ( ) , class_data . sys_params ) <EOL> statistics . metric_hit ( '<STR_LIT>' , valobj ) <EOL> else : <EOL> wrapper = NSUntaggedDate_SummaryProvider ( valobj , class_data . sys_params ) <EOL> statistics . metric_hit ( '<STR_LIT>' , valobj ) <EOL> elif name_string == '<STR_LIT>' : <EOL> wrapper = NSCalendarDate_SummaryProvider ( valobj , class_data . sys_params ) <EOL> statistics . metric_hit ( '<STR_LIT>' , valobj ) <EOL> elif name_string == '<STR_LIT>' : <EOL> wrapper = NSTimeZoneClass_SummaryProvider ( valobj , class_data . sys_params ) <EOL> statistics . metric_hit ( '<STR_LIT>' , valobj ) <EOL> else : <EOL> wrapper = NSUnknownDate_SummaryProvider ( valobj ) <EOL> statistics . metric_hit ( '<STR_LIT>' , valobj . GetName ( ) + "<STR_LIT>" + name_string ) <EOL> return wrapper ; <EOL> def NSDate_SummaryProvider ( valobj , dict ) : <EOL> logger = lldb . formatters . Logger . Logger ( ) <EOL> provider = GetSummary_Impl ( valobj ) ; <EOL> if provider != None : <EOL> if isinstance ( provider , lldb . runtime . objc . objc_runtime . SpecialSituation_Description ) : <EOL> return provider . message ( ) <EOL> try : <EOL> summary = provider . value ( ) ; <EOL> except : <EOL> summary = None <EOL> if summary == None : <EOL> summary = '<STR_LIT>' <EOL> return str ( summary ) <EOL> return '<STR_LIT>' <EOL> def NSTimeZone_SummaryProvider ( valobj , dict ) : <EOL> logger = lldb . formatters . Logger . Logger ( ) <EOL> provider = GetSummary_Impl ( valobj ) ; <EOL> if provider != None : <EOL> if isinstance ( provider , lldb . runtime . objc . objc_runtime . SpecialSituation_Description ) : <EOL> return provider . message ( ) <EOL> try : <EOL> summary = provider . timezone ( ) ; <EOL> except : <EOL> summary = None <EOL> logger >> "<STR_LIT>" + str ( summary ) <EOL> if summary == None : <EOL> summary = '<STR_LIT>' <EOL> return str ( summary ) <EOL> return '<STR_LIT>' <EOL> def CFAbsoluteTime_SummaryProvider ( valobj , dict ) : <EOL> logger = lldb . formatters . Logger . Logger ( ) <EOL> try : <EOL> value_double = struct . unpack ( '<STR_LIT:d>' , struct . pack ( '<STR_LIT>' , valobj . GetValueAsUnsigned ( <NUM_LIT:0> ) ) ) [ <NUM_LIT:0> ] <EOL> return xcode_format_count ( osx_to_python_time ( value_double ) ) <EOL> except : <EOL> return '<STR_LIT>' <EOL> def __lldb_init_module ( debugger , dict ) : <EOL> debugger . HandleCommand ( "<STR_LIT>" ) <EOL> debugger . HandleCommand ( "<STR_LIT>" ) <EOL> debugger . HandleCommand ( "<STR_LIT>" ) </s>
