2011-08-18 03:07:52 +08:00
|
|
|
import re
|
2012-04-26 00:32:39 +08:00
|
|
|
import lldb.formatters.Logger
|
2011-08-18 03:07:52 +08:00
|
|
|
|
|
|
|
# C++ STL formatters for LLDB
|
2011-08-23 00:10:25 +08:00
|
|
|
# These formatters are based upon the version of the GNU libstdc++
|
2012-08-28 01:42:50 +08:00
|
|
|
# as it ships with Mac OS X 10.6.8 thru 10.8.0
|
2011-08-23 00:10:25 +08:00
|
|
|
# You are encouraged to look at the STL implementation for your platform
|
|
|
|
# before relying on these formatters to do the right thing for your setup
|
2011-08-18 03:07:52 +08:00
|
|
|
|
|
|
|
class StdListSynthProvider:
|
|
|
|
|
|
|
|
def __init__(self, valobj, dict):
|
2012-04-26 01:53:41 +08:00
|
|
|
logger = lldb.formatters.Logger.Logger()
|
2011-08-18 03:07:52 +08:00
|
|
|
self.valobj = valobj
|
2012-04-10 08:11:03 +08:00
|
|
|
self.count = None
|
|
|
|
logger >> "Providing synthetic children for a map named " + str(valobj.GetName())
|
2011-08-18 03:07:52 +08:00
|
|
|
|
2012-03-09 11:09:58 +08:00
|
|
|
def next_node(self,node):
|
2012-04-26 01:53:41 +08:00
|
|
|
logger = lldb.formatters.Logger.Logger()
|
2012-03-09 11:09:58 +08:00
|
|
|
return node.GetChildMemberWithName('_M_next')
|
|
|
|
|
|
|
|
def is_valid(self,node):
|
2012-04-26 01:53:41 +08:00
|
|
|
logger = lldb.formatters.Logger.Logger()
|
2012-03-09 11:09:58 +08:00
|
|
|
return self.value(self.next_node(node)) != self.node_address
|
|
|
|
|
|
|
|
def value(self,node):
|
2012-04-26 01:53:41 +08:00
|
|
|
logger = lldb.formatters.Logger.Logger()
|
2012-03-09 11:09:58 +08:00
|
|
|
return node.GetValueAsUnsigned()
|
|
|
|
|
|
|
|
# Floyd's cyle-finding algorithm
|
|
|
|
# try to detect if this list has a loop
|
|
|
|
def has_loop(self):
|
Part 1 of a series of fixes meant to improve reliability and increase ease of bug fixing for data formatter issues.
We are introducing a new Logger class on the Python side. This has the same purpose, but is unrelated, to the C++ logging facility
The Pythonic logging can be enabled by using the following scripting commands:
(lldb) script Logger._lldb_formatters_debug_level = {0,1,2,...}
0 = no logging
1 = do log
2 = flush after logging each line - slower but safer
3 or more = each time a Logger is constructed, log the function that has created it
more log levels may be added, each one being more log-active than the previous
by default, the log output will come out on your screen, to direct it to a file:
(lldb) script Logger._lldb_formatters_debug_filename = 'filename'
that will make the output go to the file - set to None to disable the file output and get screen logging back
Logging has been enabled for the C++ STL formatters and for Cocoa class NSData - more logging will follow
synthetic children providers for classes list and map (both libstdcpp and libcxx) now have internal capping for safety reasons
this will fix crashers where a malformed list or map would not ever meet our termination conditions
to set the cap to a different value:
(lldb) script {gnu_libstdcpp|libcxx}.{map|list}_capping_size = new_cap (by default, it is 255)
you can optionally disable the loop detection algorithm for lists
(lldb) script {gnu_libstdcpp|libcxx}.list_uses_loop_detector = False
llvm-svn: 153676
2012-03-30 03:29:45 +08:00
|
|
|
global _list_uses_loop_detector
|
2012-04-26 01:53:41 +08:00
|
|
|
logger = lldb.formatters.Logger.Logger()
|
Part 1 of a series of fixes meant to improve reliability and increase ease of bug fixing for data formatter issues.
We are introducing a new Logger class on the Python side. This has the same purpose, but is unrelated, to the C++ logging facility
The Pythonic logging can be enabled by using the following scripting commands:
(lldb) script Logger._lldb_formatters_debug_level = {0,1,2,...}
0 = no logging
1 = do log
2 = flush after logging each line - slower but safer
3 or more = each time a Logger is constructed, log the function that has created it
more log levels may be added, each one being more log-active than the previous
by default, the log output will come out on your screen, to direct it to a file:
(lldb) script Logger._lldb_formatters_debug_filename = 'filename'
that will make the output go to the file - set to None to disable the file output and get screen logging back
Logging has been enabled for the C++ STL formatters and for Cocoa class NSData - more logging will follow
synthetic children providers for classes list and map (both libstdcpp and libcxx) now have internal capping for safety reasons
this will fix crashers where a malformed list or map would not ever meet our termination conditions
to set the cap to a different value:
(lldb) script {gnu_libstdcpp|libcxx}.{map|list}_capping_size = new_cap (by default, it is 255)
you can optionally disable the loop detection algorithm for lists
(lldb) script {gnu_libstdcpp|libcxx}.list_uses_loop_detector = False
llvm-svn: 153676
2012-03-30 03:29:45 +08:00
|
|
|
if _list_uses_loop_detector == False:
|
|
|
|
logger >> "Asked not to use loop detection"
|
|
|
|
return False
|
2012-03-09 11:09:58 +08:00
|
|
|
slow = self.next
|
|
|
|
fast1 = self.next
|
|
|
|
fast2 = self.next
|
|
|
|
while self.is_valid(slow):
|
|
|
|
slow_value = self.value(slow)
|
|
|
|
fast1 = self.next_node(fast2)
|
|
|
|
fast2 = self.next_node(fast1)
|
|
|
|
if self.value(fast1) == slow_value or self.value(fast2) == slow_value:
|
|
|
|
return True
|
|
|
|
slow = self.next_node(slow)
|
|
|
|
return False
|
|
|
|
|
2011-08-18 03:07:52 +08:00
|
|
|
def num_children(self):
|
Part 1 of a series of fixes meant to improve reliability and increase ease of bug fixing for data formatter issues.
We are introducing a new Logger class on the Python side. This has the same purpose, but is unrelated, to the C++ logging facility
The Pythonic logging can be enabled by using the following scripting commands:
(lldb) script Logger._lldb_formatters_debug_level = {0,1,2,...}
0 = no logging
1 = do log
2 = flush after logging each line - slower but safer
3 or more = each time a Logger is constructed, log the function that has created it
more log levels may be added, each one being more log-active than the previous
by default, the log output will come out on your screen, to direct it to a file:
(lldb) script Logger._lldb_formatters_debug_filename = 'filename'
that will make the output go to the file - set to None to disable the file output and get screen logging back
Logging has been enabled for the C++ STL formatters and for Cocoa class NSData - more logging will follow
synthetic children providers for classes list and map (both libstdcpp and libcxx) now have internal capping for safety reasons
this will fix crashers where a malformed list or map would not ever meet our termination conditions
to set the cap to a different value:
(lldb) script {gnu_libstdcpp|libcxx}.{map|list}_capping_size = new_cap (by default, it is 255)
you can optionally disable the loop detection algorithm for lists
(lldb) script {gnu_libstdcpp|libcxx}.list_uses_loop_detector = False
llvm-svn: 153676
2012-03-30 03:29:45 +08:00
|
|
|
global _list_capping_size
|
2012-04-26 01:53:41 +08:00
|
|
|
logger = lldb.formatters.Logger.Logger()
|
2012-03-09 11:09:58 +08:00
|
|
|
if self.count == None:
|
|
|
|
self.count = self.num_children_impl()
|
Part 1 of a series of fixes meant to improve reliability and increase ease of bug fixing for data formatter issues.
We are introducing a new Logger class on the Python side. This has the same purpose, but is unrelated, to the C++ logging facility
The Pythonic logging can be enabled by using the following scripting commands:
(lldb) script Logger._lldb_formatters_debug_level = {0,1,2,...}
0 = no logging
1 = do log
2 = flush after logging each line - slower but safer
3 or more = each time a Logger is constructed, log the function that has created it
more log levels may be added, each one being more log-active than the previous
by default, the log output will come out on your screen, to direct it to a file:
(lldb) script Logger._lldb_formatters_debug_filename = 'filename'
that will make the output go to the file - set to None to disable the file output and get screen logging back
Logging has been enabled for the C++ STL formatters and for Cocoa class NSData - more logging will follow
synthetic children providers for classes list and map (both libstdcpp and libcxx) now have internal capping for safety reasons
this will fix crashers where a malformed list or map would not ever meet our termination conditions
to set the cap to a different value:
(lldb) script {gnu_libstdcpp|libcxx}.{map|list}_capping_size = new_cap (by default, it is 255)
you can optionally disable the loop detection algorithm for lists
(lldb) script {gnu_libstdcpp|libcxx}.list_uses_loop_detector = False
llvm-svn: 153676
2012-03-30 03:29:45 +08:00
|
|
|
if self.count > _list_capping_size:
|
|
|
|
self.count = _list_capping_size
|
2012-03-09 11:09:58 +08:00
|
|
|
return self.count
|
|
|
|
|
|
|
|
def num_children_impl(self):
|
2012-04-26 01:53:41 +08:00
|
|
|
logger = lldb.formatters.Logger.Logger()
|
Part 1 of a series of fixes meant to improve reliability and increase ease of bug fixing for data formatter issues.
We are introducing a new Logger class on the Python side. This has the same purpose, but is unrelated, to the C++ logging facility
The Pythonic logging can be enabled by using the following scripting commands:
(lldb) script Logger._lldb_formatters_debug_level = {0,1,2,...}
0 = no logging
1 = do log
2 = flush after logging each line - slower but safer
3 or more = each time a Logger is constructed, log the function that has created it
more log levels may be added, each one being more log-active than the previous
by default, the log output will come out on your screen, to direct it to a file:
(lldb) script Logger._lldb_formatters_debug_filename = 'filename'
that will make the output go to the file - set to None to disable the file output and get screen logging back
Logging has been enabled for the C++ STL formatters and for Cocoa class NSData - more logging will follow
synthetic children providers for classes list and map (both libstdcpp and libcxx) now have internal capping for safety reasons
this will fix crashers where a malformed list or map would not ever meet our termination conditions
to set the cap to a different value:
(lldb) script {gnu_libstdcpp|libcxx}.{map|list}_capping_size = new_cap (by default, it is 255)
you can optionally disable the loop detection algorithm for lists
(lldb) script {gnu_libstdcpp|libcxx}.list_uses_loop_detector = False
llvm-svn: 153676
2012-03-30 03:29:45 +08:00
|
|
|
global _list_capping_size
|
2011-08-23 00:10:25 +08:00
|
|
|
try:
|
|
|
|
next_val = self.next.GetValueAsUnsigned(0)
|
|
|
|
prev_val = self.prev.GetValueAsUnsigned(0)
|
|
|
|
# After a std::list has been initialized, both next and prev will be non-NULL
|
|
|
|
if next_val == 0 or prev_val == 0:
|
|
|
|
return 0
|
|
|
|
if next_val == self.node_address:
|
|
|
|
return 0
|
|
|
|
if next_val == prev_val:
|
|
|
|
return 1
|
2012-03-09 11:09:58 +08:00
|
|
|
if self.has_loop():
|
|
|
|
return 0
|
2011-08-23 00:10:25 +08:00
|
|
|
size = 2
|
|
|
|
current = self.next
|
|
|
|
while current.GetChildMemberWithName('_M_next').GetValueAsUnsigned(0) != self.node_address:
|
|
|
|
size = size + 1
|
|
|
|
current = current.GetChildMemberWithName('_M_next')
|
Part 1 of a series of fixes meant to improve reliability and increase ease of bug fixing for data formatter issues.
We are introducing a new Logger class on the Python side. This has the same purpose, but is unrelated, to the C++ logging facility
The Pythonic logging can be enabled by using the following scripting commands:
(lldb) script Logger._lldb_formatters_debug_level = {0,1,2,...}
0 = no logging
1 = do log
2 = flush after logging each line - slower but safer
3 or more = each time a Logger is constructed, log the function that has created it
more log levels may be added, each one being more log-active than the previous
by default, the log output will come out on your screen, to direct it to a file:
(lldb) script Logger._lldb_formatters_debug_filename = 'filename'
that will make the output go to the file - set to None to disable the file output and get screen logging back
Logging has been enabled for the C++ STL formatters and for Cocoa class NSData - more logging will follow
synthetic children providers for classes list and map (both libstdcpp and libcxx) now have internal capping for safety reasons
this will fix crashers where a malformed list or map would not ever meet our termination conditions
to set the cap to a different value:
(lldb) script {gnu_libstdcpp|libcxx}.{map|list}_capping_size = new_cap (by default, it is 255)
you can optionally disable the loop detection algorithm for lists
(lldb) script {gnu_libstdcpp|libcxx}.list_uses_loop_detector = False
llvm-svn: 153676
2012-03-30 03:29:45 +08:00
|
|
|
if size > _list_capping_size:
|
|
|
|
return _list_capping_size
|
2011-08-23 00:10:25 +08:00
|
|
|
return (size - 1)
|
|
|
|
except:
|
|
|
|
return 0;
|
2011-08-18 03:07:52 +08:00
|
|
|
|
|
|
|
def get_child_index(self,name):
|
2012-04-26 01:53:41 +08:00
|
|
|
logger = lldb.formatters.Logger.Logger()
|
2011-08-23 00:10:25 +08:00
|
|
|
try:
|
|
|
|
return int(name.lstrip('[').rstrip(']'))
|
|
|
|
except:
|
|
|
|
return -1
|
2011-08-18 03:07:52 +08:00
|
|
|
|
|
|
|
def get_child_at_index(self,index):
|
2012-04-26 01:53:41 +08:00
|
|
|
logger = lldb.formatters.Logger.Logger()
|
2012-03-31 00:07:08 +08:00
|
|
|
logger >> "Fetching child " + str(index)
|
2011-08-23 00:10:25 +08:00
|
|
|
if index < 0:
|
|
|
|
return None;
|
2011-08-18 03:07:52 +08:00
|
|
|
if index >= self.num_children():
|
|
|
|
return None;
|
2011-08-23 00:10:25 +08:00
|
|
|
try:
|
|
|
|
offset = index
|
|
|
|
current = self.next
|
|
|
|
while offset > 0:
|
|
|
|
current = current.GetChildMemberWithName('_M_next')
|
|
|
|
offset = offset - 1
|
|
|
|
return current.CreateChildAtOffset('['+str(index)+']',2*current.GetType().GetByteSize(),self.data_type)
|
|
|
|
except:
|
2011-08-23 00:38:44 +08:00
|
|
|
return None
|
2011-08-18 03:07:52 +08:00
|
|
|
|
2012-02-04 02:11:52 +08:00
|
|
|
def extract_type(self):
|
2012-04-26 01:53:41 +08:00
|
|
|
logger = lldb.formatters.Logger.Logger()
|
2012-02-04 02:11:52 +08:00
|
|
|
list_type = self.valobj.GetType().GetUnqualifiedType()
|
2012-03-27 10:35:13 +08:00
|
|
|
if list_type.IsReferenceType():
|
|
|
|
list_type = list_type.GetDereferencedType()
|
2012-02-04 02:11:52 +08:00
|
|
|
if list_type.GetNumberOfTemplateArguments() > 0:
|
|
|
|
data_type = list_type.GetTemplateArgumentType(0)
|
|
|
|
else:
|
|
|
|
data_type = None
|
|
|
|
return data_type
|
2011-08-18 03:07:52 +08:00
|
|
|
|
|
|
|
def update(self):
|
2012-04-26 01:53:41 +08:00
|
|
|
logger = lldb.formatters.Logger.Logger()
|
2012-03-31 08:15:24 +08:00
|
|
|
# preemptively setting this to None - we might end up changing our mind later
|
|
|
|
self.count = None
|
2011-08-23 00:10:25 +08:00
|
|
|
try:
|
|
|
|
impl = self.valobj.GetChildMemberWithName('_M_impl')
|
|
|
|
node = impl.GetChildMemberWithName('_M_node')
|
|
|
|
self.node_address = self.valobj.AddressOf().GetValueAsUnsigned(0)
|
|
|
|
self.next = node.GetChildMemberWithName('_M_next')
|
|
|
|
self.prev = node.GetChildMemberWithName('_M_prev')
|
2012-02-04 02:11:52 +08:00
|
|
|
self.data_type = self.extract_type()
|
2011-08-23 00:10:25 +08:00
|
|
|
self.data_size = self.data_type.GetByteSize()
|
|
|
|
except:
|
|
|
|
pass
|
2011-08-18 03:07:52 +08:00
|
|
|
|
2012-10-24 05:54:53 +08:00
|
|
|
def has_children(self):
|
|
|
|
return True
|
|
|
|
|
2011-08-18 03:07:52 +08:00
|
|
|
class StdVectorSynthProvider:
|
|
|
|
|
|
|
|
def __init__(self, valobj, dict):
|
2012-04-26 01:53:41 +08:00
|
|
|
logger = lldb.formatters.Logger.Logger()
|
2012-04-10 08:11:03 +08:00
|
|
|
self.count = None
|
|
|
|
self.valobj = valobj
|
|
|
|
logger >> "Providing synthetic children for a map named " + str(valobj.GetName())
|
2011-08-18 03:07:52 +08:00
|
|
|
|
|
|
|
def num_children(self):
|
2012-04-26 01:53:41 +08:00
|
|
|
logger = lldb.formatters.Logger.Logger()
|
2012-03-09 11:09:58 +08:00
|
|
|
if self.count == None:
|
|
|
|
self.count = self.num_children_impl()
|
|
|
|
return self.count
|
|
|
|
|
|
|
|
def is_valid_pointer(ptr,process):
|
2012-04-26 01:53:41 +08:00
|
|
|
logger = lldb.formatters.Logger.Logger()
|
2012-03-09 11:09:58 +08:00
|
|
|
error = lldb.SBError()
|
|
|
|
process.ReadMemory(ptr,1,error)
|
|
|
|
return False if error.Fail() else True
|
|
|
|
|
|
|
|
def num_children_impl(self):
|
2012-04-26 01:53:41 +08:00
|
|
|
logger = lldb.formatters.Logger.Logger()
|
2011-08-23 00:10:25 +08:00
|
|
|
try:
|
|
|
|
start_val = self.start.GetValueAsUnsigned(0)
|
|
|
|
finish_val = self.finish.GetValueAsUnsigned(0)
|
|
|
|
end_val = self.end.GetValueAsUnsigned(0)
|
|
|
|
# Before a vector has been constructed, it will contain bad values
|
|
|
|
# so we really need to be careful about the length we return since
|
|
|
|
# unitialized data can cause us to return a huge number. We need
|
|
|
|
# to also check for any of the start, finish or end of storage values
|
|
|
|
# being zero (NULL). If any are, then this vector has not been
|
|
|
|
# initialized yet and we should return zero
|
|
|
|
|
|
|
|
# Make sure nothing is NULL
|
|
|
|
if start_val == 0 or finish_val == 0 or end_val == 0:
|
|
|
|
return 0
|
|
|
|
# Make sure start is less than finish
|
|
|
|
if start_val >= finish_val:
|
|
|
|
return 0
|
|
|
|
# Make sure finish is less than or equal to end of storage
|
|
|
|
if finish_val > end_val:
|
|
|
|
return 0
|
|
|
|
|
2012-03-09 11:09:58 +08:00
|
|
|
# if we have a struct (or other data type that the compiler pads to native word size)
|
|
|
|
# this check might fail, unless the sizeof() we get is itself incremented to take the
|
|
|
|
# padding bytes into account - on current clang it looks like this is the case
|
|
|
|
num_children = (finish_val-start_val)
|
|
|
|
if (num_children % self.data_size) != 0:
|
|
|
|
return 0
|
|
|
|
else:
|
|
|
|
num_children = num_children/self.data_size
|
2011-08-23 00:10:25 +08:00
|
|
|
return num_children
|
|
|
|
except:
|
|
|
|
return 0;
|
2011-08-18 03:07:52 +08:00
|
|
|
|
|
|
|
def get_child_index(self,name):
|
2012-04-26 01:53:41 +08:00
|
|
|
logger = lldb.formatters.Logger.Logger()
|
2011-08-23 00:10:25 +08:00
|
|
|
try:
|
|
|
|
return int(name.lstrip('[').rstrip(']'))
|
|
|
|
except:
|
|
|
|
return -1
|
2011-08-18 03:07:52 +08:00
|
|
|
|
|
|
|
def get_child_at_index(self,index):
|
2012-04-26 01:53:41 +08:00
|
|
|
logger = lldb.formatters.Logger.Logger()
|
2012-03-31 00:07:08 +08:00
|
|
|
logger >> "Retrieving child " + str(index)
|
2011-08-23 00:10:25 +08:00
|
|
|
if index < 0:
|
|
|
|
return None;
|
2011-08-18 03:07:52 +08:00
|
|
|
if index >= self.num_children():
|
|
|
|
return None;
|
2011-08-23 00:10:25 +08:00
|
|
|
try:
|
|
|
|
offset = index * self.data_size
|
|
|
|
return self.start.CreateChildAtOffset('['+str(index)+']',offset,self.data_type)
|
|
|
|
except:
|
|
|
|
return None
|
2011-08-18 03:07:52 +08:00
|
|
|
|
|
|
|
def update(self):
|
2012-04-26 01:53:41 +08:00
|
|
|
logger = lldb.formatters.Logger.Logger()
|
2012-03-31 08:15:24 +08:00
|
|
|
# preemptively setting this to None - we might end up changing our mind later
|
|
|
|
self.count = None
|
2011-08-23 00:10:25 +08:00
|
|
|
try:
|
|
|
|
impl = self.valobj.GetChildMemberWithName('_M_impl')
|
|
|
|
self.start = impl.GetChildMemberWithName('_M_start')
|
|
|
|
self.finish = impl.GetChildMemberWithName('_M_finish')
|
|
|
|
self.end = impl.GetChildMemberWithName('_M_end_of_storage')
|
|
|
|
self.data_type = self.start.GetType().GetPointeeType()
|
|
|
|
self.data_size = self.data_type.GetByteSize()
|
2012-03-09 11:09:58 +08:00
|
|
|
# if any of these objects is invalid, it means there is no point in trying to fetch anything
|
|
|
|
if self.start.IsValid() and self.finish.IsValid() and self.end.IsValid() and self.data_type.IsValid():
|
|
|
|
self.count = None
|
|
|
|
else:
|
|
|
|
self.count = 0
|
2011-08-23 00:10:25 +08:00
|
|
|
except:
|
|
|
|
pass
|
2012-10-24 05:54:53 +08:00
|
|
|
|
|
|
|
|
|
|
|
def has_children(self):
|
2012-12-11 03:55:53 +08:00
|
|
|
return True
|
2011-08-18 03:07:52 +08:00
|
|
|
|
|
|
|
|
|
|
|
class StdMapSynthProvider:
|
|
|
|
|
|
|
|
def __init__(self, valobj, dict):
|
2012-04-26 01:53:41 +08:00
|
|
|
logger = lldb.formatters.Logger.Logger()
|
2011-08-18 03:07:52 +08:00
|
|
|
self.valobj = valobj;
|
2012-04-10 08:11:03 +08:00
|
|
|
self.count = None
|
Part 1 of a series of fixes meant to improve reliability and increase ease of bug fixing for data formatter issues.
We are introducing a new Logger class on the Python side. This has the same purpose, but is unrelated, to the C++ logging facility
The Pythonic logging can be enabled by using the following scripting commands:
(lldb) script Logger._lldb_formatters_debug_level = {0,1,2,...}
0 = no logging
1 = do log
2 = flush after logging each line - slower but safer
3 or more = each time a Logger is constructed, log the function that has created it
more log levels may be added, each one being more log-active than the previous
by default, the log output will come out on your screen, to direct it to a file:
(lldb) script Logger._lldb_formatters_debug_filename = 'filename'
that will make the output go to the file - set to None to disable the file output and get screen logging back
Logging has been enabled for the C++ STL formatters and for Cocoa class NSData - more logging will follow
synthetic children providers for classes list and map (both libstdcpp and libcxx) now have internal capping for safety reasons
this will fix crashers where a malformed list or map would not ever meet our termination conditions
to set the cap to a different value:
(lldb) script {gnu_libstdcpp|libcxx}.{map|list}_capping_size = new_cap (by default, it is 255)
you can optionally disable the loop detection algorithm for lists
(lldb) script {gnu_libstdcpp|libcxx}.list_uses_loop_detector = False
llvm-svn: 153676
2012-03-30 03:29:45 +08:00
|
|
|
logger >> "Providing synthetic children for a map named " + str(valobj.GetName())
|
2012-02-04 02:11:52 +08:00
|
|
|
|
|
|
|
# we need this function as a temporary workaround for rdar://problem/10801549
|
|
|
|
# which prevents us from extracting the std::pair<K,V> SBType out of the template
|
|
|
|
# arguments for _Rep_Type _M_t in the map itself - because we have to make up the
|
|
|
|
# typename and then find it, we may hit the situation were std::string has multiple
|
|
|
|
# names but only one is actually referenced in the debug information. hence, we need
|
|
|
|
# to replace the longer versions of std::string with the shorter one in order to be able
|
|
|
|
# to find the type name
|
|
|
|
def fixup_class_name(self, class_name):
|
2012-04-26 01:53:41 +08:00
|
|
|
logger = lldb.formatters.Logger.Logger()
|
2012-02-04 02:11:52 +08:00
|
|
|
if class_name == 'std::basic_string<char, std::char_traits<char>, std::allocator<char> >':
|
2012-03-27 10:35:13 +08:00
|
|
|
return 'std::basic_string<char>',True
|
2012-02-04 02:11:52 +08:00
|
|
|
if class_name == 'basic_string<char, std::char_traits<char>, std::allocator<char> >':
|
2012-03-27 10:35:13 +08:00
|
|
|
return 'std::basic_string<char>',True
|
|
|
|
if class_name == 'std::basic_string<char, std::char_traits<char>, std::allocator<char> >':
|
|
|
|
return 'std::basic_string<char>',True
|
|
|
|
if class_name == 'basic_string<char, std::char_traits<char>, std::allocator<char> >':
|
|
|
|
return 'std::basic_string<char>',True
|
|
|
|
return class_name,False
|
2011-08-18 03:07:52 +08:00
|
|
|
|
|
|
|
def update(self):
|
2012-04-26 01:53:41 +08:00
|
|
|
logger = lldb.formatters.Logger.Logger()
|
2012-03-31 08:15:24 +08:00
|
|
|
# preemptively setting this to None - we might end up changing our mind later
|
|
|
|
self.count = None
|
2011-08-23 00:10:25 +08:00
|
|
|
try:
|
Part 1 of a series of fixes meant to improve reliability and increase ease of bug fixing for data formatter issues.
We are introducing a new Logger class on the Python side. This has the same purpose, but is unrelated, to the C++ logging facility
The Pythonic logging can be enabled by using the following scripting commands:
(lldb) script Logger._lldb_formatters_debug_level = {0,1,2,...}
0 = no logging
1 = do log
2 = flush after logging each line - slower but safer
3 or more = each time a Logger is constructed, log the function that has created it
more log levels may be added, each one being more log-active than the previous
by default, the log output will come out on your screen, to direct it to a file:
(lldb) script Logger._lldb_formatters_debug_filename = 'filename'
that will make the output go to the file - set to None to disable the file output and get screen logging back
Logging has been enabled for the C++ STL formatters and for Cocoa class NSData - more logging will follow
synthetic children providers for classes list and map (both libstdcpp and libcxx) now have internal capping for safety reasons
this will fix crashers where a malformed list or map would not ever meet our termination conditions
to set the cap to a different value:
(lldb) script {gnu_libstdcpp|libcxx}.{map|list}_capping_size = new_cap (by default, it is 255)
you can optionally disable the loop detection algorithm for lists
(lldb) script {gnu_libstdcpp|libcxx}.list_uses_loop_detector = False
llvm-svn: 153676
2012-03-30 03:29:45 +08:00
|
|
|
# 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
|
|
|
|
# if this gets set to True, then we will merrily return None for any child from that moment on
|
|
|
|
self.garbage = False
|
2011-08-23 00:10:25 +08:00
|
|
|
self.Mt = self.valobj.GetChildMemberWithName('_M_t')
|
|
|
|
self.Mimpl = self.Mt.GetChildMemberWithName('_M_impl')
|
|
|
|
self.Mheader = self.Mimpl.GetChildMemberWithName('_M_header')
|
2012-02-04 02:11:52 +08:00
|
|
|
|
2012-03-27 10:35:13 +08:00
|
|
|
map_type = self.valobj.GetType()
|
|
|
|
if map_type.IsReferenceType():
|
2012-03-31 00:07:08 +08:00
|
|
|
logger >> "Dereferencing type"
|
2012-03-27 10:35:13 +08:00
|
|
|
map_type = map_type.GetDereferencedType()
|
|
|
|
|
|
|
|
map_arg_0 = str(map_type.GetTemplateArgumentType(0).GetName())
|
|
|
|
map_arg_1 = str(map_type.GetTemplateArgumentType(1).GetName())
|
2012-02-04 02:11:52 +08:00
|
|
|
|
2012-03-31 00:07:08 +08:00
|
|
|
logger >> "map has args " + str(map_arg_0) + " and " + str(map_arg_1)
|
|
|
|
|
2012-03-27 10:35:13 +08:00
|
|
|
map_arg_0,fixed_0 = self.fixup_class_name(map_arg_0)
|
|
|
|
map_arg_1,fixed_1 = self.fixup_class_name(map_arg_1)
|
|
|
|
|
2012-03-31 00:07:08 +08:00
|
|
|
logger >> "arg_0 has become: " + str(map_arg_0) + " (fixed: " + str(fixed_0) + ")"
|
|
|
|
logger >> "arg_1 has become: " + str(map_arg_1) + " (fixed: " + str(fixed_1) + ")"
|
|
|
|
|
2012-03-27 10:35:13 +08:00
|
|
|
# HACK: this is related to the above issue with the typename for std::string
|
|
|
|
# being shortened by clang - the changes to typename display and searching to honor
|
|
|
|
# namespaces make it so that we go looking for std::pair<const std::basic_string<char>, ...>
|
|
|
|
# but when we find a type for this, we then compare it against the fully-qualified
|
|
|
|
# std::pair<const std::basic_string<char, std::char_traits... and of course fail
|
|
|
|
# the way to bypass this problem is to avoid using the std:: prefix in this specific case
|
|
|
|
if fixed_0 or fixed_1:
|
|
|
|
map_arg_type = "pair<const " + map_arg_0 + ", " + map_arg_1
|
|
|
|
else:
|
|
|
|
map_arg_type = "std::pair<const " + map_arg_0 + ", " + map_arg_1
|
2012-02-04 02:11:52 +08:00
|
|
|
|
|
|
|
if map_arg_1[-1] == '>':
|
|
|
|
map_arg_type = map_arg_type + " >"
|
|
|
|
else:
|
|
|
|
map_arg_type = map_arg_type + ">"
|
|
|
|
|
2012-03-31 00:07:08 +08:00
|
|
|
logger >> "final contents datatype is: " + str(map_arg_type)
|
|
|
|
|
2012-02-04 02:11:52 +08:00
|
|
|
self.data_type = self.valobj.GetTarget().FindFirstType(map_arg_type)
|
|
|
|
|
2012-03-31 00:07:08 +08:00
|
|
|
logger >> "and the SBType is: " + str(self.data_type)
|
|
|
|
|
2011-08-23 00:10:25 +08:00
|
|
|
# from libstdc++ implementation of _M_root for rbtree
|
|
|
|
self.Mroot = self.Mheader.GetChildMemberWithName('_M_parent')
|
|
|
|
self.data_size = self.data_type.GetByteSize()
|
|
|
|
self.skip_size = self.Mheader.GetType().GetByteSize()
|
|
|
|
except:
|
|
|
|
pass
|
2011-08-18 03:07:52 +08:00
|
|
|
|
|
|
|
def num_children(self):
|
Part 1 of a series of fixes meant to improve reliability and increase ease of bug fixing for data formatter issues.
We are introducing a new Logger class on the Python side. This has the same purpose, but is unrelated, to the C++ logging facility
The Pythonic logging can be enabled by using the following scripting commands:
(lldb) script Logger._lldb_formatters_debug_level = {0,1,2,...}
0 = no logging
1 = do log
2 = flush after logging each line - slower but safer
3 or more = each time a Logger is constructed, log the function that has created it
more log levels may be added, each one being more log-active than the previous
by default, the log output will come out on your screen, to direct it to a file:
(lldb) script Logger._lldb_formatters_debug_filename = 'filename'
that will make the output go to the file - set to None to disable the file output and get screen logging back
Logging has been enabled for the C++ STL formatters and for Cocoa class NSData - more logging will follow
synthetic children providers for classes list and map (both libstdcpp and libcxx) now have internal capping for safety reasons
this will fix crashers where a malformed list or map would not ever meet our termination conditions
to set the cap to a different value:
(lldb) script {gnu_libstdcpp|libcxx}.{map|list}_capping_size = new_cap (by default, it is 255)
you can optionally disable the loop detection algorithm for lists
(lldb) script {gnu_libstdcpp|libcxx}.list_uses_loop_detector = False
llvm-svn: 153676
2012-03-30 03:29:45 +08:00
|
|
|
global _map_capping_size
|
2012-04-26 01:53:41 +08:00
|
|
|
logger = lldb.formatters.Logger.Logger()
|
Part 1 of a series of fixes meant to improve reliability and increase ease of bug fixing for data formatter issues.
We are introducing a new Logger class on the Python side. This has the same purpose, but is unrelated, to the C++ logging facility
The Pythonic logging can be enabled by using the following scripting commands:
(lldb) script Logger._lldb_formatters_debug_level = {0,1,2,...}
0 = no logging
1 = do log
2 = flush after logging each line - slower but safer
3 or more = each time a Logger is constructed, log the function that has created it
more log levels may be added, each one being more log-active than the previous
by default, the log output will come out on your screen, to direct it to a file:
(lldb) script Logger._lldb_formatters_debug_filename = 'filename'
that will make the output go to the file - set to None to disable the file output and get screen logging back
Logging has been enabled for the C++ STL formatters and for Cocoa class NSData - more logging will follow
synthetic children providers for classes list and map (both libstdcpp and libcxx) now have internal capping for safety reasons
this will fix crashers where a malformed list or map would not ever meet our termination conditions
to set the cap to a different value:
(lldb) script {gnu_libstdcpp|libcxx}.{map|list}_capping_size = new_cap (by default, it is 255)
you can optionally disable the loop detection algorithm for lists
(lldb) script {gnu_libstdcpp|libcxx}.list_uses_loop_detector = False
llvm-svn: 153676
2012-03-30 03:29:45 +08:00
|
|
|
if self.count == None:
|
|
|
|
self.count = self.num_children_impl()
|
|
|
|
if self.count > _map_capping_size:
|
|
|
|
self.count = _map_capping_size
|
|
|
|
return self.count
|
|
|
|
|
|
|
|
def num_children_impl(self):
|
2012-04-26 01:53:41 +08:00
|
|
|
logger = lldb.formatters.Logger.Logger()
|
2011-08-23 00:10:25 +08:00
|
|
|
try:
|
|
|
|
root_ptr_val = self.node_ptr_value(self.Mroot)
|
|
|
|
if root_ptr_val == 0:
|
|
|
|
return 0;
|
Part 1 of a series of fixes meant to improve reliability and increase ease of bug fixing for data formatter issues.
We are introducing a new Logger class on the Python side. This has the same purpose, but is unrelated, to the C++ logging facility
The Pythonic logging can be enabled by using the following scripting commands:
(lldb) script Logger._lldb_formatters_debug_level = {0,1,2,...}
0 = no logging
1 = do log
2 = flush after logging each line - slower but safer
3 or more = each time a Logger is constructed, log the function that has created it
more log levels may be added, each one being more log-active than the previous
by default, the log output will come out on your screen, to direct it to a file:
(lldb) script Logger._lldb_formatters_debug_filename = 'filename'
that will make the output go to the file - set to None to disable the file output and get screen logging back
Logging has been enabled for the C++ STL formatters and for Cocoa class NSData - more logging will follow
synthetic children providers for classes list and map (both libstdcpp and libcxx) now have internal capping for safety reasons
this will fix crashers where a malformed list or map would not ever meet our termination conditions
to set the cap to a different value:
(lldb) script {gnu_libstdcpp|libcxx}.{map|list}_capping_size = new_cap (by default, it is 255)
you can optionally disable the loop detection algorithm for lists
(lldb) script {gnu_libstdcpp|libcxx}.list_uses_loop_detector = False
llvm-svn: 153676
2012-03-30 03:29:45 +08:00
|
|
|
count = self.Mimpl.GetChildMemberWithName('_M_node_count').GetValueAsUnsigned(0)
|
|
|
|
logger >> "I have " + str(count) + " children available"
|
|
|
|
return count
|
2011-08-23 00:10:25 +08:00
|
|
|
except:
|
2011-08-18 03:07:52 +08:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
def get_child_index(self,name):
|
2012-04-26 01:53:41 +08:00
|
|
|
logger = lldb.formatters.Logger.Logger()
|
2011-08-23 00:10:25 +08:00
|
|
|
try:
|
|
|
|
return int(name.lstrip('[').rstrip(']'))
|
|
|
|
except:
|
|
|
|
return -1
|
2011-08-18 03:07:52 +08:00
|
|
|
|
|
|
|
def get_child_at_index(self,index):
|
2012-04-26 01:53:41 +08:00
|
|
|
logger = lldb.formatters.Logger.Logger()
|
Part 1 of a series of fixes meant to improve reliability and increase ease of bug fixing for data formatter issues.
We are introducing a new Logger class on the Python side. This has the same purpose, but is unrelated, to the C++ logging facility
The Pythonic logging can be enabled by using the following scripting commands:
(lldb) script Logger._lldb_formatters_debug_level = {0,1,2,...}
0 = no logging
1 = do log
2 = flush after logging each line - slower but safer
3 or more = each time a Logger is constructed, log the function that has created it
more log levels may be added, each one being more log-active than the previous
by default, the log output will come out on your screen, to direct it to a file:
(lldb) script Logger._lldb_formatters_debug_filename = 'filename'
that will make the output go to the file - set to None to disable the file output and get screen logging back
Logging has been enabled for the C++ STL formatters and for Cocoa class NSData - more logging will follow
synthetic children providers for classes list and map (both libstdcpp and libcxx) now have internal capping for safety reasons
this will fix crashers where a malformed list or map would not ever meet our termination conditions
to set the cap to a different value:
(lldb) script {gnu_libstdcpp|libcxx}.{map|list}_capping_size = new_cap (by default, it is 255)
you can optionally disable the loop detection algorithm for lists
(lldb) script {gnu_libstdcpp|libcxx}.list_uses_loop_detector = False
llvm-svn: 153676
2012-03-30 03:29:45 +08:00
|
|
|
logger >> "Being asked to fetch child[" + str(index) + "]"
|
2011-08-23 00:10:25 +08:00
|
|
|
if index < 0:
|
|
|
|
return None
|
2011-08-18 03:07:52 +08:00
|
|
|
if index >= self.num_children():
|
|
|
|
return None;
|
Part 1 of a series of fixes meant to improve reliability and increase ease of bug fixing for data formatter issues.
We are introducing a new Logger class on the Python side. This has the same purpose, but is unrelated, to the C++ logging facility
The Pythonic logging can be enabled by using the following scripting commands:
(lldb) script Logger._lldb_formatters_debug_level = {0,1,2,...}
0 = no logging
1 = do log
2 = flush after logging each line - slower but safer
3 or more = each time a Logger is constructed, log the function that has created it
more log levels may be added, each one being more log-active than the previous
by default, the log output will come out on your screen, to direct it to a file:
(lldb) script Logger._lldb_formatters_debug_filename = 'filename'
that will make the output go to the file - set to None to disable the file output and get screen logging back
Logging has been enabled for the C++ STL formatters and for Cocoa class NSData - more logging will follow
synthetic children providers for classes list and map (both libstdcpp and libcxx) now have internal capping for safety reasons
this will fix crashers where a malformed list or map would not ever meet our termination conditions
to set the cap to a different value:
(lldb) script {gnu_libstdcpp|libcxx}.{map|list}_capping_size = new_cap (by default, it is 255)
you can optionally disable the loop detection algorithm for lists
(lldb) script {gnu_libstdcpp|libcxx}.list_uses_loop_detector = False
llvm-svn: 153676
2012-03-30 03:29:45 +08:00
|
|
|
if self.garbage:
|
|
|
|
logger >> "Returning None since we are a garbage tree"
|
|
|
|
return None
|
2011-08-23 00:10:25 +08:00
|
|
|
try:
|
|
|
|
offset = index
|
|
|
|
current = self.left(self.Mheader);
|
|
|
|
while offset > 0:
|
|
|
|
current = self.increment_node(current)
|
|
|
|
offset = offset - 1;
|
|
|
|
# skip all the base stuff and get at the data
|
|
|
|
return current.CreateChildAtOffset('['+str(index)+']',self.skip_size,self.data_type)
|
|
|
|
except:
|
|
|
|
return None
|
2011-08-18 03:07:52 +08:00
|
|
|
|
|
|
|
# utility functions
|
|
|
|
def node_ptr_value(self,node):
|
2012-04-26 01:53:41 +08:00
|
|
|
logger = lldb.formatters.Logger.Logger()
|
2011-08-18 03:07:52 +08:00
|
|
|
return node.GetValueAsUnsigned(0)
|
|
|
|
|
|
|
|
def right(self,node):
|
2012-04-26 01:53:41 +08:00
|
|
|
logger = lldb.formatters.Logger.Logger()
|
2011-08-18 03:07:52 +08:00
|
|
|
return node.GetChildMemberWithName("_M_right");
|
|
|
|
|
|
|
|
def left(self,node):
|
2012-04-26 01:53:41 +08:00
|
|
|
logger = lldb.formatters.Logger.Logger()
|
2011-08-18 03:07:52 +08:00
|
|
|
return node.GetChildMemberWithName("_M_left");
|
|
|
|
|
|
|
|
def parent(self,node):
|
2012-04-26 01:53:41 +08:00
|
|
|
logger = lldb.formatters.Logger.Logger()
|
2011-08-18 03:07:52 +08:00
|
|
|
return node.GetChildMemberWithName("_M_parent");
|
|
|
|
|
|
|
|
# from libstdc++ implementation of iterator for rbtree
|
|
|
|
def increment_node(self,node):
|
2012-04-26 01:53:41 +08:00
|
|
|
logger = lldb.formatters.Logger.Logger()
|
Part 1 of a series of fixes meant to improve reliability and increase ease of bug fixing for data formatter issues.
We are introducing a new Logger class on the Python side. This has the same purpose, but is unrelated, to the C++ logging facility
The Pythonic logging can be enabled by using the following scripting commands:
(lldb) script Logger._lldb_formatters_debug_level = {0,1,2,...}
0 = no logging
1 = do log
2 = flush after logging each line - slower but safer
3 or more = each time a Logger is constructed, log the function that has created it
more log levels may be added, each one being more log-active than the previous
by default, the log output will come out on your screen, to direct it to a file:
(lldb) script Logger._lldb_formatters_debug_filename = 'filename'
that will make the output go to the file - set to None to disable the file output and get screen logging back
Logging has been enabled for the C++ STL formatters and for Cocoa class NSData - more logging will follow
synthetic children providers for classes list and map (both libstdcpp and libcxx) now have internal capping for safety reasons
this will fix crashers where a malformed list or map would not ever meet our termination conditions
to set the cap to a different value:
(lldb) script {gnu_libstdcpp|libcxx}.{map|list}_capping_size = new_cap (by default, it is 255)
you can optionally disable the loop detection algorithm for lists
(lldb) script {gnu_libstdcpp|libcxx}.list_uses_loop_detector = False
llvm-svn: 153676
2012-03-30 03:29:45 +08:00
|
|
|
max_steps = self.num_children()
|
2011-08-18 03:07:52 +08:00
|
|
|
if self.node_ptr_value(self.right(node)) != 0:
|
|
|
|
x = self.right(node);
|
Part 1 of a series of fixes meant to improve reliability and increase ease of bug fixing for data formatter issues.
We are introducing a new Logger class on the Python side. This has the same purpose, but is unrelated, to the C++ logging facility
The Pythonic logging can be enabled by using the following scripting commands:
(lldb) script Logger._lldb_formatters_debug_level = {0,1,2,...}
0 = no logging
1 = do log
2 = flush after logging each line - slower but safer
3 or more = each time a Logger is constructed, log the function that has created it
more log levels may be added, each one being more log-active than the previous
by default, the log output will come out on your screen, to direct it to a file:
(lldb) script Logger._lldb_formatters_debug_filename = 'filename'
that will make the output go to the file - set to None to disable the file output and get screen logging back
Logging has been enabled for the C++ STL formatters and for Cocoa class NSData - more logging will follow
synthetic children providers for classes list and map (both libstdcpp and libcxx) now have internal capping for safety reasons
this will fix crashers where a malformed list or map would not ever meet our termination conditions
to set the cap to a different value:
(lldb) script {gnu_libstdcpp|libcxx}.{map|list}_capping_size = new_cap (by default, it is 255)
you can optionally disable the loop detection algorithm for lists
(lldb) script {gnu_libstdcpp|libcxx}.list_uses_loop_detector = False
llvm-svn: 153676
2012-03-30 03:29:45 +08:00
|
|
|
max_steps -= 1
|
2011-08-18 03:07:52 +08:00
|
|
|
while self.node_ptr_value(self.left(x)) != 0:
|
|
|
|
x = self.left(x);
|
Part 1 of a series of fixes meant to improve reliability and increase ease of bug fixing for data formatter issues.
We are introducing a new Logger class on the Python side. This has the same purpose, but is unrelated, to the C++ logging facility
The Pythonic logging can be enabled by using the following scripting commands:
(lldb) script Logger._lldb_formatters_debug_level = {0,1,2,...}
0 = no logging
1 = do log
2 = flush after logging each line - slower but safer
3 or more = each time a Logger is constructed, log the function that has created it
more log levels may be added, each one being more log-active than the previous
by default, the log output will come out on your screen, to direct it to a file:
(lldb) script Logger._lldb_formatters_debug_filename = 'filename'
that will make the output go to the file - set to None to disable the file output and get screen logging back
Logging has been enabled for the C++ STL formatters and for Cocoa class NSData - more logging will follow
synthetic children providers for classes list and map (both libstdcpp and libcxx) now have internal capping for safety reasons
this will fix crashers where a malformed list or map would not ever meet our termination conditions
to set the cap to a different value:
(lldb) script {gnu_libstdcpp|libcxx}.{map|list}_capping_size = new_cap (by default, it is 255)
you can optionally disable the loop detection algorithm for lists
(lldb) script {gnu_libstdcpp|libcxx}.list_uses_loop_detector = False
llvm-svn: 153676
2012-03-30 03:29:45 +08:00
|
|
|
max_steps -= 1
|
|
|
|
logger >> str(max_steps) + " more to go before giving up"
|
|
|
|
if max_steps <= 0:
|
|
|
|
self.garbage = True
|
|
|
|
return None
|
2011-08-18 03:07:52 +08:00
|
|
|
return x;
|
|
|
|
else:
|
|
|
|
x = node;
|
|
|
|
y = self.parent(x)
|
Part 1 of a series of fixes meant to improve reliability and increase ease of bug fixing for data formatter issues.
We are introducing a new Logger class on the Python side. This has the same purpose, but is unrelated, to the C++ logging facility
The Pythonic logging can be enabled by using the following scripting commands:
(lldb) script Logger._lldb_formatters_debug_level = {0,1,2,...}
0 = no logging
1 = do log
2 = flush after logging each line - slower but safer
3 or more = each time a Logger is constructed, log the function that has created it
more log levels may be added, each one being more log-active than the previous
by default, the log output will come out on your screen, to direct it to a file:
(lldb) script Logger._lldb_formatters_debug_filename = 'filename'
that will make the output go to the file - set to None to disable the file output and get screen logging back
Logging has been enabled for the C++ STL formatters and for Cocoa class NSData - more logging will follow
synthetic children providers for classes list and map (both libstdcpp and libcxx) now have internal capping for safety reasons
this will fix crashers where a malformed list or map would not ever meet our termination conditions
to set the cap to a different value:
(lldb) script {gnu_libstdcpp|libcxx}.{map|list}_capping_size = new_cap (by default, it is 255)
you can optionally disable the loop detection algorithm for lists
(lldb) script {gnu_libstdcpp|libcxx}.list_uses_loop_detector = False
llvm-svn: 153676
2012-03-30 03:29:45 +08:00
|
|
|
max_steps -= 1
|
2011-08-18 03:07:52 +08:00
|
|
|
while(self.node_ptr_value(x) == self.node_ptr_value(self.right(y))):
|
|
|
|
x = y;
|
|
|
|
y = self.parent(y);
|
Part 1 of a series of fixes meant to improve reliability and increase ease of bug fixing for data formatter issues.
We are introducing a new Logger class on the Python side. This has the same purpose, but is unrelated, to the C++ logging facility
The Pythonic logging can be enabled by using the following scripting commands:
(lldb) script Logger._lldb_formatters_debug_level = {0,1,2,...}
0 = no logging
1 = do log
2 = flush after logging each line - slower but safer
3 or more = each time a Logger is constructed, log the function that has created it
more log levels may be added, each one being more log-active than the previous
by default, the log output will come out on your screen, to direct it to a file:
(lldb) script Logger._lldb_formatters_debug_filename = 'filename'
that will make the output go to the file - set to None to disable the file output and get screen logging back
Logging has been enabled for the C++ STL formatters and for Cocoa class NSData - more logging will follow
synthetic children providers for classes list and map (both libstdcpp and libcxx) now have internal capping for safety reasons
this will fix crashers where a malformed list or map would not ever meet our termination conditions
to set the cap to a different value:
(lldb) script {gnu_libstdcpp|libcxx}.{map|list}_capping_size = new_cap (by default, it is 255)
you can optionally disable the loop detection algorithm for lists
(lldb) script {gnu_libstdcpp|libcxx}.list_uses_loop_detector = False
llvm-svn: 153676
2012-03-30 03:29:45 +08:00
|
|
|
max_steps -= 1
|
|
|
|
logger >> str(max_steps) + " more to go before giving up"
|
|
|
|
if max_steps <= 0:
|
|
|
|
self.garbage = True
|
|
|
|
return None
|
2011-08-18 03:07:52 +08:00
|
|
|
if self.node_ptr_value(self.right(x)) != self.node_ptr_value(y):
|
|
|
|
x = y;
|
|
|
|
return x;
|
|
|
|
|
2012-10-24 05:54:53 +08:00
|
|
|
def has_children(self):
|
2012-12-11 03:55:53 +08:00
|
|
|
return True
|
Part 1 of a series of fixes meant to improve reliability and increase ease of bug fixing for data formatter issues.
We are introducing a new Logger class on the Python side. This has the same purpose, but is unrelated, to the C++ logging facility
The Pythonic logging can be enabled by using the following scripting commands:
(lldb) script Logger._lldb_formatters_debug_level = {0,1,2,...}
0 = no logging
1 = do log
2 = flush after logging each line - slower but safer
3 or more = each time a Logger is constructed, log the function that has created it
more log levels may be added, each one being more log-active than the previous
by default, the log output will come out on your screen, to direct it to a file:
(lldb) script Logger._lldb_formatters_debug_filename = 'filename'
that will make the output go to the file - set to None to disable the file output and get screen logging back
Logging has been enabled for the C++ STL formatters and for Cocoa class NSData - more logging will follow
synthetic children providers for classes list and map (both libstdcpp and libcxx) now have internal capping for safety reasons
this will fix crashers where a malformed list or map would not ever meet our termination conditions
to set the cap to a different value:
(lldb) script {gnu_libstdcpp|libcxx}.{map|list}_capping_size = new_cap (by default, it is 255)
you can optionally disable the loop detection algorithm for lists
(lldb) script {gnu_libstdcpp|libcxx}.list_uses_loop_detector = False
llvm-svn: 153676
2012-03-30 03:29:45 +08:00
|
|
|
|
|
|
|
_map_capping_size = 255
|
|
|
|
_list_capping_size = 255
|
|
|
|
_list_uses_loop_detector = True
|