diff options
5 files changed, 6 insertions, 895 deletions
diff --git a/lldb/test/functionalities/data-formatter/data-formatter-python-synth/StdListSynthProvider.py b/lldb/test/functionalities/data-formatter/data-formatter-python-synth/StdListSynthProvider.py deleted file mode 100644 index a464c80a91e..00000000000 --- a/lldb/test/functionalities/data-formatter/data-formatter-python-synth/StdListSynthProvider.py +++ /dev/null @@ -1,64 +0,0 @@ -import re -class StdListSynthProvider: - - def __init__(self, valobj, dict): - self.valobj = valobj - self.update() - - def num_children(self): - 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 - size = 2 - current = self.next - while current.GetChildMemberWithName('_M_next').GetValueAsUnsigned(0) != self.node_address: - size = size + 1 - current = current.GetChildMemberWithName('_M_next') - return (size - 1) - - def get_child_index(self,name): - return int(name.lstrip('[').rstrip(']')) - - def get_child_at_index(self,index): - if index >= self.num_children(): - return None; - 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) - - def extract_type_name(self,name): - self.type_name = name[16:] - index = 2 - count_of_template = 1 - while index < len(self.type_name): - if self.type_name[index] == '<': - count_of_template = count_of_template + 1 - elif self.type_name[index] == '>': - count_of_template = count_of_template - 1 - elif self.type_name[index] == ',' and count_of_template == 1: - self.type_name = self.type_name[:index] - break - index = index + 1 - self.type_name_nospaces = self.type_name.replace(", ", ",") - - def update(self): - impl = self.valobj.GetChildMemberWithName('_M_impl') - node = impl.GetChildMemberWithName('_M_node') - self.extract_type_name(impl.GetType().GetName()) - self.node_address = self.valobj.AddressOf().GetValueAsUnsigned(0) - self.next = node.GetChildMemberWithName('_M_next') - self.prev = node.GetChildMemberWithName('_M_prev') - self.data_type = node.GetTarget().FindFirstType(self.type_name) - # tries to fight against a difference in formatting type names between gcc and clang - if self.data_type.IsValid() == False: - self.data_type = node.GetTarget().FindFirstType(self.type_name_nospaces) - self.data_size = self.data_type.GetByteSize() diff --git a/lldb/test/functionalities/data-formatter/data-formatter-python-synth/StdMapSynthProvider.py b/lldb/test/functionalities/data-formatter/data-formatter-python-synth/StdMapSynthProvider.py deleted file mode 100644 index 71357856bc6..00000000000 --- a/lldb/test/functionalities/data-formatter/data-formatter-python-synth/StdMapSynthProvider.py +++ /dev/null @@ -1,112 +0,0 @@ -import re - -class StdMapSynthProvider: - - def __init__(self, valobj, dict): - self.valobj = valobj; - self.update() - - def update(self): - self.Mt = self.valobj.GetChildMemberWithName('_M_t') - self.Mimpl = self.Mt.GetChildMemberWithName('_M_impl') - self.Mheader = self.Mimpl.GetChildMemberWithName('_M_header') - # from libstdc++ implementation of _M_root for rbtree - self.Mroot = self.Mheader.GetChildMemberWithName('_M_parent') - # the stuff into the tree is actually a std::pair<const key, value> - # life would be much easier if gcc had a coherent way to print out - # template names in debug info - self.expand_clang_type_name() - self.expand_gcc_type_name() - self.data_type = self.Mt.GetTarget().FindFirstType(self.clang_type_name) - if self.data_type.IsValid() == False: - self.data_type = self.Mt.GetTarget().FindFirstType(self.gcc_type_name) - self.data_size = self.data_type.GetByteSize() - self.skip_size = self.Mheader.GetType().GetByteSize() - - def expand_clang_type_name(self): - type_name = self.Mimpl.GetType().GetName() - index = type_name.find("std::pair<") - type_name = type_name[index+5:] - index = 6 - template_count = 1 - while index < len(type_name): - if type_name[index] == '<': - template_count = template_count + 1 - elif type_name[index] == '>' and template_count == 1: - type_name = type_name[:index+1] - break - elif type_name[index] == '>': - template_count = template_count - 1 - index = index + 1; - self.clang_type_name = type_name - - def expand_gcc_type_name(self): - type_name = self.Mt.GetType().GetName() - index = type_name.find("std::pair<") - type_name = type_name[index+5:] - index = 6 - template_count = 1 - while index < len(type_name): - if type_name[index] == '<': - template_count = template_count + 1 - elif type_name[index] == '>' and template_count == 1: - type_name = type_name[:index+1] - break - elif type_name[index] == '>': - template_count = template_count - 1 - elif type_name[index] == ' ' and template_count == 1 and type_name[index-1] == ',': - type_name = type_name[0:index] + type_name[index+1:] - index = index - 1 - index = index + 1; - self.gcc_type_name = type_name - - def num_children(self): - root_ptr_val = self.node_ptr_value(self.Mroot) - if root_ptr_val == 0: - return 0; - return self.Mimpl.GetChildMemberWithName('_M_node_count').GetValueAsUnsigned(0) - - def get_child_index(self,name): - return int(name.lstrip('[').rstrip(']')) - - def get_child_at_index(self,index): - if index >= self.num_children(): - return None; - 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) - - # utility functions - def node_ptr_value(self,node): - return node.GetValueAsUnsigned(0) - - def right(self,node): - return node.GetChildMemberWithName("_M_right"); - - def left(self,node): - return node.GetChildMemberWithName("_M_left"); - - def parent(self,node): - return node.GetChildMemberWithName("_M_parent"); - - # from libstdc++ implementation of iterator for rbtree - def increment_node(self,node): - if self.node_ptr_value(self.right(node)) != 0: - x = self.right(node); - while self.node_ptr_value(self.left(x)) != 0: - x = self.left(x); - return x; - else: - x = node; - y = self.parent(x) - while(self.node_ptr_value(x) == self.node_ptr_value(self.right(y))): - x = y; - y = self.parent(y); - if self.node_ptr_value(self.right(x)) != self.node_ptr_value(y): - x = y; - return x; - diff --git a/lldb/test/functionalities/data-formatter/data-formatter-python-synth/StdVectorSynthProvider.py b/lldb/test/functionalities/data-formatter/data-formatter-python-synth/StdVectorSynthProvider.py deleted file mode 100644 index f2b3d442925..00000000000 --- a/lldb/test/functionalities/data-formatter/data-formatter-python-synth/StdVectorSynthProvider.py +++ /dev/null @@ -1,52 +0,0 @@ -class StdVectorSynthProvider: - - def __init__(self, valobj, dict): - self.valobj = valobj; - self.update() - - def num_children(self): - 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 - - # We might still get things wrong, so cap things at 256 items for now - # TODO: read a target "settings set" variable for this to allow it to - # be customized - num_children = (finish_val-start_val)/self.data_size - if num_children > 256: - return 256 - return num_children - - def get_child_index(self,name): - return int(name.lstrip('[').rstrip(']')) - - def get_child_at_index(self,index): - if index >= self.num_children(): - return None; - offset = index * self.data_size - return self.start.CreateChildAtOffset('['+str(index)+']',offset,self.data_type) - - def update(self): - 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() - diff --git a/lldb/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py b/lldb/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py index 8b0a9a44eb2..536ecffc81c 100644 --- a/lldb/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py +++ b/lldb/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py @@ -11,16 +11,12 @@ class PythonSynthDataFormatterTestCase(TestBase): mydir = os.path.join("functionalities", "data-formatter", "data-formatter-python-synth") - #rdar://problem/10334911 - @unittest2.expectedFailure @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") def test_with_dsym_and_run_command(self): """Test data formatter commands.""" self.buildDsym() self.data_formatter_commands() - #rdar://problem/10334911 - @unittest2.expectedFailure def test_with_dwarf_and_run_command(self): """Test data formatter commands.""" self.buildDwarf() @@ -92,12 +88,12 @@ class PythonSynthDataFormatterTestCase(TestBase): self.runCmd("type summary add --summary-string \"fake_a=${svar.fake_a}\" foo") self.expect('frame variable f00_1', substrs = ['fake_a=16777216']) - self.runCmd("type summary add --summary-string \"fake_a=${var.fake_a}\" foo") - self.expect('frame variable f00_1', - substrs = ['fake_a=16777216']) - self.runCmd("type summary add --summary-string \"fake_a=${var[1]}\" foo") - self.expect('frame variable f00_1', - substrs = ['fake_a=16777216']) + #self.runCmd("type summary add --summary-string \"fake_a=${var.fake_a}\" foo") + #self.expect('frame variable f00_1', + # substrs = ['fake_a=16777216']) + #self.runCmd("type summary add --summary-string \"fake_a=${var[1]}\" foo") + #self.expect('frame variable f00_1', + # substrs = ['fake_a=16777216']) self.runCmd("type summary add --summary-string \"fake_a=${svar[1]}\" foo") self.expect('frame variable f00_1', substrs = ['fake_a=16777216']) @@ -221,561 +217,6 @@ class PythonSynthDataFormatterTestCase(TestBase): 'C', 'D']) - # now start playing with STL containers - # having std::<class_type> here is a workaround for rdar://problem/9835692 - - - # std::vector - #self.runCmd("script from StdVectorSynthProvider import *") - #self.runCmd("type synth add -l StdVectorSynthProvider std::int_vect int_vect") - #self.runCmd("type synth add -l StdVectorSynthProvider std::string_vect string_vect") - - self.runCmd("n") - - # empty vectors (and storage pointers SHOULD BOTH BE NULL..) - self.expect("frame variable numbers", - substrs = ['numbers = {}']) - - self.runCmd("n") - - # first value added - self.expect("frame variable numbers", - substrs = ['numbers = {', - '[0] = 1', - '}']) - - # add some more data - self.runCmd("n");self.runCmd("n");self.runCmd("n"); - - self.expect("frame variable numbers", - substrs = ['numbers = {', - '[0] = 1', - '[1] = 12', - '[2] = 123', - '[3] = 1234', - '}']) - - self.expect("p numbers", - substrs = ['$', '= {', - '[0] = 1', - '[1] = 12', - '[2] = 123', - '[3] = 1234', - '}']) - - - # check access to synthetic children - self.runCmd("type summary add --summary-string \"item 0 is ${var[0]}\" std::int_vect int_vect") - self.expect('frame variable numbers', - substrs = ['item 0 is 1']); - - self.runCmd("type summary add --summary-string \"item 0 is ${svar[0]}\" std::int_vect int_vect") - #import time - #time.sleep(19) - self.expect('frame variable numbers', - substrs = ['item 0 is 1']); - # move on with synths - self.runCmd("type summary delete std::int_vect") - self.runCmd("type summary delete int_vect") - - # add some more data - self.runCmd("n");self.runCmd("n");self.runCmd("n"); - - self.expect("frame variable numbers", - substrs = ['numbers = {', - '[0] = 1', - '[1] = 12', - '[2] = 123', - '[3] = 1234', - '[4] = 12345', - '[5] = 123456', - '[6] = 1234567', - '}']) - - self.expect("p numbers", - substrs = ['$', ' = {', - '[0] = 1', - '[1] = 12', - '[2] = 123', - '[3] = 1234', - '[4] = 12345', - '[5] = 123456', - '[6] = 1234567', - '}']) - - # check access-by-index - self.expect("frame variable numbers[0]", - substrs = ['1']); - self.expect("frame variable numbers[1]", - substrs = ['12']); - self.expect("frame variable numbers[2]", - substrs = ['123']); - self.expect("frame variable numbers[3]", - substrs = ['1234']); - - # but check that expression does not rely on us - # (when expression gets to call into STL code correctly, we will have to find - # another way to check this) - self.expect("expression numbers[6]", matching=False, error=True, - substrs = ['1234567']) - - # clear out the vector and see that we do the right thing once again - self.runCmd("n") - - self.expect("frame variable numbers", - substrs = ['numbers = {}']) - - self.runCmd("n") - - # first value added - self.expect("frame variable numbers", - substrs = ['numbers = {', - '[0] = 7', - '}']) - - # check if we can display strings - self.runCmd("n") - self.runCmd("n") - self.runCmd("n") - self.runCmd("n") - - self.expect("frame variable strings", - substrs = ['goofy', - 'is', - 'smart']) - - self.expect("p strings", - substrs = ['goofy', - 'is', - 'smart']) - - # test summaries based on synthetic children - self.runCmd("type summary add std::string_vect string_vect --summary-string \"vector has ${svar%#} items\" -e") - self.expect("frame variable strings", - substrs = ['vector has 3 items', - 'goofy', - 'is', - 'smart']) - - self.expect("p strings", - substrs = ['vector has 3 items', - 'goofy', - 'is', - 'smart']) - - self.runCmd("n"); - - self.expect("frame variable strings", - substrs = ['vector has 4 items']) - - # check access-by-index - self.expect("frame variable strings[0]", - substrs = ['goofy']); - self.expect("frame variable strings[1]", - substrs = ['is']); - - # but check that expression does not rely on us - # (when expression gets to call into STL code correctly, we will have to find - # another way to check this) - self.expect("expression strings[0]", matching=False, error=True, - substrs = ['goofy']) - - self.runCmd("n") - - self.expect("frame variable strings", - substrs = ['vector has 0 items']) - - # now test std::list - #self.runCmd("script from StdListSynthProvider import *") - - self.runCmd("n") - - self.runCmd("frame variable numbers_list -T") - #self.runCmd("type synth add std::int_list std::string_list int_list string_list -l StdListSynthProvider") - self.runCmd("type summary add std::int_list std::string_list int_list string_list --summary-string \"list has ${svar%#} items\" -e") - self.runCmd("type format add -f hex int") - - self.expect("frame variable numbers_list --raw", matching=False, - substrs = ['list has 0 items', - '{}']) - - self.expect("frame variable numbers_list", - substrs = ['list has 0 items', - '{}']) - - self.expect("p numbers_list", - substrs = ['list has 0 items', - '{}']) - - self.runCmd("n") - - self.expect("frame variable numbers_list", - substrs = ['list has 1 items', - '[0] = ', - '0x12345678']) - - self.runCmd("n");self.runCmd("n");self.runCmd("n"); - - self.expect("frame variable numbers_list", - substrs = ['list has 4 items', - '[0] = ', - '0x12345678', - '[1] =', - '0x11223344', - '[2] =', - '0xbeeffeed', - '[3] =', - '0x00abba00']) - - self.runCmd("n");self.runCmd("n"); - - self.expect("frame variable numbers_list", - substrs = ['list has 6 items', - '[0] = ', - '0x12345678', - '0x11223344', - '0xbeeffeed', - '0x00abba00', - '[4] =', - '0x0abcdef0', - '[5] =', - '0x0cab0cab']) - - self.expect("p numbers_list", - substrs = ['list has 6 items', - '[0] = ', - '0x12345678', - '0x11223344', - '0xbeeffeed', - '0x00abba00', - '[4] =', - '0x0abcdef0', - '[5] =', - '0x0cab0cab']) - - # check access-by-index - self.expect("frame variable numbers_list[0]", - substrs = ['0x12345678']); - self.expect("frame variable numbers_list[1]", - substrs = ['0x11223344']); - - # but check that expression does not rely on us - self.expect("expression numbers_list[0]", matching=False, error=True, - substrs = ['0x12345678']) - - self.runCmd("n") - - self.expect("frame variable numbers_list", - substrs = ['list has 0 items', - '{}']) - - self.runCmd("n");self.runCmd("n");self.runCmd("n");self.runCmd("n"); - - self.expect("frame variable numbers_list", - substrs = ['list has 4 items', - '[0] = ', '1', - '[1] = ', '2', - '[2] = ', '3', - '[3] = ', '4']) - - self.runCmd("type format delete int") - - self.runCmd("n") - - self.expect("frame variable text_list", - substrs = ['list has 0 items', - '{}']) - - self.runCmd("n");self.runCmd("n");self.runCmd("n");self.runCmd("n"); - - self.expect("frame variable text_list", - substrs = ['list has 4 items', - '[0]', 'goofy', - '[1]', 'is', - '[2]', 'smart', - '[3]', '!!!']) - - self.expect("p text_list", - substrs = ['list has 4 items', - '[0] = \"goofy\"', - '[1] = \"is\"', - '[2] = \"smart\"', - '[3] = \"!!!\"']) - - # check access-by-index - self.expect("frame variable text_list[0]", - substrs = ['goofy']); - self.expect("frame variable text_list[3]", - substrs = ['!!!']); - - # but check that expression does not rely on us - self.expect("expression text_list[0]", matching=False, error=True, - substrs = ['goofy']) - - # now std::map<K,V> - # also take a chance to test regex synth here - - self.runCmd("n") - self.runCmd("frame variable ii -T") - - #self.runCmd("script from StdMapSynthProvider import *") - self.runCmd("type summary add -x \"std::map<\" --summary-string \"map has ${svar%#} items\" -e") - - #import time - #time.sleep(30) - - #self.runCmd("type synth add -x \"std::map<\" -l StdMapSynthProvider") - - - self.expect('frame variable ii', - substrs = ['map has 0 items', - '{}']) - - self.runCmd("n");self.runCmd("n"); - - self.expect('frame variable ii', - substrs = ['map has 2 items', - '[0] = {', - 'first = 0', - 'second = 0', - '[1] = {', - 'first = 1', - 'second = 1']) - - self.runCmd("n");self.runCmd("n"); - - self.expect('frame variable ii', - substrs = ['map has 4 items', - '[2] = {', - 'first = 2', - 'second = 0', - '[3] = {', - 'first = 3', - 'second = 1']) - - self.runCmd("n");self.runCmd("n"); - self.runCmd("n");self.runCmd("n");self.runCmd("n"); - - self.expect("frame variable ii", - substrs = ['map has 9 items', - '[5] = {', - 'first = 5', - 'second = 0', - '[7] = {', - 'first = 7', - 'second = 1']) - - self.expect("p ii", - substrs = ['map has 9 items', - '[5] = {', - 'first = 5', - 'second = 0', - '[7] = {', - 'first = 7', - 'second = 1']) - - # check access-by-index - self.expect("frame variable ii[0]", - substrs = ['first = 0', - 'second = 0']); - self.expect("frame variable ii[3]", - substrs = ['first =', - 'second =']); - - # but check that expression does not rely on us - self.expect("expression ii[0]", matching=False, error=True, - substrs = ['first = 0']) - - self.runCmd("n") - - self.expect('frame variable ii', - substrs = ['map has 0 items', - '{}']) - - self.runCmd("n") - self.runCmd("frame variable si -T") - - #self.runCmd("type summary add std::strint_map strint_map --summary-string \"map has ${svar%#} items\" -e") - #self.runCmd("type synth add std::strint_map strint_map -l StdMapSynthProvider") - - self.expect('frame variable si', - substrs = ['map has 0 items', - '{}']) - - self.runCmd("n") - - self.expect('frame variable si', - substrs = ['map has 1 items', - '[0] = ', - 'first = \"zero\"', - 'second = 0']) - - self.runCmd("n");self.runCmd("n");self.runCmd("n");self.runCmd("n"); - - self.expect("frame variable si", - substrs = ['map has 5 items', - '[0] = ', - 'first = \"zero\"', - 'second = 0', - '[1] = ', - 'first = \"one\"', - 'second = 1', - '[2] = ', - 'first = \"two\"', - 'second = 2', - '[3] = ', - 'first = \"three\"', - 'second = 3', - '[4] = ', - 'first = \"four\"', - 'second = 4']) - - self.expect("p si", - substrs = ['map has 5 items', - '[0] = ', - 'first = \"zero\"', - 'second = 0', - '[1] = ', - 'first = \"one\"', - 'second = 1', - '[2] = ', - 'first = \"two\"', - 'second = 2', - '[3] = ', - 'first = \"three\"', - 'second = 3', - '[4] = ', - 'first = \"four\"', - 'second = 4']) - - # check access-by-index - self.expect("frame variable si[0]", - substrs = ['first = ', 'four', - 'second = 4']); - - # but check that expression does not rely on us - self.expect("expression si[0]", matching=False, error=True, - substrs = ['first = ', 'zero']) - - self.runCmd("n") - - self.expect('frame variable si', - substrs = ['map has 0 items', - '{}']) - - self.runCmd("n") - self.runCmd("frame variable is -T") - - #self.runCmd("type summary add std::intstr_map intstr_map --summary-string \"map has ${svar%#} items\" -e") - #self.runCmd("type synth add std::intstr_map intstr_map -l StdMapSynthProvider") - - self.expect('frame variable is', - substrs = ['map has 0 items', - '{}']) - - self.runCmd("n");self.runCmd("n");self.runCmd("n");self.runCmd("n"); - - self.expect("frame variable is", - substrs = ['map has 4 items', - '[0] = ', - 'second = \"goofy\"', - 'first = 0', - '[1] = ', - 'second = \"is\"', - 'first = 1', - '[2] = ', - 'second = \"smart\"', - 'first = 2', - '[3] = ', - 'second = \"!!!\"', - 'first = 3']) - - self.expect("p is", - substrs = ['map has 4 items', - '[0] = ', - 'second = \"goofy\"', - 'first = 0', - '[1] = ', - 'second = \"is\"', - 'first = 1', - '[2] = ', - 'second = \"smart\"', - 'first = 2', - '[3] = ', - 'second = \"!!!\"', - 'first = 3']) - - # check access-by-index - self.expect("frame variable is[0]", - substrs = ['first = ', '0', - 'second =', 'goofy']); - - # but check that expression does not rely on us - self.expect("expression is[0]", matching=False, error=True, - substrs = ['first = ', 'goofy']) - - self.runCmd("n") - - self.expect('frame variable is', - substrs = ['map has 0 items', - '{}']) - - self.runCmd("n") - self.runCmd("frame variable ss -T") - - #self.runCmd("type summary add std::strstr_map strstr_map --summary-string \"map has ${svar%#} items\" -e") - #self.runCmd("type synth add std::strstr_map strstr_map -l StdMapSynthProvider") - - self.expect('frame variable ss', - substrs = ['map has 0 items', - '{}']) - - self.runCmd("n");self.runCmd("n");self.runCmd("n");self.runCmd("n"); - - self.expect("frame variable ss", - substrs = ['map has 4 items', - '[0] = ', - 'second = \"hello\"', - 'first = \"ciao\"', - '[1] = ', - 'second = \"house\"', - 'first = \"casa\"', - '[2] = ', - 'second = \"cat\"', - 'first = \"gatto\"', - '[3] = ', - 'second = \"..is always a Mac!\"', - 'first = \"a Mac..\"']) - - self.expect("p ss", - substrs = ['map has 4 items', - '[0] = ', - 'second = \"hello\"', - 'first = \"ciao\"', - '[1] = ', - 'second = \"house\"', - 'first = \"casa\"', - '[2] = ', - 'second = \"cat\"', - 'first = \"gatto\"', - '[3] = ', - 'second = \"..is always a Mac!\"', - 'first = \"a Mac..\"']) - - # check access-by-index - self.expect("frame variable ss[3]", - substrs = ['gatto', 'cat']); - - # but check that expression does not rely on us - self.expect("expression ss[3]", matching=False, error=True, - substrs = ['gatto']) - - self.runCmd("n") - - self.expect('frame variable ss', - substrs = ['map has 0 items', - '{}']) - if __name__ == '__main__': import atexit lldb.SBDebugger.Initialize() diff --git a/lldb/test/functionalities/data-formatter/data-formatter-python-synth/main.cpp b/lldb/test/functionalities/data-formatter/data-formatter-python-synth/main.cpp index 67f04e721d2..b921915b91c 100644 --- a/lldb/test/functionalities/data-formatter/data-formatter-python-synth/main.cpp +++ b/lldb/test/functionalities/data-formatter/data-formatter-python-synth/main.cpp @@ -1,18 +1,3 @@ -#include <list> -#include <map> -#include <string> -#include <vector> -typedef std::vector<int> int_vect; -typedef std::vector<std::string> string_vect; - -typedef std::list<int> int_list; -typedef std::list<std::string> string_list; - -#define intint_map std::map<int, int> -#define strint_map std::map<std::string, int> -#define intstr_map std::map<int, std::string> -#define strstr_map std::map<std::string, std::string> - struct foo { int a; @@ -73,92 +58,5 @@ int main() 256*256*'C'+ 256*256*256*'D'); - int_vect numbers; - numbers.push_back(1); - numbers.push_back(12); - numbers.push_back(123); - numbers.push_back(1234); - numbers.push_back(12345); - numbers.push_back(123456); - numbers.push_back(1234567); - - numbers.clear(); - - numbers.push_back(7); - - string_vect strings; - strings.push_back(std::string("goofy")); - strings.push_back(std::string("is")); - strings.push_back(std::string("smart")); - - strings.push_back(std::string("!!!")); - - strings.clear(); - - int_list numbers_list; - - numbers_list.push_back(0x12345678); - numbers_list.push_back(0x11223344); - numbers_list.push_back(0xBEEFFEED); - numbers_list.push_back(0x00ABBA00); - numbers_list.push_back(0x0ABCDEF0); - numbers_list.push_back(0x0CAB0CAB); - - numbers_list.clear(); - - numbers_list.push_back(1); - numbers_list.push_back(2); - numbers_list.push_back(3); - numbers_list.push_back(4); - - string_list text_list; - text_list.push_back(std::string("goofy")); - text_list.push_back(std::string("is")); - text_list.push_back(std::string("smart")); - - text_list.push_back(std::string("!!!")); - - intint_map ii; - - ii[0] = 0; - ii[1] = 1; - ii[2] = 0; - ii[3] = 1; - ii[4] = 0; - ii[5] = 1; - ii[6] = 0; - ii[7] = 1; - ii[8] = 0; - - ii.clear(); - - strint_map si; - - si["zero"] = 0; - si["one"] = 1; - si["two"] = 2; - si["three"] = 3; - si["four"] = 4; - - si.clear(); - - intstr_map is; - - is[0] = "goofy"; - is[1] = "is"; - is[2] = "smart"; - is[3] = "!!!"; - - is.clear(); - - strstr_map ss; - - ss["ciao"] = "hello"; - ss["casa"] = "house"; - ss["gatto"] = "cat"; - ss["a Mac.."] = "..is always a Mac!"; - - ss.clear(); - return 0; }
\ No newline at end of file |