forked from OSchip/llvm-project
Making the Cocoa formatters comply with the new on-disk layout of the Python resources - This is one of the steps towards making the data formatters work again
llvm-svn: 155526
This commit is contained in:
parent
5b4ab4c848
commit
28399adad8
|
@ -8,11 +8,11 @@ License. See LICENSE.TXT for details.
|
|||
# synthetic children provider for NSArray
|
||||
import lldb
|
||||
import ctypes
|
||||
import objc_runtime
|
||||
import metrics
|
||||
import Logger
|
||||
import lldb.runtime.objc.objc_runtime
|
||||
import lldb.formatters.metrics
|
||||
import lldb.formatters.Logger
|
||||
|
||||
statistics = metrics.Metrics()
|
||||
statistics = lldb.formatters.metrics.Metrics()
|
||||
statistics.add_metric('invalid_isa')
|
||||
statistics.add_metric('invalid_pointer')
|
||||
statistics.add_metric('unknown_class')
|
||||
|
@ -27,16 +27,16 @@ class NSArrayKVC_SynthProvider:
|
|||
pass
|
||||
|
||||
def __init__(self, valobj, dict, params):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.valobj = valobj;
|
||||
self.update()
|
||||
|
||||
def update(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.adjust_for_architecture();
|
||||
|
||||
def num_children(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
stream = lldb.SBStream()
|
||||
self.valobj.GetExpressionPath(stream)
|
||||
num_children_vo = self.valobj.CreateValueFromExpression("count","(int)[" + stream.GetData() + " count]");
|
||||
|
@ -53,7 +53,7 @@ class NSArrayCF_SynthProvider:
|
|||
pass
|
||||
|
||||
def __init__(self, valobj, dict, params):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.valobj = valobj;
|
||||
self.sys_params = params
|
||||
if not (self.sys_params.types_cache.ulong):
|
||||
|
@ -61,11 +61,11 @@ class NSArrayCF_SynthProvider:
|
|||
self.update()
|
||||
|
||||
def update(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.adjust_for_architecture();
|
||||
|
||||
def num_children(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
num_children_vo = self.valobj.CreateChildAtOffset("count",
|
||||
self.sys_params.cfruntime_size,
|
||||
self.sys_params.types_cache.ulong)
|
||||
|
@ -76,7 +76,7 @@ class NSArrayI_SynthProvider:
|
|||
pass
|
||||
|
||||
def __init__(self, valobj, dict, params):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.valobj = valobj;
|
||||
self.sys_params = params
|
||||
if not(self.sys_params.types_cache.long):
|
||||
|
@ -84,12 +84,12 @@ class NSArrayI_SynthProvider:
|
|||
self.update()
|
||||
|
||||
def update(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.adjust_for_architecture();
|
||||
|
||||
# skip the isa pointer and get at the size
|
||||
def num_children(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
count = self.valobj.CreateChildAtOffset("count",
|
||||
self.sys_params.pointer_size,
|
||||
self.sys_params.types_cache.long);
|
||||
|
@ -100,7 +100,7 @@ class NSArrayM_SynthProvider:
|
|||
pass
|
||||
|
||||
def __init__(self, valobj, dict, params):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.valobj = valobj;
|
||||
self.sys_params = params
|
||||
if not(self.sys_params.types_cache.long):
|
||||
|
@ -108,12 +108,12 @@ class NSArrayM_SynthProvider:
|
|||
self.update()
|
||||
|
||||
def update(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.adjust_for_architecture();
|
||||
|
||||
# skip the isa pointer and get at the size
|
||||
def num_children(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
count = self.valobj.CreateChildAtOffset("count",
|
||||
self.sys_params.pointer_size,
|
||||
self.sys_params.types_cache.long);
|
||||
|
@ -127,7 +127,7 @@ class NSArray_SynthProvider:
|
|||
pass
|
||||
|
||||
def __init__(self, valobj, dict):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.valobj = valobj;
|
||||
self.adjust_for_architecture()
|
||||
self.error = False
|
||||
|
@ -135,13 +135,13 @@ class NSArray_SynthProvider:
|
|||
self.invalid = (self.wrapper == None)
|
||||
|
||||
def num_children(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
if self.wrapper == None:
|
||||
return 0;
|
||||
return self.wrapper.num_children()
|
||||
|
||||
def update(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
if self.wrapper == None:
|
||||
return
|
||||
self.wrapper.update()
|
||||
|
@ -149,7 +149,7 @@ class NSArray_SynthProvider:
|
|||
# this code acts as our defense against NULL and unitialized
|
||||
# NSArray pointers, which makes it much longer than it would be otherwise
|
||||
def make_wrapper(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
if self.valobj.GetValueAsUnsigned() == 0:
|
||||
self.error = True
|
||||
return objc_runtime.InvalidPointer_Description(True)
|
||||
|
@ -179,7 +179,7 @@ class NSArray_SynthProvider:
|
|||
return wrapper;
|
||||
|
||||
def CFArray_SummaryProvider (valobj,dict):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
provider = NSArray_SynthProvider(valobj,dict);
|
||||
if provider.invalid == False:
|
||||
if provider.error == True:
|
||||
|
|
|
@ -8,11 +8,11 @@ License. See LICENSE.TXT for details.
|
|||
# summary provider for CFBag
|
||||
import lldb
|
||||
import ctypes
|
||||
import objc_runtime
|
||||
import metrics
|
||||
import Logger
|
||||
import lldb.runtime.objc.objc_runtime
|
||||
import lldb.formatters.metrics
|
||||
import lldb.formatters.Logger
|
||||
|
||||
statistics = metrics.Metrics()
|
||||
statistics = lldb.formatters.metrics.Metrics()
|
||||
statistics.add_metric('invalid_isa')
|
||||
statistics.add_metric('invalid_pointer')
|
||||
statistics.add_metric('unknown_class')
|
||||
|
@ -26,7 +26,7 @@ class CFBagRef_SummaryProvider:
|
|||
pass
|
||||
|
||||
def __init__(self, valobj, params):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.valobj = valobj;
|
||||
self.sys_params = params
|
||||
if not(self.sys_params.types_cache.NSUInteger):
|
||||
|
@ -37,21 +37,21 @@ class CFBagRef_SummaryProvider:
|
|||
self.update();
|
||||
|
||||
def update(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.adjust_for_architecture();
|
||||
|
||||
# 12 bytes on i386
|
||||
# 20 bytes on x64
|
||||
# most probably 2 pointers and 4 bytes of data
|
||||
def offset(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
if self.sys_params.is_64_bit:
|
||||
return 20
|
||||
else:
|
||||
return 12
|
||||
|
||||
def length(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
size = self.valobj.CreateChildAtOffset("count",
|
||||
self.offset(),
|
||||
self.sys_params.types_cache.NSUInteger)
|
||||
|
@ -63,17 +63,17 @@ class CFBagUnknown_SummaryProvider:
|
|||
pass
|
||||
|
||||
def __init__(self, valobj, params):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.valobj = valobj;
|
||||
self.sys_params = params
|
||||
self.update();
|
||||
|
||||
def update(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.adjust_for_architecture();
|
||||
|
||||
def length(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
stream = lldb.SBStream()
|
||||
self.valobj.GetExpressionPath(stream)
|
||||
num_children_vo = self.valobj.CreateValueFromExpression("count","(int)CFBagGetCount(" + stream.GetData() + " )")
|
||||
|
@ -83,7 +83,7 @@ class CFBagUnknown_SummaryProvider:
|
|||
|
||||
|
||||
def GetSummary_Impl(valobj):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
global statistics
|
||||
class_data,wrapper = objc_runtime.Utilities.prepare_class_detection(valobj,statistics)
|
||||
if wrapper:
|
||||
|
@ -112,7 +112,7 @@ def GetSummary_Impl(valobj):
|
|||
return wrapper;
|
||||
|
||||
def CFBag_SummaryProvider (valobj,dict):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
provider = GetSummary_Impl(valobj);
|
||||
if provider != None:
|
||||
if isinstance(provider,objc_runtime.SpecialSituation_Description):
|
||||
|
|
|
@ -8,11 +8,11 @@ License. See LICENSE.TXT for details.
|
|||
# summary provider for CFBinaryHeap
|
||||
import lldb
|
||||
import ctypes
|
||||
import objc_runtime
|
||||
import metrics
|
||||
import Logger
|
||||
import lldb.runtime.objc.objc_runtime
|
||||
import lldb.formatters.metrics
|
||||
import lldb.formatters.Logger
|
||||
|
||||
statistics = metrics.Metrics()
|
||||
statistics = lldb.formatters.metrics.Metrics()
|
||||
statistics.add_metric('invalid_isa')
|
||||
statistics.add_metric('invalid_pointer')
|
||||
statistics.add_metric('unknown_class')
|
||||
|
@ -26,7 +26,7 @@ class CFBinaryHeapRef_SummaryProvider:
|
|||
pass
|
||||
|
||||
def __init__(self, valobj, params):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.valobj = valobj;
|
||||
self.sys_params = params
|
||||
if not(self.sys_params.types_cache.NSUInteger):
|
||||
|
@ -37,18 +37,18 @@ class CFBinaryHeapRef_SummaryProvider:
|
|||
self.update();
|
||||
|
||||
def update(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.adjust_for_architecture();
|
||||
|
||||
# 8 bytes on i386
|
||||
# 16 bytes on x64
|
||||
# most probably 2 pointers
|
||||
def offset(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
return 2 * self.sys_params.pointer_size
|
||||
|
||||
def length(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
size = self.valobj.CreateChildAtOffset("count",
|
||||
self.offset(),
|
||||
self.sys_params.types_cache.NSUInteger)
|
||||
|
@ -60,17 +60,17 @@ class CFBinaryHeapUnknown_SummaryProvider:
|
|||
pass
|
||||
|
||||
def __init__(self, valobj, params):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.valobj = valobj;
|
||||
self.sys_params = params
|
||||
self.update();
|
||||
|
||||
def update(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.adjust_for_architecture();
|
||||
|
||||
def length(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
stream = lldb.SBStream()
|
||||
self.valobj.GetExpressionPath(stream)
|
||||
num_children_vo = self.valobj.CreateValueFromExpression("count","(int)CFBinaryHeapGetCount(" + stream.GetData() + " )");
|
||||
|
@ -80,7 +80,7 @@ class CFBinaryHeapUnknown_SummaryProvider:
|
|||
|
||||
|
||||
def GetSummary_Impl(valobj):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
global statistics
|
||||
class_data,wrapper = objc_runtime.Utilities.prepare_class_detection(valobj,statistics)
|
||||
if wrapper:
|
||||
|
@ -108,7 +108,7 @@ def GetSummary_Impl(valobj):
|
|||
return wrapper;
|
||||
|
||||
def CFBinaryHeap_SummaryProvider (valobj,dict):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
provider = GetSummary_Impl(valobj);
|
||||
if provider != None:
|
||||
if isinstance(provider,objc_runtime.SpecialSituation_Description):
|
||||
|
|
|
@ -8,30 +8,30 @@ License. See LICENSE.TXT for details.
|
|||
# summary provider for CF(Mutable)BitVector
|
||||
import lldb
|
||||
import ctypes
|
||||
import objc_runtime
|
||||
import metrics
|
||||
import Logger
|
||||
import lldb.runtime.objc.objc_runtime
|
||||
import lldb.formatters.metrics
|
||||
import lldb.formatters.Logger
|
||||
|
||||
# first define some utility functions
|
||||
def byte_index(abs_pos):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
return abs_pos/8
|
||||
|
||||
def bit_index(abs_pos):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
return abs_pos & 7
|
||||
|
||||
def get_bit(byte,index):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
if index < 0 or index > 7:
|
||||
return None
|
||||
return (byte >> (7-index)) & 1
|
||||
|
||||
def grab_array_item_data(pointer,index):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
return pointer.GetPointeeData(index,1)
|
||||
|
||||
statistics = metrics.Metrics()
|
||||
statistics = lldb.formatters.metrics.Metrics()
|
||||
statistics.add_metric('invalid_isa')
|
||||
statistics.add_metric('invalid_pointer')
|
||||
statistics.add_metric('unknown_class')
|
||||
|
@ -42,12 +42,12 @@ statistics.add_metric('code_notrun')
|
|||
# obey the interface specification for synthetic children providers
|
||||
class CFBitVectorKnown_SummaryProvider:
|
||||
def adjust_for_architecture(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.uiint_size = self.sys_params.types_cache.NSUInteger.GetByteSize()
|
||||
pass
|
||||
|
||||
def __init__(self, valobj, params):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.valobj = valobj;
|
||||
self.sys_params = params
|
||||
if not(self.sys_params.types_cache.NSUInteger):
|
||||
|
@ -60,7 +60,7 @@ class CFBitVectorKnown_SummaryProvider:
|
|||
self.update();
|
||||
|
||||
def update(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.adjust_for_architecture();
|
||||
|
||||
# we skip the CFRuntimeBase
|
||||
|
@ -69,7 +69,7 @@ class CFBitVectorKnown_SummaryProvider:
|
|||
# that wraps the individual bits
|
||||
|
||||
def contents(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
count_vo = self.valobj.CreateChildAtOffset("count",self.sys_params.cfruntime_size,
|
||||
self.sys_params.types_cache.NSUInteger)
|
||||
count = count_vo.GetValueAsUnsigned(0)
|
||||
|
@ -109,22 +109,22 @@ class CFBitVectorUnknown_SummaryProvider:
|
|||
pass
|
||||
|
||||
def __init__(self, valobj, params):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.valobj = valobj;
|
||||
self.sys_params = params
|
||||
self.update();
|
||||
|
||||
def update(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.adjust_for_architecture();
|
||||
|
||||
def contents(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
return '<unable to summarize this CFBitVector>'
|
||||
|
||||
|
||||
def GetSummary_Impl(valobj):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
global statistics
|
||||
class_data,wrapper = objc_runtime.Utilities.prepare_class_detection(valobj,statistics)
|
||||
if wrapper:
|
||||
|
@ -156,7 +156,7 @@ def GetSummary_Impl(valobj):
|
|||
return wrapper;
|
||||
|
||||
def CFBitVector_SummaryProvider (valobj,dict):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
provider = GetSummary_Impl(valobj);
|
||||
if provider != None:
|
||||
if isinstance(provider,objc_runtime.SpecialSituation_Description):
|
||||
|
|
|
@ -8,11 +8,11 @@ License. See LICENSE.TXT for details.
|
|||
# summary provider for NSDictionary
|
||||
import lldb
|
||||
import ctypes
|
||||
import objc_runtime
|
||||
import metrics
|
||||
import Logger
|
||||
import lldb.runtime.objc.objc_runtime
|
||||
import lldb.formatters.metrics
|
||||
import lldb.formatters.Logger
|
||||
|
||||
statistics = metrics.Metrics()
|
||||
statistics = lldb.formatters.metrics.Metrics()
|
||||
statistics.add_metric('invalid_isa')
|
||||
statistics.add_metric('invalid_pointer')
|
||||
statistics.add_metric('unknown_class')
|
||||
|
@ -26,7 +26,7 @@ class NSCFDictionary_SummaryProvider:
|
|||
pass
|
||||
|
||||
def __init__(self, valobj, params):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.valobj = valobj;
|
||||
self.sys_params = params
|
||||
if not(self.sys_params.types_cache.NSUInteger):
|
||||
|
@ -37,7 +37,7 @@ class NSCFDictionary_SummaryProvider:
|
|||
self.update();
|
||||
|
||||
def update(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.adjust_for_architecture();
|
||||
|
||||
# empirically determined on both 32 and 64bit desktop Mac OS X
|
||||
|
@ -45,14 +45,14 @@ class NSCFDictionary_SummaryProvider:
|
|||
# the description of __CFDictionary is not readily available so most
|
||||
# of this is guesswork, plain and simple
|
||||
def offset(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
if self.sys_params.is_64_bit:
|
||||
return 20
|
||||
else:
|
||||
return 12
|
||||
|
||||
def num_children(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
num_children_vo = self.valobj.CreateChildAtOffset("count",
|
||||
self.offset(),
|
||||
self.sys_params.types_cache.NSUInteger)
|
||||
|
@ -64,7 +64,7 @@ class NSDictionaryI_SummaryProvider:
|
|||
pass
|
||||
|
||||
def __init__(self, valobj, params):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.valobj = valobj;
|
||||
self.sys_params = params
|
||||
if not(self.sys_params.types_cache.NSUInteger):
|
||||
|
@ -75,16 +75,16 @@ class NSDictionaryI_SummaryProvider:
|
|||
self.update();
|
||||
|
||||
def update(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.adjust_for_architecture();
|
||||
|
||||
# we just need to skip the ISA and the count immediately follows
|
||||
def offset(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
return self.sys_params.pointer_size
|
||||
|
||||
def num_children(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
num_children_vo = self.valobj.CreateChildAtOffset("count",
|
||||
self.offset(),
|
||||
self.sys_params.types_cache.NSUInteger)
|
||||
|
@ -104,7 +104,7 @@ class NSDictionaryM_SummaryProvider:
|
|||
pass
|
||||
|
||||
def __init__(self, valobj, params):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.valobj = valobj;
|
||||
self.sys_params = params
|
||||
if not(self.sys_params.types_cache.NSUInteger):
|
||||
|
@ -115,7 +115,7 @@ class NSDictionaryM_SummaryProvider:
|
|||
self.update();
|
||||
|
||||
def update(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.adjust_for_architecture();
|
||||
|
||||
# we just need to skip the ISA and the count immediately follows
|
||||
|
@ -123,7 +123,7 @@ class NSDictionaryM_SummaryProvider:
|
|||
return self.sys_params.pointer_size
|
||||
|
||||
def num_children(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
num_children_vo = self.valobj.CreateChildAtOffset("count",
|
||||
self.offset(),
|
||||
self.sys_params.types_cache.NSUInteger)
|
||||
|
@ -143,17 +143,17 @@ class NSDictionaryUnknown_SummaryProvider:
|
|||
pass
|
||||
|
||||
def __init__(self, valobj, params):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.valobj = valobj;
|
||||
self.sys_params = params
|
||||
self.update();
|
||||
|
||||
def update(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.adjust_for_architecture();
|
||||
|
||||
def num_children(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
stream = lldb.SBStream()
|
||||
self.valobj.GetExpressionPath(stream)
|
||||
num_children_vo = self.valobj.CreateValueFromExpression("count","(int)[" + stream.GetData() + " count]");
|
||||
|
@ -163,7 +163,7 @@ class NSDictionaryUnknown_SummaryProvider:
|
|||
|
||||
|
||||
def GetSummary_Impl(valobj):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
global statistics
|
||||
class_data,wrapper = objc_runtime.Utilities.prepare_class_detection(valobj,statistics)
|
||||
if wrapper:
|
||||
|
@ -188,7 +188,7 @@ def GetSummary_Impl(valobj):
|
|||
return wrapper;
|
||||
|
||||
def CFDictionary_SummaryProvider (valobj,dict):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
provider = GetSummary_Impl(valobj);
|
||||
if provider != None:
|
||||
if isinstance(provider,objc_runtime.SpecialSituation_Description):
|
||||
|
@ -206,7 +206,7 @@ def CFDictionary_SummaryProvider (valobj,dict):
|
|||
return 'Summary Unavailable'
|
||||
|
||||
def CFDictionary_SummaryProvider2 (valobj,dict):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
provider = GetSummary_Impl(valobj);
|
||||
if provider != None:
|
||||
if isinstance(provider,objc_runtime.SpecialSituation_Description):
|
||||
|
|
|
@ -8,11 +8,11 @@ License. See LICENSE.TXT for details.
|
|||
# synthetic children and summary provider for CFString
|
||||
# (and related NSString class)
|
||||
import lldb
|
||||
import objc_runtime
|
||||
import Logger
|
||||
import lldb.runtime.objc.objc_runtime
|
||||
import lldb.formatters.Logger
|
||||
|
||||
def CFString_SummaryProvider (valobj,dict):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
provider = CFStringSynthProvider(valobj,dict);
|
||||
if provider.invalid == False:
|
||||
try:
|
||||
|
@ -29,7 +29,7 @@ def CFString_SummaryProvider (valobj,dict):
|
|||
return ''
|
||||
|
||||
def CFAttributedString_SummaryProvider (valobj,dict):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
offset = valobj.GetTarget().GetProcess().GetAddressByteSize()
|
||||
pointee = valobj.GetValueAsUnsigned(0)
|
||||
summary = '<variable is not NSAttributedString>'
|
||||
|
@ -54,19 +54,19 @@ def __lldb_init_module(debugger,dict):
|
|||
|
||||
class CFStringSynthProvider:
|
||||
def __init__(self,valobj,dict):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.valobj = valobj;
|
||||
self.update()
|
||||
|
||||
# children other than "content" are for debugging only and must not be used in production code
|
||||
def num_children(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
if self.invalid:
|
||||
return 0;
|
||||
return 6;
|
||||
|
||||
def read_unicode(self, pointer):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
process = self.valobj.GetTarget().GetProcess()
|
||||
error = lldb.SBError()
|
||||
pystr = u''
|
||||
|
@ -94,7 +94,7 @@ class CFStringSynthProvider:
|
|||
# handle the special case strings
|
||||
# only use the custom code for the tested LP64 case
|
||||
def handle_special(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
if self.is_64_bit == False:
|
||||
# for 32bit targets, use safe ObjC code
|
||||
return self.handle_unicode_string_safe()
|
||||
|
@ -112,7 +112,7 @@ class CFStringSynthProvider:
|
|||
"(char*)\"" + self.valobj.GetObjectDescription() + "\"");
|
||||
|
||||
def handle_unicode_string(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
# step 1: find offset
|
||||
if self.inline:
|
||||
pointer = self.valobj.GetValueAsUnsigned(0) + self.size_of_cfruntime_base();
|
||||
|
@ -138,14 +138,14 @@ class CFStringSynthProvider:
|
|||
return pystr.encode('utf-8')
|
||||
|
||||
def handle_inline_explicit(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
offset = 3*self.pointer_size
|
||||
offset = offset + self.valobj.GetValueAsUnsigned(0)
|
||||
return self.valobj.CreateValueFromExpression("content",
|
||||
"(char*)(" + str(offset) + ")")
|
||||
|
||||
def handle_mutable_string(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
offset = 2 * self.pointer_size
|
||||
data = self.valobj.CreateChildAtOffset("content",
|
||||
offset, self.valobj.GetType().GetBasicType(lldb.eBasicTypeChar).GetPointerType());
|
||||
|
@ -154,7 +154,7 @@ class CFStringSynthProvider:
|
|||
return self.valobj.CreateValueFromExpression("content", "(char*)(" + str(data_value) + ")")
|
||||
|
||||
def handle_UTF8_inline(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
offset = self.valobj.GetValueAsUnsigned(0) + self.size_of_cfruntime_base();
|
||||
if self.explicit == False:
|
||||
offset = offset + 1;
|
||||
|
@ -162,13 +162,13 @@ class CFStringSynthProvider:
|
|||
offset, self.valobj.GetType().GetBasicType(lldb.eBasicTypeChar)).AddressOf();
|
||||
|
||||
def handle_UTF8_not_inline(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
offset = self.size_of_cfruntime_base();
|
||||
return self.valobj.CreateChildAtOffset("content",
|
||||
offset,self.valobj.GetType().GetBasicType(lldb.eBasicTypeChar).GetPointerType());
|
||||
|
||||
def get_child_at_index(self,index):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
logger >> "Querying for child [" + str(index) + "]"
|
||||
if index == 0:
|
||||
return self.valobj.CreateValueFromExpression("mutable",
|
||||
|
@ -215,7 +215,7 @@ class CFStringSynthProvider:
|
|||
return self.handle_UTF8_not_inline();
|
||||
|
||||
def get_child_index(self,name):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
logger >> "Querying for child ['" + str(name) + "']"
|
||||
if name == "content":
|
||||
return self.num_children() - 1;
|
||||
|
@ -235,7 +235,7 @@ class CFStringSynthProvider:
|
|||
# to get its size we add up sizeof(pointer)+4
|
||||
# and then add 4 more bytes if we are on a 64bit system
|
||||
def size_of_cfruntime_base(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
return self.pointer_size+4+(4 if self.is_64_bit else 0)
|
||||
|
||||
# the info bits are part of the CFRuntimeBase structure
|
||||
|
@ -244,14 +244,14 @@ class CFStringSynthProvider:
|
|||
# on big-endian this means going to byte 3, if we are on
|
||||
# little endian (OSX & iOS), this means reading byte 0
|
||||
def offset_of_info_bits(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
offset = self.pointer_size
|
||||
if self.is_little == False:
|
||||
offset = offset + 3;
|
||||
return offset;
|
||||
|
||||
def read_info_bits(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
cfinfo = self.valobj.CreateChildAtOffset("cfinfo",
|
||||
self.offset_of_info_bits(),
|
||||
self.valobj.GetType().GetBasicType(lldb.eBasicTypeChar));
|
||||
|
@ -267,18 +267,18 @@ class CFStringSynthProvider:
|
|||
# calculating internal flag bits of the CFString object
|
||||
# this stuff is defined and discussed in CFString.c
|
||||
def is_mutable(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
return (self.info_bits & 1) == 1;
|
||||
|
||||
def is_inline(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
return (self.info_bits & 0x60) == 0;
|
||||
|
||||
# this flag's name is ambiguous, it turns out
|
||||
# we must skip a length byte to get at the data
|
||||
# when this flag is False
|
||||
def has_explicit_length(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
return (self.info_bits & (1 | 4)) != 4;
|
||||
|
||||
# probably a subclass of NSString. obtained this from [str pathExtension]
|
||||
|
@ -286,17 +286,17 @@ class CFStringSynthProvider:
|
|||
# in the long run using the isa value might be safer as a way to identify this
|
||||
# instead of reading the info_bits
|
||||
def is_special_case(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
return self.info_bits == 0;
|
||||
|
||||
def is_unicode(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
return (self.info_bits & 0x10) == 0x10;
|
||||
|
||||
# preparing ourselves to read into memory
|
||||
# by adjusting architecture-specific info
|
||||
def adjust_for_architecture(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.pointer_size = self.valobj.GetTarget().GetProcess().GetAddressByteSize()
|
||||
self.is_64_bit = self.pointer_size == 8
|
||||
self.is_little = self.valobj.GetTarget().GetProcess().GetByteOrder() == lldb.eByteOrderLittle
|
||||
|
@ -304,7 +304,7 @@ class CFStringSynthProvider:
|
|||
# reading info bits out of the CFString and computing
|
||||
# useful values to get at the real data
|
||||
def compute_flags(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.info_bits = self.read_info_bits();
|
||||
if self.info_bits == None:
|
||||
return;
|
||||
|
@ -315,6 +315,6 @@ class CFStringSynthProvider:
|
|||
self.special = self.is_special_case();
|
||||
|
||||
def update(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.adjust_for_architecture();
|
||||
self.compute_flags();
|
||||
|
|
|
@ -6,11 +6,11 @@ This file is distributed under the University of Illinois Open Source
|
|||
License. See LICENSE.TXT for details.
|
||||
"""
|
||||
import lldb
|
||||
import objc_runtime
|
||||
import Logger
|
||||
import lldb.runtime.objc.objc_runtime
|
||||
import lldb.formatters.Logger
|
||||
|
||||
def Class_Summary(valobj,dict):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
runtime = objc_runtime.ObjCRuntime.runtime_from_isa(valobj)
|
||||
if runtime == None or not runtime.is_valid():
|
||||
return '<error: unknown Class>'
|
||||
|
|
|
@ -8,12 +8,12 @@ License. See LICENSE.TXT for details.
|
|||
# summary provider for NSBundle
|
||||
import lldb
|
||||
import ctypes
|
||||
import objc_runtime
|
||||
import metrics
|
||||
import lldb.runtime.objc.objc_runtime
|
||||
import lldb.formatters.metrics
|
||||
import NSURL
|
||||
import Logger
|
||||
import lldb.formatters.Logger
|
||||
|
||||
statistics = metrics.Metrics()
|
||||
statistics = lldb.formatters.metrics.Metrics()
|
||||
statistics.add_metric('invalid_isa')
|
||||
statistics.add_metric('invalid_pointer')
|
||||
statistics.add_metric('unknown_class')
|
||||
|
@ -27,7 +27,7 @@ class NSBundleKnown_SummaryProvider:
|
|||
pass
|
||||
|
||||
def __init__(self, valobj, params):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.valobj = valobj;
|
||||
self.sys_params = params
|
||||
if not(self.sys_params.types_cache.NSString):
|
||||
|
@ -35,18 +35,18 @@ class NSBundleKnown_SummaryProvider:
|
|||
self.update();
|
||||
|
||||
def update(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.adjust_for_architecture();
|
||||
|
||||
# we need to skip the ISA, plus four other values
|
||||
# that are luckily each a pointer in size
|
||||
# which makes our computation trivial :-)
|
||||
def offset(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
return 5 * self.sys_params.pointer_size
|
||||
|
||||
def url_text(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
global statistics
|
||||
text = self.valobj.CreateChildAtOffset("text",
|
||||
self.offset(),
|
||||
|
@ -65,17 +65,17 @@ class NSBundleUnknown_SummaryProvider:
|
|||
pass
|
||||
|
||||
def __init__(self, valobj, params):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.valobj = valobj;
|
||||
self.sys_params = params
|
||||
self.update()
|
||||
|
||||
def update(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.adjust_for_architecture();
|
||||
|
||||
def url_text(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
stream = lldb.SBStream()
|
||||
self.valobj.GetExpressionPath(stream)
|
||||
expr = "(NSString*)[" + stream.GetData() + " bundlePath]"
|
||||
|
@ -86,7 +86,7 @@ class NSBundleUnknown_SummaryProvider:
|
|||
|
||||
|
||||
def GetSummary_Impl(valobj):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
global statistics
|
||||
class_data,wrapper = objc_runtime.Utilities.prepare_class_detection(valobj,statistics)
|
||||
if wrapper:
|
||||
|
@ -107,7 +107,7 @@ def GetSummary_Impl(valobj):
|
|||
return wrapper;
|
||||
|
||||
def NSBundle_SummaryProvider (valobj,dict):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
provider = GetSummary_Impl(valobj);
|
||||
if provider != None:
|
||||
if isinstance(provider,objc_runtime.SpecialSituation_Description):
|
||||
|
|
|
@ -8,11 +8,11 @@ License. See LICENSE.TXT for details.
|
|||
# summary provider for NSData
|
||||
import lldb
|
||||
import ctypes
|
||||
import objc_runtime
|
||||
import metrics
|
||||
import Logger
|
||||
import lldb.runtime.objc.objc_runtime
|
||||
import lldb.formatters.metrics
|
||||
import lldb.formatters.Logger
|
||||
|
||||
statistics = metrics.Metrics()
|
||||
statistics = lldb.formatters.metrics.Metrics()
|
||||
statistics.add_metric('invalid_isa')
|
||||
statistics.add_metric('invalid_pointer')
|
||||
statistics.add_metric('unknown_class')
|
||||
|
@ -26,7 +26,7 @@ class NSConcreteData_SummaryProvider:
|
|||
pass
|
||||
|
||||
def __init__(self, valobj, params):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
logger >> "NSConcreteData_SummaryProvider __init__"
|
||||
self.valobj = valobj;
|
||||
self.sys_params = params
|
||||
|
@ -49,7 +49,7 @@ class NSConcreteData_SummaryProvider:
|
|||
return 2 * self.sys_params.pointer_size
|
||||
|
||||
def length(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
logger >> "NSConcreteData_SummaryProvider length"
|
||||
size = self.valobj.CreateChildAtOffset("count",
|
||||
self.offset(),
|
||||
|
@ -64,7 +64,7 @@ class NSDataUnknown_SummaryProvider:
|
|||
pass
|
||||
|
||||
def __init__(self, valobj, params):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
logger >> "NSDataUnknown_SummaryProvider __init__"
|
||||
self.valobj = valobj;
|
||||
self.sys_params = params
|
||||
|
@ -74,7 +74,7 @@ class NSDataUnknown_SummaryProvider:
|
|||
self.adjust_for_architecture();
|
||||
|
||||
def length(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
logger >> "NSDataUnknown_SummaryProvider length"
|
||||
stream = lldb.SBStream()
|
||||
self.valobj.GetExpressionPath(stream)
|
||||
|
@ -90,7 +90,7 @@ class NSDataUnknown_SummaryProvider:
|
|||
|
||||
def GetSummary_Impl(valobj):
|
||||
global statistics
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
logger >> "NSData GetSummary_Impl"
|
||||
class_data,wrapper = objc_runtime.Utilities.prepare_class_detection(valobj,statistics)
|
||||
if wrapper:
|
||||
|
@ -110,7 +110,7 @@ def GetSummary_Impl(valobj):
|
|||
return wrapper;
|
||||
|
||||
def NSData_SummaryProvider (valobj,dict):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
logger >> "NSData_SummaryProvider"
|
||||
provider = GetSummary_Impl(valobj);
|
||||
logger >> "found a summary provider, it is: " + str(provider)
|
||||
|
@ -133,7 +133,7 @@ def NSData_SummaryProvider (valobj,dict):
|
|||
return 'Summary Unavailable'
|
||||
|
||||
def NSData_SummaryProvider2 (valobj,dict):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
logger >> "NSData_SummaryProvider2"
|
||||
provider = GetSummary_Impl(valobj);
|
||||
logger >> "found a summary provider, it is: " + str(provider)
|
||||
|
|
|
@ -8,15 +8,15 @@ License. See LICENSE.TXT for details.
|
|||
# summary provider for NSDate
|
||||
import lldb
|
||||
import ctypes
|
||||
import objc_runtime
|
||||
import metrics
|
||||
import lldb.runtime.objc.objc_runtime
|
||||
import lldb.formatters.metrics
|
||||
import struct
|
||||
import time
|
||||
import datetime
|
||||
import CFString
|
||||
import Logger
|
||||
import lldb.formatters.Logger
|
||||
|
||||
statistics = metrics.Metrics()
|
||||
statistics = lldb.formatters.metrics.Metrics()
|
||||
statistics.add_metric('invalid_isa')
|
||||
statistics.add_metric('invalid_pointer')
|
||||
statistics.add_metric('unknown_class')
|
||||
|
@ -29,13 +29,13 @@ python_epoch = time.gmtime(0).tm_year
|
|||
osx_epoch = datetime.date(2001,1,1).timetuple()
|
||||
|
||||
def mkgmtime(t):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
return time.mktime(t)-time.timezone
|
||||
|
||||
osx_epoch = mkgmtime(osx_epoch)
|
||||
|
||||
def osx_to_python_time(osx):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
if python_epoch <= 2001:
|
||||
return osx + osx_epoch
|
||||
else:
|
||||
|
@ -43,12 +43,12 @@ def osx_to_python_time(osx):
|
|||
|
||||
# represent a struct_time as a string in the format used by Xcode
|
||||
def xcode_format_time(X):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
return time.strftime('%Y-%m-%d %H:%M:%S %Z',X)
|
||||
|
||||
# represent a count-since-epoch as a string in the format used by Xcode
|
||||
def xcode_format_count(X):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
return xcode_format_time(time.localtime(X))
|
||||
|
||||
# despite the similary to synthetic children providers, these classes are not
|
||||
|
@ -59,7 +59,7 @@ class NSTaggedDate_SummaryProvider:
|
|||
pass
|
||||
|
||||
def __init__(self, valobj, info_bits, data, params):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.valobj = valobj;
|
||||
self.sys_params = params
|
||||
self.update();
|
||||
|
@ -68,11 +68,11 @@ class NSTaggedDate_SummaryProvider:
|
|||
self.data = ((data << 8) | (info_bits << 4))
|
||||
|
||||
def update(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.adjust_for_architecture();
|
||||
|
||||
def value(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
# the value of the date-time object is wrapped into the pointer value
|
||||
# unfortunately, it is made as a time-delta after Jan 1 2001 midnight GMT
|
||||
# while all Python knows about is the "epoch", which is a platform-dependent
|
||||
|
@ -86,7 +86,7 @@ class NSUntaggedDate_SummaryProvider:
|
|||
pass
|
||||
|
||||
def __init__(self, valobj, params):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.valobj = valobj;
|
||||
self.sys_params = params
|
||||
if not (self.sys_params.types_cache.double):
|
||||
|
@ -94,15 +94,15 @@ class NSUntaggedDate_SummaryProvider:
|
|||
self.update()
|
||||
|
||||
def update(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.adjust_for_architecture();
|
||||
|
||||
def offset(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
return self.sys_params.pointer_size
|
||||
|
||||
def value(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
value = self.valobj.CreateChildAtOffset("value",
|
||||
self.offset(),
|
||||
self.sys_params.types_cache.double)
|
||||
|
@ -114,7 +114,7 @@ class NSCalendarDate_SummaryProvider:
|
|||
pass
|
||||
|
||||
def __init__(self, valobj, params):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.valobj = valobj;
|
||||
self.sys_params = params
|
||||
if not (self.sys_params.types_cache.double):
|
||||
|
@ -122,15 +122,15 @@ class NSCalendarDate_SummaryProvider:
|
|||
self.update()
|
||||
|
||||
def update(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.adjust_for_architecture();
|
||||
|
||||
def offset(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
return 2*self.sys_params.pointer_size
|
||||
|
||||
def value(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
value = self.valobj.CreateChildAtOffset("value",
|
||||
self.offset(),
|
||||
self.sys_params.types_cache.double)
|
||||
|
@ -142,7 +142,7 @@ class NSTimeZoneClass_SummaryProvider:
|
|||
pass
|
||||
|
||||
def __init__(self, valobj, params):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.valobj = valobj;
|
||||
self.sys_params = params
|
||||
if not (self.sys_params.types_cache.voidptr):
|
||||
|
@ -150,15 +150,15 @@ class NSTimeZoneClass_SummaryProvider:
|
|||
self.update()
|
||||
|
||||
def update(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.adjust_for_architecture();
|
||||
|
||||
def offset(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
return self.sys_params.pointer_size
|
||||
|
||||
def timezone(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
tz_string = self.valobj.CreateChildAtOffset("tz_name",
|
||||
self.offset(),
|
||||
self.sys_params.types_cache.voidptr)
|
||||
|
@ -169,16 +169,16 @@ class NSUnknownDate_SummaryProvider:
|
|||
pass
|
||||
|
||||
def __init__(self, valobj):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.valobj = valobj;
|
||||
self.update()
|
||||
|
||||
def update(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.adjust_for_architecture();
|
||||
|
||||
def value(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
stream = lldb.SBStream()
|
||||
self.valobj.GetExpressionPath(stream)
|
||||
expr = "(NSString*)[" + stream.GetData() + " description]"
|
||||
|
@ -188,7 +188,7 @@ class NSUnknownDate_SummaryProvider:
|
|||
return '<variable is not NSDate>'
|
||||
|
||||
def GetSummary_Impl(valobj):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
global statistics
|
||||
class_data,wrapper = objc_runtime.Utilities.prepare_class_detection(valobj,statistics)
|
||||
if wrapper:
|
||||
|
@ -217,7 +217,7 @@ def GetSummary_Impl(valobj):
|
|||
|
||||
|
||||
def NSDate_SummaryProvider (valobj,dict):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
provider = GetSummary_Impl(valobj);
|
||||
if provider != None:
|
||||
if isinstance(provider,objc_runtime.SpecialSituation_Description):
|
||||
|
@ -232,7 +232,7 @@ def NSDate_SummaryProvider (valobj,dict):
|
|||
return 'Summary Unavailable'
|
||||
|
||||
def NSTimeZone_SummaryProvider (valobj,dict):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
provider = GetSummary_Impl(valobj);
|
||||
if provider != None:
|
||||
if isinstance(provider,objc_runtime.SpecialSituation_Description):
|
||||
|
@ -249,7 +249,7 @@ def NSTimeZone_SummaryProvider (valobj,dict):
|
|||
|
||||
|
||||
def CFAbsoluteTime_SummaryProvider (valobj,dict):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
try:
|
||||
value_double = struct.unpack('d', struct.pack('Q', valobj.GetValueAsUnsigned(0)))[0]
|
||||
return xcode_format_count(osx_to_python_time(value_double))
|
||||
|
|
|
@ -6,13 +6,13 @@ This file is distributed under the University of Illinois Open Source
|
|||
License. See LICENSE.TXT for details.
|
||||
"""
|
||||
# summary provider for class NSException
|
||||
import objc_runtime
|
||||
import metrics
|
||||
import lldb.runtime.objc.objc_runtime
|
||||
import lldb.formatters.metrics
|
||||
import CFString
|
||||
import lldb
|
||||
import Logger
|
||||
import lldb.formatters.Logger
|
||||
|
||||
statistics = metrics.Metrics()
|
||||
statistics = lldb.formatters.metrics.Metrics()
|
||||
statistics.add_metric('invalid_isa')
|
||||
statistics.add_metric('invalid_pointer')
|
||||
statistics.add_metric('unknown_class')
|
||||
|
@ -23,7 +23,7 @@ class NSKnownException_SummaryProvider:
|
|||
pass
|
||||
|
||||
def __init__(self, valobj, params):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.valobj = valobj;
|
||||
self.sys_params = params
|
||||
if not (self.sys_params.types_cache.id):
|
||||
|
@ -31,18 +31,18 @@ class NSKnownException_SummaryProvider:
|
|||
self.update();
|
||||
|
||||
def update(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.adjust_for_architecture();
|
||||
|
||||
def offset_name(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
return self.sys_params.pointer_size
|
||||
def offset_reason(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
return 2*self.sys_params.pointer_size
|
||||
|
||||
def description(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
name_ptr = self.valobj.CreateChildAtOffset("name",
|
||||
self.offset_name(),
|
||||
self.sys_params.types_cache.id)
|
||||
|
@ -56,17 +56,17 @@ class NSUnknownException_SummaryProvider:
|
|||
pass
|
||||
|
||||
def __init__(self, valobj, params):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.valobj = valobj;
|
||||
self.sys_params = params
|
||||
self.update();
|
||||
|
||||
def update(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.adjust_for_architecture();
|
||||
|
||||
def description(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
stream = lldb.SBStream()
|
||||
self.valobj.GetExpressionPath(stream)
|
||||
name_vo = self.valobj.CreateValueFromExpression("name","(NSString*)[" + stream.GetData() + " name]");
|
||||
|
@ -77,7 +77,7 @@ class NSUnknownException_SummaryProvider:
|
|||
|
||||
|
||||
def GetSummary_Impl(valobj):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
global statistics
|
||||
class_data,wrapper = objc_runtime.Utilities.prepare_class_detection(valobj,statistics)
|
||||
if wrapper:
|
||||
|
@ -95,7 +95,7 @@ def GetSummary_Impl(valobj):
|
|||
return wrapper;
|
||||
|
||||
def NSException_SummaryProvider (valobj,dict):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
provider = GetSummary_Impl(valobj);
|
||||
if provider != None:
|
||||
if isinstance(provider,objc_runtime.SpecialSituation_Description):
|
||||
|
|
|
@ -8,11 +8,11 @@ License. See LICENSE.TXT for details.
|
|||
# summary provider for NS(Mutable)IndexSet
|
||||
import lldb
|
||||
import ctypes
|
||||
import objc_runtime
|
||||
import metrics
|
||||
import Logger
|
||||
import lldb.runtime.objc.objc_runtime
|
||||
import lldb.formatters.metrics
|
||||
import lldb.formatters.Logger
|
||||
|
||||
statistics = metrics.Metrics()
|
||||
statistics = lldb.formatters.metrics.Metrics()
|
||||
statistics.add_metric('invalid_isa')
|
||||
statistics.add_metric('invalid_pointer')
|
||||
statistics.add_metric('unknown_class')
|
||||
|
@ -26,7 +26,7 @@ class NSIndexSetClass_SummaryProvider:
|
|||
pass
|
||||
|
||||
def __init__(self, valobj, params):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.valobj = valobj;
|
||||
self.sys_params = params
|
||||
if not(self.sys_params.types_cache.NSUInteger):
|
||||
|
@ -37,7 +37,7 @@ class NSIndexSetClass_SummaryProvider:
|
|||
self.update();
|
||||
|
||||
def update(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.adjust_for_architecture();
|
||||
|
||||
# NS(Mutable)IndexSet works in one of two modes: when having a compact block of data (e.g. a Range)
|
||||
|
@ -48,7 +48,7 @@ class NSIndexSetClass_SummaryProvider:
|
|||
# is set, then we are in mode 1, using that area to store flags, otherwise, the read pointer is the
|
||||
# location to go look for count in mode 2
|
||||
def count(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
mode_chooser_vo = self.valobj.CreateChildAtOffset("mode_chooser",
|
||||
2*self.sys_params.pointer_size,
|
||||
self.sys_params.types_cache.NSUInteger)
|
||||
|
@ -78,17 +78,17 @@ class NSIndexSetUnknown_SummaryProvider:
|
|||
pass
|
||||
|
||||
def __init__(self, valobj, params):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.valobj = valobj;
|
||||
self.sys_params = params
|
||||
self.update();
|
||||
|
||||
def update(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.adjust_for_architecture();
|
||||
|
||||
def count(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
stream = lldb.SBStream()
|
||||
self.valobj.GetExpressionPath(stream)
|
||||
expr = "(int)[" + stream.GetData() + " count]"
|
||||
|
@ -99,7 +99,7 @@ class NSIndexSetUnknown_SummaryProvider:
|
|||
|
||||
|
||||
def GetSummary_Impl(valobj):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
global statistics
|
||||
class_data,wrapper = objc_runtime.Utilities.prepare_class_detection(valobj,statistics)
|
||||
if wrapper:
|
||||
|
@ -118,7 +118,7 @@ def GetSummary_Impl(valobj):
|
|||
|
||||
|
||||
def NSIndexSet_SummaryProvider (valobj,dict):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
provider = GetSummary_Impl(valobj);
|
||||
if provider != None:
|
||||
if isinstance(provider,objc_runtime.SpecialSituation_Description):
|
||||
|
|
|
@ -8,11 +8,11 @@ License. See LICENSE.TXT for details.
|
|||
# summary provider for NSData
|
||||
import lldb
|
||||
import ctypes
|
||||
import objc_runtime
|
||||
import metrics
|
||||
import Logger
|
||||
import lldb.runtime.objc.objc_runtime
|
||||
import lldb.formatters.metrics
|
||||
import lldb.formatters.Logger
|
||||
|
||||
statistics = metrics.Metrics()
|
||||
statistics = lldb.formatters.metrics.Metrics()
|
||||
statistics.add_metric('invalid_isa')
|
||||
statistics.add_metric('invalid_pointer')
|
||||
statistics.add_metric('unknown_class')
|
||||
|
@ -26,7 +26,7 @@ class NSMachPortKnown_SummaryProvider:
|
|||
pass
|
||||
|
||||
def __init__(self, valobj, params):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.valobj = valobj;
|
||||
self.sys_params = params
|
||||
if not(self.sys_params.types_cache.NSUInteger):
|
||||
|
@ -37,21 +37,21 @@ class NSMachPortKnown_SummaryProvider:
|
|||
self.update();
|
||||
|
||||
def update(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.adjust_for_architecture();
|
||||
|
||||
# one pointer is the ISA
|
||||
# then we have one other internal pointer, plus
|
||||
# 4 bytes worth of flags. hence, these values
|
||||
def offset(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
if self.sys_params.is_64_bit:
|
||||
return 20
|
||||
else:
|
||||
return 12
|
||||
|
||||
def port(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
vport = self.valobj.CreateChildAtOffset("port",
|
||||
self.offset(),
|
||||
self.sys_params.types_cache.NSUInteger)
|
||||
|
@ -63,17 +63,17 @@ class NSMachPortUnknown_SummaryProvider:
|
|||
pass
|
||||
|
||||
def __init__(self, valobj, params):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.valobj = valobj;
|
||||
self.sys_params = params
|
||||
self.update();
|
||||
|
||||
def update(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.adjust_for_architecture();
|
||||
|
||||
def port(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
stream = lldb.SBStream()
|
||||
self.valobj.GetExpressionPath(stream)
|
||||
num_children_vo = self.valobj.CreateValueFromExpression("port","(int)[" + stream.GetData() + " machPort]")
|
||||
|
@ -83,7 +83,7 @@ class NSMachPortUnknown_SummaryProvider:
|
|||
|
||||
|
||||
def GetSummary_Impl(valobj):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
global statistics
|
||||
class_data,wrapper = objc_runtime.Utilities.prepare_class_detection(valobj,statistics)
|
||||
if wrapper:
|
||||
|
@ -101,7 +101,7 @@ def GetSummary_Impl(valobj):
|
|||
return wrapper;
|
||||
|
||||
def NSMachPort_SummaryProvider (valobj,dict):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
provider = GetSummary_Impl(valobj);
|
||||
if provider != None:
|
||||
if isinstance(provider,objc_runtime.SpecialSituation_Description):
|
||||
|
|
|
@ -6,13 +6,13 @@ This file is distributed under the University of Illinois Open Source
|
|||
License. See LICENSE.TXT for details.
|
||||
"""
|
||||
# summary provider for class NSNotification
|
||||
import objc_runtime
|
||||
import metrics
|
||||
import lldb.runtime.objc.objc_runtime
|
||||
import lldb.formatters.metrics
|
||||
import CFString
|
||||
import lldb
|
||||
import Logger
|
||||
import lldb.formatters.Logger
|
||||
|
||||
statistics = metrics.Metrics()
|
||||
statistics = lldb.formatters.metrics.Metrics()
|
||||
statistics.add_metric('invalid_isa')
|
||||
statistics.add_metric('invalid_pointer')
|
||||
statistics.add_metric('unknown_class')
|
||||
|
@ -23,7 +23,7 @@ class NSConcreteNotification_SummaryProvider:
|
|||
pass
|
||||
|
||||
def __init__(self, valobj, params):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.valobj = valobj;
|
||||
self.sys_params = params
|
||||
if not (self.sys_params.types_cache.id):
|
||||
|
@ -31,16 +31,16 @@ class NSConcreteNotification_SummaryProvider:
|
|||
self.update();
|
||||
|
||||
def update(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.adjust_for_architecture();
|
||||
|
||||
# skip the ISA and go to the name pointer
|
||||
def offset(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
return self.sys_params.pointer_size
|
||||
|
||||
def name(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
string_ptr = self.valobj.CreateChildAtOffset("name",
|
||||
self.offset(),
|
||||
self.sys_params.types_cache.id)
|
||||
|
@ -52,17 +52,17 @@ class NSNotificationUnknown_SummaryProvider:
|
|||
pass
|
||||
|
||||
def __init__(self, valobj, params):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.valobj = valobj;
|
||||
self.sys_params = params
|
||||
self.update()
|
||||
|
||||
def update(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.adjust_for_architecture();
|
||||
|
||||
def name(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
stream = lldb.SBStream()
|
||||
self.valobj.GetExpressionPath(stream)
|
||||
name_vo = self.valobj.CreateValueFromExpression("name","(NSString*)[" + stream.GetData() + " name]")
|
||||
|
@ -72,7 +72,7 @@ class NSNotificationUnknown_SummaryProvider:
|
|||
|
||||
|
||||
def GetSummary_Impl(valobj):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
global statistics
|
||||
class_data,wrapper = objc_runtime.Utilities.prepare_class_detection(valobj,statistics)
|
||||
if wrapper:
|
||||
|
@ -90,7 +90,7 @@ def GetSummary_Impl(valobj):
|
|||
return wrapper;
|
||||
|
||||
def NSNotification_SummaryProvider (valobj,dict):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
provider = GetSummary_Impl(valobj);
|
||||
if provider != None:
|
||||
if isinstance(provider,objc_runtime.SpecialSituation_Description):
|
||||
|
|
|
@ -8,12 +8,12 @@ License. See LICENSE.TXT for details.
|
|||
# summary provider for NSNumber
|
||||
import lldb
|
||||
import ctypes
|
||||
import objc_runtime
|
||||
import metrics
|
||||
import lldb.runtime.objc.objc_runtime
|
||||
import lldb.formatters.metrics
|
||||
import struct
|
||||
import Logger
|
||||
import lldb.formatters.Logger
|
||||
|
||||
statistics = metrics.Metrics()
|
||||
statistics = lldb.formatters.metrics.Metrics()
|
||||
statistics.add_metric('invalid_isa')
|
||||
statistics.add_metric('invalid_pointer')
|
||||
statistics.add_metric('unknown_class')
|
||||
|
@ -27,7 +27,7 @@ class NSTaggedNumber_SummaryProvider:
|
|||
pass
|
||||
|
||||
def __init__(self, valobj, info_bits, data, params):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.valobj = valobj;
|
||||
self.sys_params = params
|
||||
self.info_bits = info_bits
|
||||
|
@ -35,11 +35,11 @@ class NSTaggedNumber_SummaryProvider:
|
|||
self.update();
|
||||
|
||||
def update(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.adjust_for_architecture();
|
||||
|
||||
def value(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
# in spite of the plenty of types made available by the public NSNumber API
|
||||
# only a bunch of these are actually used in the internal implementation
|
||||
# unfortunately, the original type information appears to be lost
|
||||
|
@ -61,7 +61,7 @@ class NSUntaggedNumber_SummaryProvider:
|
|||
pass
|
||||
|
||||
def __init__(self, valobj, params):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.valobj = valobj;
|
||||
self.sys_params = params
|
||||
if not(self.sys_params.types_cache.char):
|
||||
|
@ -87,11 +87,11 @@ class NSUntaggedNumber_SummaryProvider:
|
|||
self.update();
|
||||
|
||||
def update(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.adjust_for_architecture();
|
||||
|
||||
def value(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
global statistics
|
||||
# we need to skip the ISA, then the next byte tells us what to read
|
||||
# we then skip one other full pointer worth of data and then fetch the contents
|
||||
|
@ -165,17 +165,17 @@ class NSUnknownNumber_SummaryProvider:
|
|||
pass
|
||||
|
||||
def __init__(self, valobj, params):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.valobj = valobj;
|
||||
self.sys_params = params
|
||||
self.update();
|
||||
|
||||
def update(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.adjust_for_architecture();
|
||||
|
||||
def value(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
stream = lldb.SBStream()
|
||||
self.valobj.GetExpressionPath(stream)
|
||||
expr = "(NSString*)[" + stream.GetData() + " stringValue]"
|
||||
|
@ -185,7 +185,7 @@ class NSUnknownNumber_SummaryProvider:
|
|||
return '<variable is not NSNumber>'
|
||||
|
||||
def GetSummary_Impl(valobj):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
global statistics
|
||||
class_data,wrapper = objc_runtime.Utilities.prepare_class_detection(valobj,statistics)
|
||||
if wrapper:
|
||||
|
@ -209,7 +209,7 @@ def GetSummary_Impl(valobj):
|
|||
|
||||
|
||||
def NSNumber_SummaryProvider (valobj,dict):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
provider = GetSummary_Impl(valobj);
|
||||
if provider != None:
|
||||
if isinstance(provider,objc_runtime.SpecialSituation_Description):
|
||||
|
|
|
@ -8,12 +8,12 @@ License. See LICENSE.TXT for details.
|
|||
# summary provider for NSSet
|
||||
import lldb
|
||||
import ctypes
|
||||
import objc_runtime
|
||||
import metrics
|
||||
import lldb.runtime.objc.objc_runtime
|
||||
import lldb.formatters.metrics
|
||||
import CFBag
|
||||
import Logger
|
||||
import lldb.formatters.Logger
|
||||
|
||||
statistics = metrics.Metrics()
|
||||
statistics = lldb.formatters.metrics.Metrics()
|
||||
statistics.add_metric('invalid_isa')
|
||||
statistics.add_metric('invalid_pointer')
|
||||
statistics.add_metric('unknown_class')
|
||||
|
@ -27,7 +27,7 @@ class NSCFSet_SummaryProvider:
|
|||
pass
|
||||
|
||||
def __init__(self, valobj, params):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.valobj = valobj;
|
||||
self.sys_params = params
|
||||
if not(self.sys_params.types_cache.NSUInteger):
|
||||
|
@ -38,21 +38,21 @@ class NSCFSet_SummaryProvider:
|
|||
self.update();
|
||||
|
||||
def update(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.adjust_for_architecture();
|
||||
|
||||
# one pointer is the ISA
|
||||
# then we have one other internal pointer, plus
|
||||
# 4 bytes worth of flags. hence, these values
|
||||
def offset(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
if self.sys_params.is_64_bit:
|
||||
return 20
|
||||
else:
|
||||
return 12
|
||||
|
||||
def count(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
vcount = self.valobj.CreateChildAtOffset("count",
|
||||
self.offset(),
|
||||
self.sys_params.types_cache.NSUInteger)
|
||||
|
@ -64,17 +64,17 @@ class NSSetUnknown_SummaryProvider:
|
|||
pass
|
||||
|
||||
def __init__(self, valobj, params):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.valobj = valobj;
|
||||
self.sys_params = params
|
||||
self.update();
|
||||
|
||||
def update(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.adjust_for_architecture();
|
||||
|
||||
def count(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
stream = lldb.SBStream()
|
||||
self.valobj.GetExpressionPath(stream)
|
||||
expr = "(int)[" + stream.GetData() + " count]"
|
||||
|
@ -88,7 +88,7 @@ class NSSetI_SummaryProvider:
|
|||
pass
|
||||
|
||||
def __init__(self, valobj, params):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.valobj = valobj;
|
||||
self.sys_params = params
|
||||
if not(self.sys_params.types_cache.NSUInteger):
|
||||
|
@ -99,16 +99,16 @@ class NSSetI_SummaryProvider:
|
|||
self.update();
|
||||
|
||||
def update(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.adjust_for_architecture();
|
||||
|
||||
# we just need to skip the ISA and the count immediately follows
|
||||
def offset(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
return self.sys_params.pointer_size
|
||||
|
||||
def count(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
num_children_vo = self.valobj.CreateChildAtOffset("count",
|
||||
self.offset(),
|
||||
self.sys_params.types_cache.NSUInteger)
|
||||
|
@ -129,7 +129,7 @@ class NSSetM_SummaryProvider:
|
|||
pass
|
||||
|
||||
def __init__(self, valobj, params):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.valobj = valobj;
|
||||
self.sys_params = params
|
||||
if not(self.sys_params.types_cache.NSUInteger):
|
||||
|
@ -140,16 +140,16 @@ class NSSetM_SummaryProvider:
|
|||
self.update();
|
||||
|
||||
def update(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.adjust_for_architecture();
|
||||
|
||||
# we just need to skip the ISA and the count immediately follows
|
||||
def offset(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
return self.sys_params.pointer_size
|
||||
|
||||
def count(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
num_children_vo = self.valobj.CreateChildAtOffset("count",
|
||||
self.offset(),
|
||||
self.sys_params.types_cache.NSUInteger)
|
||||
|
@ -161,7 +161,7 @@ class NSCountedSet_SummaryProvider:
|
|||
pass
|
||||
|
||||
def __init__(self, valobj, params):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.valobj = valobj;
|
||||
self.sys_params = params
|
||||
if not (self.sys_params.types_cache.voidptr):
|
||||
|
@ -169,16 +169,16 @@ class NSCountedSet_SummaryProvider:
|
|||
self.update();
|
||||
|
||||
def update(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.adjust_for_architecture();
|
||||
|
||||
# an NSCountedSet is implemented using a CFBag whose pointer just follows the ISA
|
||||
def offset(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
return self.sys_params.pointer_size
|
||||
|
||||
def count(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
cfbag_vo = self.valobj.CreateChildAtOffset("bag_impl",
|
||||
self.offset(),
|
||||
self.sys_params.types_cache.voidptr)
|
||||
|
@ -186,7 +186,7 @@ class NSCountedSet_SummaryProvider:
|
|||
|
||||
|
||||
def GetSummary_Impl(valobj):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
global statistics
|
||||
class_data,wrapper = objc_runtime.Utilities.prepare_class_detection(valobj,statistics)
|
||||
if wrapper:
|
||||
|
@ -214,7 +214,7 @@ def GetSummary_Impl(valobj):
|
|||
|
||||
|
||||
def NSSet_SummaryProvider (valobj,dict):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
provider = GetSummary_Impl(valobj);
|
||||
if provider != None:
|
||||
try:
|
||||
|
@ -231,7 +231,7 @@ def NSSet_SummaryProvider (valobj,dict):
|
|||
return 'Summary Unavailable'
|
||||
|
||||
def NSSet_SummaryProvider2 (valobj,dict):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
provider = GetSummary_Impl(valobj);
|
||||
if provider != None:
|
||||
if isinstance(provider,objc_runtime.SpecialSituation_Description):
|
||||
|
|
|
@ -8,12 +8,12 @@ License. See LICENSE.TXT for details.
|
|||
# summary provider for NSURL
|
||||
import lldb
|
||||
import ctypes
|
||||
import objc_runtime
|
||||
import metrics
|
||||
import lldb.runtime.objc.objc_runtime
|
||||
import lldb.formatters.metrics
|
||||
import CFString
|
||||
import Logger
|
||||
import lldb.formatters.Logger
|
||||
|
||||
statistics = metrics.Metrics()
|
||||
statistics = lldb.formatters.metrics.Metrics()
|
||||
statistics.add_metric('invalid_isa')
|
||||
statistics.add_metric('invalid_pointer')
|
||||
statistics.add_metric('unknown_class')
|
||||
|
@ -27,7 +27,7 @@ class NSURLKnown_SummaryProvider:
|
|||
pass
|
||||
|
||||
def __init__(self, valobj, params):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.valobj = valobj;
|
||||
self.sys_params = params
|
||||
if not(self.sys_params.types_cache.NSString):
|
||||
|
@ -37,7 +37,7 @@ class NSURLKnown_SummaryProvider:
|
|||
self.update();
|
||||
|
||||
def update(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.adjust_for_architecture();
|
||||
|
||||
# one pointer is the ISA
|
||||
|
@ -45,14 +45,14 @@ class NSURLKnown_SummaryProvider:
|
|||
# (which are also present on a 32-bit system)
|
||||
# plus another pointer, and then the real data
|
||||
def offset_text(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
return 24 if self.sys_params.is_64_bit else 16
|
||||
def offset_base(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
return self.offset_text()+self.sys_params.pointer_size
|
||||
|
||||
def url_text(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
text = self.valobj.CreateChildAtOffset("text",
|
||||
self.offset_text(),
|
||||
self.sys_params.types_cache.NSString)
|
||||
|
@ -77,17 +77,17 @@ class NSURLUnknown_SummaryProvider:
|
|||
pass
|
||||
|
||||
def __init__(self, valobj, params):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.valobj = valobj;
|
||||
self.sys_params = params
|
||||
self.update()
|
||||
|
||||
def update(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.adjust_for_architecture();
|
||||
|
||||
def url_text(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
stream = lldb.SBStream()
|
||||
self.valobj.GetExpressionPath(stream)
|
||||
url_text_vo = self.valobj.CreateValueFromExpression("url","(NSString*)[" + stream.GetData() + " description]")
|
||||
|
@ -97,7 +97,7 @@ class NSURLUnknown_SummaryProvider:
|
|||
|
||||
|
||||
def GetSummary_Impl(valobj):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
global statistics
|
||||
class_data,wrapper = objc_runtime.Utilities.prepare_class_detection(valobj,statistics)
|
||||
if wrapper:
|
||||
|
@ -115,7 +115,7 @@ def GetSummary_Impl(valobj):
|
|||
return wrapper;
|
||||
|
||||
def NSURL_SummaryProvider (valobj,dict):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
provider = GetSummary_Impl(valobj);
|
||||
if provider != None:
|
||||
if isinstance(provider,objc_runtime.SpecialSituation_Description):
|
||||
|
|
|
@ -5,12 +5,12 @@ part of The LLVM Compiler Infrastructure
|
|||
This file is distributed under the University of Illinois Open Source
|
||||
License. See LICENSE.TXT for details.
|
||||
"""
|
||||
import metrics
|
||||
import lldb.formatters.metrics
|
||||
|
||||
class Cache:
|
||||
def __init__(self):
|
||||
self.data = {}
|
||||
self.statistics = metrics.Metrics()
|
||||
self.statistics = lldb.formatters.metrics.Metrics()
|
||||
self.statistics.add_metric('hit')
|
||||
self.statistics.add_metric('miss')
|
||||
|
||||
|
|
|
@ -6,15 +6,15 @@ This file is distributed under the University of Illinois Open Source
|
|||
License. See LICENSE.TXT for details.
|
||||
"""
|
||||
import lldb
|
||||
import cache
|
||||
import attrib_fromdict
|
||||
import lldb.formatters.cache
|
||||
import lldb.formatters.attrib_fromdict
|
||||
import functools
|
||||
import Logger
|
||||
import lldb.formatters.Logger
|
||||
|
||||
class Utilities:
|
||||
@staticmethod
|
||||
def read_ascii(process, pointer,max_len=128):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
error = lldb.SBError()
|
||||
content = None
|
||||
try:
|
||||
|
@ -27,7 +27,7 @@ class Utilities:
|
|||
|
||||
@staticmethod
|
||||
def is_valid_pointer(pointer, pointer_size, allow_tagged=False, allow_NULL=False):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
if pointer == None:
|
||||
return False
|
||||
if pointer == 0:
|
||||
|
@ -40,14 +40,14 @@ class Utilities:
|
|||
# so if any pointer has bits 47 thru 63 high we know that this is not a valid isa
|
||||
@staticmethod
|
||||
def is_allowed_pointer(pointer):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
if pointer == None:
|
||||
return False
|
||||
return ((pointer & 0xFFFF800000000000) == 0)
|
||||
|
||||
@staticmethod
|
||||
def read_child_of(valobj,offset,type):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
child = valobj.CreateChildAtOffset("childUNK",offset,type)
|
||||
if child == None or child.IsValid() == False:
|
||||
return None;
|
||||
|
@ -55,7 +55,7 @@ class Utilities:
|
|||
|
||||
@staticmethod
|
||||
def is_valid_identifier(name):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
if name is None:
|
||||
return None
|
||||
if len(name) == 0:
|
||||
|
@ -70,7 +70,7 @@ class Utilities:
|
|||
|
||||
@staticmethod
|
||||
def check_is_osx_lion(target):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
# assume the only thing that has a Foundation.framework is a Mac
|
||||
# assume anything < Lion does not even exist
|
||||
mod = target.module['Foundation']
|
||||
|
@ -86,7 +86,7 @@ class Utilities:
|
|||
# returns a class_data and a wrapper (or None, if the runtime alone can't decide on a wrapper)
|
||||
@staticmethod
|
||||
def prepare_class_detection(valobj,statistics):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
class_data = ObjCRuntime(valobj)
|
||||
if class_data.is_valid() == False:
|
||||
statistics.metric_hit('invalid_pointer',valobj)
|
||||
|
@ -108,7 +108,7 @@ class Utilities:
|
|||
|
||||
class RoT_Data:
|
||||
def __init__(self,rot_pointer,params):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
if (Utilities.is_valid_pointer(rot_pointer.GetValueAsUnsigned(),params.pointer_size, allow_tagged=False)):
|
||||
self.sys_params = params
|
||||
self.valobj = rot_pointer
|
||||
|
@ -137,7 +137,7 @@ class RoT_Data:
|
|||
# pass
|
||||
|
||||
def __str__(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
return \
|
||||
"instanceSize = " + hex(self.instance_size()) + "\n" + \
|
||||
"namePointer = " + hex(self.namePointer) + " --> " + self.name
|
||||
|
@ -146,7 +146,7 @@ class RoT_Data:
|
|||
return self.valid
|
||||
|
||||
def instance_size(self,align=False):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
if self.is_valid() == False:
|
||||
return None
|
||||
if self.instanceSize == None:
|
||||
|
@ -162,7 +162,7 @@ class RoT_Data:
|
|||
|
||||
class RwT_Data:
|
||||
def __init__(self,rwt_pointer,params):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
if (Utilities.is_valid_pointer(rwt_pointer.GetValueAsUnsigned(),params.pointer_size, allow_tagged=False)):
|
||||
self.sys_params = params
|
||||
self.valobj = rwt_pointer
|
||||
|
@ -179,26 +179,26 @@ class RwT_Data:
|
|||
|
||||
# perform sanity checks on the contents of this class_rw_t
|
||||
def check_valid(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.valid = True
|
||||
if not(Utilities.is_valid_pointer(self.roPointer,self.sys_params.pointer_size,allow_tagged=False)):
|
||||
logger >> "Marking as invalid - ropointer is invalid"
|
||||
self.valid = False
|
||||
|
||||
def __str__(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
return \
|
||||
"roPointer = " + hex(self.roPointer)
|
||||
|
||||
def is_valid(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
if self.valid:
|
||||
return self.data.is_valid()
|
||||
return False
|
||||
|
||||
class Class_Data_V2:
|
||||
def __init__(self,isa_pointer,params):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
if (isa_pointer != None) and (Utilities.is_valid_pointer(isa_pointer.GetValueAsUnsigned(),params.pointer_size, allow_tagged=False)):
|
||||
self.sys_params = params
|
||||
self.valobj = isa_pointer
|
||||
|
@ -214,7 +214,7 @@ class Class_Data_V2:
|
|||
# this call tries to minimize the amount of data fetched- as soon as we have "proven"
|
||||
# that we have an invalid object, we stop reading
|
||||
def check_valid(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.valid = True
|
||||
|
||||
self.isaPointer = Utilities.read_child_of(self.valobj,0,self.sys_params.types_cache.addr_ptr_type)
|
||||
|
@ -272,7 +272,7 @@ class Class_Data_V2:
|
|||
# internally to implement the feature - this method will have no clue that a class
|
||||
# has been KVO'ed unless the standard implementation technique is used
|
||||
def is_kvo(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
if self.is_valid():
|
||||
if self.class_name().startswith("NSKVONotifying_"):
|
||||
return True
|
||||
|
@ -283,12 +283,12 @@ class Class_Data_V2:
|
|||
# which is __NSCFType (the versions without __ also exists and we are matching to it
|
||||
# just to be on the safe side)
|
||||
def is_cftype(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
if self.is_valid():
|
||||
return self.class_name() == '__NSCFType' or self.class_name() == 'NSCFType'
|
||||
|
||||
def get_superclass(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
if self.is_valid():
|
||||
parent_isa_pointer = self.valobj.CreateChildAtOffset("parent_isa",
|
||||
self.sys_params.pointer_size,
|
||||
|
@ -298,20 +298,20 @@ class Class_Data_V2:
|
|||
return None
|
||||
|
||||
def class_name(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
if self.is_valid():
|
||||
return self.data.data.name
|
||||
else:
|
||||
return None
|
||||
|
||||
def is_valid(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
if self.valid:
|
||||
return self.data.is_valid()
|
||||
return False
|
||||
|
||||
def __str__(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
return 'isaPointer = ' + hex(self.isaPointer) + "\n" + \
|
||||
"superclassIsaPointer = " + hex(self.superclassIsaPointer) + "\n" + \
|
||||
"cachePointer = " + hex(self.cachePointer) + "\n" + \
|
||||
|
@ -322,7 +322,7 @@ class Class_Data_V2:
|
|||
return False
|
||||
|
||||
def instance_size(self,align=False):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
if self.is_valid() == False:
|
||||
return None
|
||||
return self.rwt.rot.instance_size(align)
|
||||
|
@ -330,7 +330,7 @@ class Class_Data_V2:
|
|||
# runtime v1 is much less intricate than v2 and stores relevant information directly in the class_t object
|
||||
class Class_Data_V1:
|
||||
def __init__(self,isa_pointer,params):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
if (isa_pointer != None) and (Utilities.is_valid_pointer(isa_pointer.GetValueAsUnsigned(),params.pointer_size, allow_tagged=False)):
|
||||
self.valid = True
|
||||
self.sys_params = params
|
||||
|
@ -347,7 +347,7 @@ class Class_Data_V1:
|
|||
|
||||
# perform sanity checks on the contents of this class_t
|
||||
def check_valid(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.valid = True
|
||||
|
||||
self.isaPointer = Utilities.read_child_of(self.valobj,0,self.sys_params.types_cache.addr_ptr_type)
|
||||
|
@ -372,7 +372,7 @@ class Class_Data_V1:
|
|||
# internally to implement the feature - this method will have no clue that a class
|
||||
# has been KVO'ed unless the standard implementation technique is used
|
||||
def is_kvo(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
if self.is_valid():
|
||||
if self.class_name().startswith("NSKVONotifying_"):
|
||||
return True
|
||||
|
@ -383,12 +383,12 @@ class Class_Data_V1:
|
|||
# which is __NSCFType (the versions without __ also exists and we are matching to it
|
||||
# just to be on the safe side)
|
||||
def is_cftype(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
if self.is_valid():
|
||||
return self.class_name() == '__NSCFType' or self.class_name() == 'NSCFType'
|
||||
|
||||
def get_superclass(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
if self.is_valid():
|
||||
parent_isa_pointer = self.valobj.CreateChildAtOffset("parent_isa",
|
||||
self.sys_params.pointer_size,
|
||||
|
@ -398,7 +398,7 @@ class Class_Data_V1:
|
|||
return None
|
||||
|
||||
def class_name(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
if self.is_valid():
|
||||
return self.name
|
||||
else:
|
||||
|
@ -408,7 +408,7 @@ class Class_Data_V1:
|
|||
return self.valid
|
||||
|
||||
def __str__(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
return 'isaPointer = ' + hex(self.isaPointer) + "\n" + \
|
||||
"superclassIsaPointer = " + hex(self.superclassIsaPointer) + "\n" + \
|
||||
"namePointer = " + hex(self.namePointer) + " --> " + self.name + \
|
||||
|
@ -418,7 +418,7 @@ class Class_Data_V1:
|
|||
return False
|
||||
|
||||
def instance_size(self,align=False):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
if self.is_valid() == False:
|
||||
return None
|
||||
if self.instanceSize == None:
|
||||
|
@ -448,7 +448,7 @@ TaggedClass_Values_NMOS = {0: 'NSAtom', \
|
|||
|
||||
class TaggedClass_Data:
|
||||
def __init__(self,pointer,params):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
global TaggedClass_Values_Lion,TaggedClass_Values_NMOS
|
||||
self.valid = True
|
||||
self.name = None
|
||||
|
@ -476,7 +476,7 @@ class TaggedClass_Data:
|
|||
return self.valid
|
||||
|
||||
def class_name(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
if self.is_valid():
|
||||
return self.name
|
||||
else:
|
||||
|
@ -506,7 +506,7 @@ class TaggedClass_Data:
|
|||
|
||||
# it seems reasonable to say that a tagged pointer is the size of a pointer
|
||||
def instance_size(self,align=False):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
if self.is_valid() == False:
|
||||
return None
|
||||
return self.sys_params.pointer_size
|
||||
|
@ -557,19 +557,19 @@ class Version:
|
|||
(self.release == other.release) and \
|
||||
(self.build_string == other.build_string)
|
||||
|
||||
runtime_version = cache.Cache()
|
||||
os_version = cache.Cache()
|
||||
types_caches = cache.Cache()
|
||||
isa_caches = cache.Cache()
|
||||
runtime_version = lldb.formatters.cache.Cache()
|
||||
os_version = lldb.formatters.cache.Cache()
|
||||
types_caches = lldb.formatters.cache.Cache()
|
||||
isa_caches = lldb.formatters.cache.Cache()
|
||||
|
||||
class SystemParameters:
|
||||
def __init__(self,valobj):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.adjust_for_architecture(valobj)
|
||||
self.adjust_for_process(valobj)
|
||||
|
||||
def adjust_for_process(self, valobj):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
global runtime_version
|
||||
global os_version
|
||||
global types_caches
|
||||
|
@ -602,7 +602,7 @@ class SystemParameters:
|
|||
if isa_caches.look_for_key(self.pid):
|
||||
self.isa_cache = isa_caches.get_value(self.pid)
|
||||
else:
|
||||
self.isa_cache = cache.Cache()
|
||||
self.isa_cache = lldb.formatters.cache.Cache()
|
||||
isa_caches.add_item(self.pid,self.isa_cache)
|
||||
|
||||
def adjust_for_architecture(self,valobj):
|
||||
|
@ -628,7 +628,7 @@ class ObjCRuntime:
|
|||
# of a well-known section only present in v1
|
||||
@staticmethod
|
||||
def runtime_version(process):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
if process.IsValid() == False:
|
||||
logger >> "No process - bailing out"
|
||||
return None
|
||||
|
@ -658,13 +658,13 @@ class ObjCRuntime:
|
|||
|
||||
@staticmethod
|
||||
def runtime_from_isa(isa):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
runtime = ObjCRuntime(isa)
|
||||
runtime.isa = isa
|
||||
return runtime
|
||||
|
||||
def __init__(self,valobj):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
self.valobj = valobj
|
||||
self.adjust_for_architecture()
|
||||
self.sys_params = SystemParameters(self.valobj)
|
||||
|
@ -676,14 +676,14 @@ class ObjCRuntime:
|
|||
|
||||
# an ObjC pointer can either be tagged or must be aligned
|
||||
def is_tagged(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
if self.valobj is None:
|
||||
return False
|
||||
return (Utilities.is_valid_pointer(self.unsigned_value,self.sys_params.pointer_size, allow_tagged=True) and \
|
||||
not(Utilities.is_valid_pointer(self.unsigned_value,self.sys_params.pointer_size, allow_tagged=False)))
|
||||
|
||||
def is_valid(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
if self.valobj is None:
|
||||
return False
|
||||
if self.valobj.IsInScope() == False:
|
||||
|
@ -694,7 +694,7 @@ class ObjCRuntime:
|
|||
return self.unsigned_value == 0
|
||||
|
||||
def read_isa(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
if self.isa_value != None:
|
||||
logger >> "using cached isa"
|
||||
return self.isa_value
|
||||
|
@ -711,7 +711,7 @@ class ObjCRuntime:
|
|||
return isa_pointer
|
||||
|
||||
def read_class_data(self):
|
||||
logger = Logger.Logger()
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
global isa_cache
|
||||
if self.is_tagged():
|
||||
# tagged pointers only exist in ObjC v2
|
||||
|
|
|
@ -303,7 +303,7 @@ ScriptInterpreterPython::ScriptInterpreterPython (CommandInterpreter &interprete
|
|||
// and letting the individual formatter classes exploit APIs to check whether they can/cannot do their task
|
||||
run_string.Clear();
|
||||
//run_string.Printf ("run_one_line (%s, 'from lldb.formatters import *; from lldb.formatters.objc import *; from lldb.formatters.cpp import *')", m_dictionary_name.c_str());
|
||||
run_string.Printf ("run_one_line (%s, 'from lldb.formatters import *')", m_dictionary_name.c_str());
|
||||
run_string.Printf ("run_one_line (%s, 'import lldb.formatters.cache, lldb.formatters.Logger, lldb.formatters.attrib_fromdict, lldb.formatters.metrics')", m_dictionary_name.c_str());
|
||||
PyRun_SimpleString (run_string.GetData());
|
||||
|
||||
int new_count = Debugger::TestDebuggerRefCount();
|
||||
|
|
Loading…
Reference in New Issue