forked from OSchip/llvm-project
parent
85ce21c04d
commit
eb36cadb68
|
@ -10,28 +10,28 @@ import lldb.formatters.Logger
|
||||||
class StdListSynthProvider:
|
class StdListSynthProvider:
|
||||||
|
|
||||||
def __init__(self, valobj, dict):
|
def __init__(self, valobj, dict):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
self.valobj = valobj
|
self.valobj = valobj
|
||||||
self.count = None
|
self.count = None
|
||||||
logger >> "Providing synthetic children for a map named " + str(valobj.GetName())
|
logger >> "Providing synthetic children for a map named " + str(valobj.GetName())
|
||||||
|
|
||||||
def next_node(self,node):
|
def next_node(self,node):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
return node.GetChildMemberWithName('_M_next')
|
return node.GetChildMemberWithName('_M_next')
|
||||||
|
|
||||||
def is_valid(self,node):
|
def is_valid(self,node):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
return self.value(self.next_node(node)) != self.node_address
|
return self.value(self.next_node(node)) != self.node_address
|
||||||
|
|
||||||
def value(self,node):
|
def value(self,node):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
return node.GetValueAsUnsigned()
|
return node.GetValueAsUnsigned()
|
||||||
|
|
||||||
# Floyd's cyle-finding algorithm
|
# Floyd's cyle-finding algorithm
|
||||||
# try to detect if this list has a loop
|
# try to detect if this list has a loop
|
||||||
def has_loop(self):
|
def has_loop(self):
|
||||||
global _list_uses_loop_detector
|
global _list_uses_loop_detector
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
if _list_uses_loop_detector == False:
|
if _list_uses_loop_detector == False:
|
||||||
logger >> "Asked not to use loop detection"
|
logger >> "Asked not to use loop detection"
|
||||||
return False
|
return False
|
||||||
|
@ -49,7 +49,7 @@ class StdListSynthProvider:
|
||||||
|
|
||||||
def num_children(self):
|
def num_children(self):
|
||||||
global _list_capping_size
|
global _list_capping_size
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
if self.count == None:
|
if self.count == None:
|
||||||
self.count = self.num_children_impl()
|
self.count = self.num_children_impl()
|
||||||
if self.count > _list_capping_size:
|
if self.count > _list_capping_size:
|
||||||
|
@ -57,7 +57,7 @@ class StdListSynthProvider:
|
||||||
return self.count
|
return self.count
|
||||||
|
|
||||||
def num_children_impl(self):
|
def num_children_impl(self):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
global _list_capping_size
|
global _list_capping_size
|
||||||
try:
|
try:
|
||||||
next_val = self.next.GetValueAsUnsigned(0)
|
next_val = self.next.GetValueAsUnsigned(0)
|
||||||
|
@ -83,14 +83,14 @@ class StdListSynthProvider:
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
def get_child_index(self,name):
|
def get_child_index(self,name):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
try:
|
try:
|
||||||
return int(name.lstrip('[').rstrip(']'))
|
return int(name.lstrip('[').rstrip(']'))
|
||||||
except:
|
except:
|
||||||
return -1
|
return -1
|
||||||
|
|
||||||
def get_child_at_index(self,index):
|
def get_child_at_index(self,index):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
logger >> "Fetching child " + str(index)
|
logger >> "Fetching child " + str(index)
|
||||||
if index < 0:
|
if index < 0:
|
||||||
return None;
|
return None;
|
||||||
|
@ -107,7 +107,7 @@ class StdListSynthProvider:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def extract_type(self):
|
def extract_type(self):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
list_type = self.valobj.GetType().GetUnqualifiedType()
|
list_type = self.valobj.GetType().GetUnqualifiedType()
|
||||||
if list_type.IsReferenceType():
|
if list_type.IsReferenceType():
|
||||||
list_type = list_type.GetDereferencedType()
|
list_type = list_type.GetDereferencedType()
|
||||||
|
@ -118,7 +118,7 @@ class StdListSynthProvider:
|
||||||
return data_type
|
return data_type
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
# preemptively setting this to None - we might end up changing our mind later
|
# preemptively setting this to None - we might end up changing our mind later
|
||||||
self.count = None
|
self.count = None
|
||||||
try:
|
try:
|
||||||
|
@ -135,25 +135,25 @@ class StdListSynthProvider:
|
||||||
class StdVectorSynthProvider:
|
class StdVectorSynthProvider:
|
||||||
|
|
||||||
def __init__(self, valobj, dict):
|
def __init__(self, valobj, dict):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
self.count = None
|
self.count = None
|
||||||
self.valobj = valobj
|
self.valobj = valobj
|
||||||
logger >> "Providing synthetic children for a map named " + str(valobj.GetName())
|
logger >> "Providing synthetic children for a map named " + str(valobj.GetName())
|
||||||
|
|
||||||
def num_children(self):
|
def num_children(self):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
if self.count == None:
|
if self.count == None:
|
||||||
self.count = self.num_children_impl()
|
self.count = self.num_children_impl()
|
||||||
return self.count
|
return self.count
|
||||||
|
|
||||||
def is_valid_pointer(ptr,process):
|
def is_valid_pointer(ptr,process):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
error = lldb.SBError()
|
error = lldb.SBError()
|
||||||
process.ReadMemory(ptr,1,error)
|
process.ReadMemory(ptr,1,error)
|
||||||
return False if error.Fail() else True
|
return False if error.Fail() else True
|
||||||
|
|
||||||
def num_children_impl(self):
|
def num_children_impl(self):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
try:
|
try:
|
||||||
start_val = self.start.GetValueAsUnsigned(0)
|
start_val = self.start.GetValueAsUnsigned(0)
|
||||||
finish_val = self.finish.GetValueAsUnsigned(0)
|
finish_val = self.finish.GetValueAsUnsigned(0)
|
||||||
|
@ -188,14 +188,14 @@ class StdVectorSynthProvider:
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
def get_child_index(self,name):
|
def get_child_index(self,name):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
try:
|
try:
|
||||||
return int(name.lstrip('[').rstrip(']'))
|
return int(name.lstrip('[').rstrip(']'))
|
||||||
except:
|
except:
|
||||||
return -1
|
return -1
|
||||||
|
|
||||||
def get_child_at_index(self,index):
|
def get_child_at_index(self,index):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
logger >> "Retrieving child " + str(index)
|
logger >> "Retrieving child " + str(index)
|
||||||
if index < 0:
|
if index < 0:
|
||||||
return None;
|
return None;
|
||||||
|
@ -208,7 +208,7 @@ class StdVectorSynthProvider:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
# preemptively setting this to None - we might end up changing our mind later
|
# preemptively setting this to None - we might end up changing our mind later
|
||||||
self.count = None
|
self.count = None
|
||||||
try:
|
try:
|
||||||
|
@ -230,7 +230,7 @@ class StdVectorSynthProvider:
|
||||||
class StdMapSynthProvider:
|
class StdMapSynthProvider:
|
||||||
|
|
||||||
def __init__(self, valobj, dict):
|
def __init__(self, valobj, dict):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
self.valobj = valobj;
|
self.valobj = valobj;
|
||||||
self.count = None
|
self.count = None
|
||||||
logger >> "Providing synthetic children for a map named " + str(valobj.GetName())
|
logger >> "Providing synthetic children for a map named " + str(valobj.GetName())
|
||||||
|
@ -243,7 +243,7 @@ class StdMapSynthProvider:
|
||||||
# to replace the longer versions of std::string with the shorter one in order to be able
|
# to replace the longer versions of std::string with the shorter one in order to be able
|
||||||
# to find the type name
|
# to find the type name
|
||||||
def fixup_class_name(self, class_name):
|
def fixup_class_name(self, class_name):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
if class_name == 'std::basic_string<char, std::char_traits<char>, std::allocator<char> >':
|
if class_name == 'std::basic_string<char, std::char_traits<char>, std::allocator<char> >':
|
||||||
return 'std::basic_string<char>',True
|
return 'std::basic_string<char>',True
|
||||||
if class_name == 'basic_string<char, std::char_traits<char>, std::allocator<char> >':
|
if class_name == 'basic_string<char, std::char_traits<char>, std::allocator<char> >':
|
||||||
|
@ -255,7 +255,7 @@ class StdMapSynthProvider:
|
||||||
return class_name,False
|
return class_name,False
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
# preemptively setting this to None - we might end up changing our mind later
|
# preemptively setting this to None - we might end up changing our mind later
|
||||||
self.count = None
|
self.count = None
|
||||||
try:
|
try:
|
||||||
|
@ -313,7 +313,7 @@ class StdMapSynthProvider:
|
||||||
|
|
||||||
def num_children(self):
|
def num_children(self):
|
||||||
global _map_capping_size
|
global _map_capping_size
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
if self.count == None:
|
if self.count == None:
|
||||||
self.count = self.num_children_impl()
|
self.count = self.num_children_impl()
|
||||||
if self.count > _map_capping_size:
|
if self.count > _map_capping_size:
|
||||||
|
@ -321,7 +321,7 @@ class StdMapSynthProvider:
|
||||||
return self.count
|
return self.count
|
||||||
|
|
||||||
def num_children_impl(self):
|
def num_children_impl(self):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
try:
|
try:
|
||||||
root_ptr_val = self.node_ptr_value(self.Mroot)
|
root_ptr_val = self.node_ptr_value(self.Mroot)
|
||||||
if root_ptr_val == 0:
|
if root_ptr_val == 0:
|
||||||
|
@ -333,14 +333,14 @@ class StdMapSynthProvider:
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
def get_child_index(self,name):
|
def get_child_index(self,name):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
try:
|
try:
|
||||||
return int(name.lstrip('[').rstrip(']'))
|
return int(name.lstrip('[').rstrip(']'))
|
||||||
except:
|
except:
|
||||||
return -1
|
return -1
|
||||||
|
|
||||||
def get_child_at_index(self,index):
|
def get_child_at_index(self,index):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
logger >> "Being asked to fetch child[" + str(index) + "]"
|
logger >> "Being asked to fetch child[" + str(index) + "]"
|
||||||
if index < 0:
|
if index < 0:
|
||||||
return None
|
return None
|
||||||
|
@ -362,24 +362,24 @@ class StdMapSynthProvider:
|
||||||
|
|
||||||
# utility functions
|
# utility functions
|
||||||
def node_ptr_value(self,node):
|
def node_ptr_value(self,node):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
return node.GetValueAsUnsigned(0)
|
return node.GetValueAsUnsigned(0)
|
||||||
|
|
||||||
def right(self,node):
|
def right(self,node):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
return node.GetChildMemberWithName("_M_right");
|
return node.GetChildMemberWithName("_M_right");
|
||||||
|
|
||||||
def left(self,node):
|
def left(self,node):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
return node.GetChildMemberWithName("_M_left");
|
return node.GetChildMemberWithName("_M_left");
|
||||||
|
|
||||||
def parent(self,node):
|
def parent(self,node):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
return node.GetChildMemberWithName("_M_parent");
|
return node.GetChildMemberWithName("_M_parent");
|
||||||
|
|
||||||
# from libstdc++ implementation of iterator for rbtree
|
# from libstdc++ implementation of iterator for rbtree
|
||||||
def increment_node(self,node):
|
def increment_node(self,node):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
max_steps = self.num_children()
|
max_steps = self.num_children()
|
||||||
if self.node_ptr_value(self.right(node)) != 0:
|
if self.node_ptr_value(self.right(node)) != 0:
|
||||||
x = self.right(node);
|
x = self.right(node);
|
||||||
|
|
|
@ -28,7 +28,7 @@ def extract_short_size(value):
|
||||||
# no external significance - we access them by index since this saves a name lookup that would add
|
# no external significance - we access them by index since this saves a name lookup that would add
|
||||||
# no information for readers of the code, but when possible try to use meaningful variable names
|
# no information for readers of the code, but when possible try to use meaningful variable names
|
||||||
def stdstring_SummaryProvider(valobj,dict):
|
def stdstring_SummaryProvider(valobj,dict):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
r = valobj.GetChildAtIndex(0)
|
r = valobj.GetChildAtIndex(0)
|
||||||
B = r.GetChildAtIndex(0)
|
B = r.GetChildAtIndex(0)
|
||||||
first = B.GetChildAtIndex(0)
|
first = B.GetChildAtIndex(0)
|
||||||
|
@ -57,11 +57,11 @@ def stdstring_SummaryProvider(valobj,dict):
|
||||||
class stdvector_SynthProvider:
|
class stdvector_SynthProvider:
|
||||||
|
|
||||||
def __init__(self, valobj, dict):
|
def __init__(self, valobj, dict):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
self.valobj = valobj;
|
self.valobj = valobj;
|
||||||
|
|
||||||
def num_children(self):
|
def num_children(self):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
try:
|
try:
|
||||||
start_val = self.start.GetValueAsUnsigned(0)
|
start_val = self.start.GetValueAsUnsigned(0)
|
||||||
finish_val = self.finish.GetValueAsUnsigned(0)
|
finish_val = self.finish.GetValueAsUnsigned(0)
|
||||||
|
@ -89,14 +89,14 @@ class stdvector_SynthProvider:
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
def get_child_index(self,name):
|
def get_child_index(self,name):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
try:
|
try:
|
||||||
return int(name.lstrip('[').rstrip(']'))
|
return int(name.lstrip('[').rstrip(']'))
|
||||||
except:
|
except:
|
||||||
return -1
|
return -1
|
||||||
|
|
||||||
def get_child_at_index(self,index):
|
def get_child_at_index(self,index):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
logger >> "Retrieving child " + str(index)
|
logger >> "Retrieving child " + str(index)
|
||||||
if index < 0:
|
if index < 0:
|
||||||
return None;
|
return None;
|
||||||
|
@ -109,7 +109,7 @@ class stdvector_SynthProvider:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
try:
|
try:
|
||||||
self.start = self.valobj.GetChildMemberWithName('__begin_')
|
self.start = self.valobj.GetChildMemberWithName('__begin_')
|
||||||
self.finish = self.valobj.GetChildMemberWithName('__end_')
|
self.finish = self.valobj.GetChildMemberWithName('__end_')
|
||||||
|
@ -129,27 +129,27 @@ def stdvector_SummaryProvider(valobj,dict):
|
||||||
class stdlist_entry:
|
class stdlist_entry:
|
||||||
|
|
||||||
def __init__(self,entry):
|
def __init__(self,entry):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
self.entry = entry
|
self.entry = entry
|
||||||
|
|
||||||
def _next_impl(self):
|
def _next_impl(self):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
return stdlist_entry(self.entry.GetChildMemberWithName('__next_'))
|
return stdlist_entry(self.entry.GetChildMemberWithName('__next_'))
|
||||||
|
|
||||||
def _prev_impl(self):
|
def _prev_impl(self):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
return stdlist_entry(self.entry.GetChildMemberWithName('__prev_'))
|
return stdlist_entry(self.entry.GetChildMemberWithName('__prev_'))
|
||||||
|
|
||||||
def _value_impl(self):
|
def _value_impl(self):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
return self.entry.GetValueAsUnsigned(0)
|
return self.entry.GetValueAsUnsigned(0)
|
||||||
|
|
||||||
def _isnull_impl(self):
|
def _isnull_impl(self):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
return self._value_impl() == 0
|
return self._value_impl() == 0
|
||||||
|
|
||||||
def _sbvalue_impl(self):
|
def _sbvalue_impl(self):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
return self.entry
|
return self.entry
|
||||||
|
|
||||||
next = property(_next_impl,None)
|
next = property(_next_impl,None)
|
||||||
|
@ -160,21 +160,21 @@ class stdlist_entry:
|
||||||
class stdlist_iterator:
|
class stdlist_iterator:
|
||||||
|
|
||||||
def increment_node(self,node):
|
def increment_node(self,node):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
if node.is_null:
|
if node.is_null:
|
||||||
return None
|
return None
|
||||||
return node.next
|
return node.next
|
||||||
|
|
||||||
def __init__(self,node):
|
def __init__(self,node):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
self.node = stdlist_entry(node) # we convert the SBValue to an internal node object on entry
|
self.node = stdlist_entry(node) # we convert the SBValue to an internal node object on entry
|
||||||
|
|
||||||
def value(self):
|
def value(self):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
return self.node.sbvalue # and return the SBValue back on exit
|
return self.node.sbvalue # and return the SBValue back on exit
|
||||||
|
|
||||||
def next(self):
|
def next(self):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
node = self.increment_node(self.node)
|
node = self.increment_node(self.node)
|
||||||
if node != None and node.sbvalue.IsValid() and not(node.is_null):
|
if node != None and node.sbvalue.IsValid() and not(node.is_null):
|
||||||
self.node = node
|
self.node = node
|
||||||
|
@ -183,7 +183,7 @@ class stdlist_iterator:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def advance(self,N):
|
def advance(self,N):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
if N < 0:
|
if N < 0:
|
||||||
return None
|
return None
|
||||||
if N == 0:
|
if N == 0:
|
||||||
|
@ -198,22 +198,22 @@ class stdlist_iterator:
|
||||||
|
|
||||||
class stdlist_SynthProvider:
|
class stdlist_SynthProvider:
|
||||||
def __init__(self, valobj, dict):
|
def __init__(self, valobj, dict):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
self.valobj = valobj
|
self.valobj = valobj
|
||||||
|
|
||||||
def next_node(self,node):
|
def next_node(self,node):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
return node.GetChildMemberWithName('__next_')
|
return node.GetChildMemberWithName('__next_')
|
||||||
|
|
||||||
def value(self,node):
|
def value(self,node):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
return node.GetValueAsUnsigned()
|
return node.GetValueAsUnsigned()
|
||||||
|
|
||||||
# Floyd's cyle-finding algorithm
|
# Floyd's cyle-finding algorithm
|
||||||
# try to detect if this list has a loop
|
# try to detect if this list has a loop
|
||||||
def has_loop(self):
|
def has_loop(self):
|
||||||
global _list_uses_loop_detector
|
global _list_uses_loop_detector
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
if _list_uses_loop_detector == False:
|
if _list_uses_loop_detector == False:
|
||||||
logger >> "Asked not to use loop detection"
|
logger >> "Asked not to use loop detection"
|
||||||
return False
|
return False
|
||||||
|
@ -231,7 +231,7 @@ class stdlist_SynthProvider:
|
||||||
|
|
||||||
def num_children(self):
|
def num_children(self):
|
||||||
global _list_capping_size
|
global _list_capping_size
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
if self.count == None:
|
if self.count == None:
|
||||||
self.count = self.num_children_impl()
|
self.count = self.num_children_impl()
|
||||||
if self.count > _list_capping_size:
|
if self.count > _list_capping_size:
|
||||||
|
@ -240,7 +240,7 @@ class stdlist_SynthProvider:
|
||||||
|
|
||||||
def num_children_impl(self):
|
def num_children_impl(self):
|
||||||
global _list_capping_size
|
global _list_capping_size
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
try:
|
try:
|
||||||
next_val = self.head.GetValueAsUnsigned(0)
|
next_val = self.head.GetValueAsUnsigned(0)
|
||||||
prev_val = self.tail.GetValueAsUnsigned(0)
|
prev_val = self.tail.GetValueAsUnsigned(0)
|
||||||
|
@ -265,14 +265,14 @@ class stdlist_SynthProvider:
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
def get_child_index(self,name):
|
def get_child_index(self,name):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
try:
|
try:
|
||||||
return int(name.lstrip('[').rstrip(']'))
|
return int(name.lstrip('[').rstrip(']'))
|
||||||
except:
|
except:
|
||||||
return -1
|
return -1
|
||||||
|
|
||||||
def get_child_at_index(self,index):
|
def get_child_at_index(self,index):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
logger >> "Fetching child " + str(index)
|
logger >> "Fetching child " + str(index)
|
||||||
if index < 0:
|
if index < 0:
|
||||||
return None;
|
return None;
|
||||||
|
@ -290,7 +290,7 @@ class stdlist_SynthProvider:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def extract_type(self):
|
def extract_type(self):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
list_type = self.valobj.GetType().GetUnqualifiedType()
|
list_type = self.valobj.GetType().GetUnqualifiedType()
|
||||||
if list_type.IsReferenceType():
|
if list_type.IsReferenceType():
|
||||||
list_type = list_type.GetDereferencedType()
|
list_type = list_type.GetDereferencedType()
|
||||||
|
@ -301,7 +301,7 @@ class stdlist_SynthProvider:
|
||||||
return data_type
|
return data_type
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
self.count = None
|
self.count = None
|
||||||
try:
|
try:
|
||||||
impl = self.valobj.GetChildMemberWithName('__end_')
|
impl = self.valobj.GetChildMemberWithName('__end_')
|
||||||
|
@ -321,31 +321,31 @@ def stdlist_SummaryProvider(valobj,dict):
|
||||||
# a tree node - this class makes the syntax in the actual iterator nicer to read and maintain
|
# a tree node - this class makes the syntax in the actual iterator nicer to read and maintain
|
||||||
class stdmap_iterator_node:
|
class stdmap_iterator_node:
|
||||||
def _left_impl(self):
|
def _left_impl(self):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
return stdmap_iterator_node(self.node.GetChildMemberWithName("__left_"))
|
return stdmap_iterator_node(self.node.GetChildMemberWithName("__left_"))
|
||||||
|
|
||||||
def _right_impl(self):
|
def _right_impl(self):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
return stdmap_iterator_node(self.node.GetChildMemberWithName("__right_"))
|
return stdmap_iterator_node(self.node.GetChildMemberWithName("__right_"))
|
||||||
|
|
||||||
def _parent_impl(self):
|
def _parent_impl(self):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
return stdmap_iterator_node(self.node.GetChildMemberWithName("__parent_"))
|
return stdmap_iterator_node(self.node.GetChildMemberWithName("__parent_"))
|
||||||
|
|
||||||
def _value_impl(self):
|
def _value_impl(self):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
return self.node.GetValueAsUnsigned(0)
|
return self.node.GetValueAsUnsigned(0)
|
||||||
|
|
||||||
def _sbvalue_impl(self):
|
def _sbvalue_impl(self):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
return self.node
|
return self.node
|
||||||
|
|
||||||
def _null_impl(self):
|
def _null_impl(self):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
return self.value == 0
|
return self.value == 0
|
||||||
|
|
||||||
def __init__(self,node):
|
def __init__(self,node):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
self.node = node
|
self.node = node
|
||||||
|
|
||||||
left = property(_left_impl,None)
|
left = property(_left_impl,None)
|
||||||
|
@ -359,7 +359,7 @@ class stdmap_iterator_node:
|
||||||
class stdmap_iterator:
|
class stdmap_iterator:
|
||||||
|
|
||||||
def tree_min(self,x):
|
def tree_min(self,x):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
steps = 0
|
steps = 0
|
||||||
if x.is_null:
|
if x.is_null:
|
||||||
return None
|
return None
|
||||||
|
@ -372,7 +372,7 @@ class stdmap_iterator:
|
||||||
return x
|
return x
|
||||||
|
|
||||||
def tree_max(self,x):
|
def tree_max(self,x):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
if x.is_null:
|
if x.is_null:
|
||||||
return None
|
return None
|
||||||
while (not x.right.is_null):
|
while (not x.right.is_null):
|
||||||
|
@ -380,13 +380,13 @@ class stdmap_iterator:
|
||||||
return x
|
return x
|
||||||
|
|
||||||
def tree_is_left_child(self,x):
|
def tree_is_left_child(self,x):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
if x.is_null:
|
if x.is_null:
|
||||||
return None
|
return None
|
||||||
return True if x.value == x.parent.left.value else False
|
return True if x.value == x.parent.left.value else False
|
||||||
|
|
||||||
def increment_node(self,node):
|
def increment_node(self,node):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
if node.is_null:
|
if node.is_null:
|
||||||
return None
|
return None
|
||||||
if not node.right.is_null:
|
if not node.right.is_null:
|
||||||
|
@ -401,16 +401,16 @@ class stdmap_iterator:
|
||||||
return node.parent
|
return node.parent
|
||||||
|
|
||||||
def __init__(self,node,max_count=0):
|
def __init__(self,node,max_count=0):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
self.node = stdmap_iterator_node(node) # we convert the SBValue to an internal node object on entry
|
self.node = stdmap_iterator_node(node) # we convert the SBValue to an internal node object on entry
|
||||||
self.max_count = max_count
|
self.max_count = max_count
|
||||||
|
|
||||||
def value(self):
|
def value(self):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
return self.node.sbvalue # and return the SBValue back on exit
|
return self.node.sbvalue # and return the SBValue back on exit
|
||||||
|
|
||||||
def next(self):
|
def next(self):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
node = self.increment_node(self.node)
|
node = self.increment_node(self.node)
|
||||||
if node != None and node.sbvalue.IsValid() and not(node.is_null):
|
if node != None and node.sbvalue.IsValid() and not(node.is_null):
|
||||||
self.node = node
|
self.node = node
|
||||||
|
@ -419,7 +419,7 @@ class stdmap_iterator:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def advance(self,N):
|
def advance(self,N):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
if N < 0:
|
if N < 0:
|
||||||
return None
|
return None
|
||||||
if N == 0:
|
if N == 0:
|
||||||
|
@ -435,12 +435,12 @@ class stdmap_iterator:
|
||||||
class stdmap_SynthProvider:
|
class stdmap_SynthProvider:
|
||||||
|
|
||||||
def __init__(self, valobj, dict):
|
def __init__(self, valobj, dict):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
self.valobj = valobj;
|
self.valobj = valobj;
|
||||||
self.pointer_size = self.valobj.GetProcess().GetAddressByteSize()
|
self.pointer_size = self.valobj.GetProcess().GetAddressByteSize()
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
self.count = None
|
self.count = None
|
||||||
try:
|
try:
|
||||||
# we will set this to True if we find out that discovering a node in the map takes more steps than the overall size of the RB tree
|
# we will set this to True if we find out that discovering a node in the map takes more steps than the overall size of the RB tree
|
||||||
|
@ -458,7 +458,7 @@ class stdmap_SynthProvider:
|
||||||
|
|
||||||
def num_children(self):
|
def num_children(self):
|
||||||
global _map_capping_size
|
global _map_capping_size
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
if self.count == None:
|
if self.count == None:
|
||||||
self.count = self.num_children_impl()
|
self.count = self.num_children_impl()
|
||||||
if self.count > _map_capping_size:
|
if self.count > _map_capping_size:
|
||||||
|
@ -466,14 +466,14 @@ class stdmap_SynthProvider:
|
||||||
return self.count
|
return self.count
|
||||||
|
|
||||||
def num_children_impl(self):
|
def num_children_impl(self):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
try:
|
try:
|
||||||
return self.valobj.GetChildMemberWithName('__tree_').GetChildMemberWithName('__pair3_').GetChildMemberWithName('__first_').GetValueAsUnsigned()
|
return self.valobj.GetChildMemberWithName('__tree_').GetChildMemberWithName('__pair3_').GetChildMemberWithName('__first_').GetValueAsUnsigned()
|
||||||
except:
|
except:
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
def get_data_type(self):
|
def get_data_type(self):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
if self.data_type == None or self.data_size == None:
|
if self.data_type == None or self.data_size == None:
|
||||||
if self.num_children() == 0:
|
if self.num_children() == 0:
|
||||||
return False
|
return False
|
||||||
|
@ -491,7 +491,7 @@ class stdmap_SynthProvider:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def get_value_offset(self,node):
|
def get_value_offset(self,node):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
if self.skip_size == None:
|
if self.skip_size == None:
|
||||||
node_type = node.GetType()
|
node_type = node.GetType()
|
||||||
fields_count = node_type.GetNumberOfFields()
|
fields_count = node_type.GetNumberOfFields()
|
||||||
|
@ -503,14 +503,14 @@ class stdmap_SynthProvider:
|
||||||
return (self.skip_size != None)
|
return (self.skip_size != None)
|
||||||
|
|
||||||
def get_child_index(self,name):
|
def get_child_index(self,name):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
try:
|
try:
|
||||||
return int(name.lstrip('[').rstrip(']'))
|
return int(name.lstrip('[').rstrip(']'))
|
||||||
except:
|
except:
|
||||||
return -1
|
return -1
|
||||||
|
|
||||||
def get_child_at_index(self,index):
|
def get_child_at_index(self,index):
|
||||||
logger = lldb.formatters.Logger.lldb.formatters.Logger()
|
logger = lldb.formatters.Logger()
|
||||||
logger >> "Retrieving child " + str(index)
|
logger >> "Retrieving child " + str(index)
|
||||||
if index < 0:
|
if index < 0:
|
||||||
return None
|
return None
|
||||||
|
|
Loading…
Reference in New Issue