diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-01-02 19:26:05 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-01-02 19:26:05 +0000 |
commit | 14f1b3e8826ce43b978db93a62d1166055db5394 (patch) | |
tree | 0a00ad8d3498783fe0193f3b656bca17c4c8697d /packages/Python/lldbsuite/test/tools/lldb-mi/variable | |
parent | 4ee8c119c71a06dcad1e0fecc8c675e480e59337 (diff) |
Notes
Diffstat (limited to 'packages/Python/lldbsuite/test/tools/lldb-mi/variable')
-rw-r--r-- | packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiGdbSetShowPrint.py | 262 | ||||
-rw-r--r-- | packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiVar.py | 203 |
2 files changed, 305 insertions, 160 deletions
diff --git a/packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiGdbSetShowPrint.py b/packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiGdbSetShowPrint.py index 5ce2b99bbdee5..61d54cab055a9 100644 --- a/packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiGdbSetShowPrint.py +++ b/packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiGdbSetShowPrint.py @@ -1,4 +1,4 @@ -#coding=utf8 +# coding=utf8 """ Test lldb-mi -gdb-set and -gdb-show commands for 'print option-name'. """ @@ -6,12 +6,12 @@ Test lldb-mi -gdb-set and -gdb-show commands for 'print option-name'. from __future__ import print_function - import lldbmi_testcase from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil + class MiGdbSetShowTestCase(lldbmi_testcase.MiTestCaseBase): mydir = TestBase.compute_mydir(__file__) @@ -19,28 +19,34 @@ class MiGdbSetShowTestCase(lldbmi_testcase.MiTestCaseBase): # evaluates array when char-array-as-string is off def eval_and_check_array(self, var, typ, length): self.runCmd("-var-create - * %s" % var) - self.expect('\^done,name="var\d+",numchild="%d",value="\[%d\]",type="%s \[%d\]",thread-id="1",has_more="0"' % (length, length, typ, length)) + self.expect( + '\^done,name="var\d+",numchild="%d",value="\[%d\]",type="%s \[%d\]",thread-id="1",has_more="0"' % + (length, length, typ, length)) # evaluates any type which can be represented as string of characters def eval_and_match_string(self, var, value, typ): - value=value.replace("\\", "\\\\").replace("\"", "\\\"") + value = value.replace("\\", "\\\\").replace("\"", "\\\"") self.runCmd("-var-create - * " + var) - self.expect('\^done,name="var\d+",numchild="[0-9]+",value="%s",type="%s",thread-id="1",has_more="0"' % (value, typ)) + self.expect( + '\^done,name="var\d+",numchild="[0-9]+",value="%s",type="%s",thread-id="1",has_more="0"' % + (value, typ)) - @skipIfWindows #llvm.org/pr24452: Get lldb-mi working on Windows - @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races - @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots + @skipIfWindows # llvm.org/pr24452: Get lldb-mi working on Windows + @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races + @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots def test_lldbmi_gdb_set_show_print_char_array_as_string(self): """Test that 'lldb-mi --interpreter' can print array of chars as string.""" - self.spawnLldbMi(args = None) + self.spawnLldbMi(args=None) # Load executable self.runCmd("-file-exec-and-symbols %s" % self.myexe) self.expect("\^done") # Run to BP_gdb_set_show_print_char_array_as_string_test - line = line_number('main.cpp', '// BP_gdb_set_show_print_char_array_as_string_test') + line = line_number( + 'main.cpp', + '// BP_gdb_set_show_print_char_array_as_string_test') self.runCmd("-break-insert main.cpp:%d" % line) self.expect("\^done,bkpt={number=\"1\"") self.runCmd("-exec-run") @@ -51,23 +57,38 @@ class MiGdbSetShowTestCase(lldbmi_testcase.MiTestCaseBase): self.runCmd("-gdb-show print char-array-as-string") self.expect("\^done,value=\"off\"") - # Test that a char* is expanded to string when print char-array-as-string is "off" - self.eval_and_match_string("cp", r'0x[0-9a-f]+ \"\\t\\\"hello\\\"\\n\"', r'const char \*') - - # Test that a char[] isn't expanded to string when print char-array-as-string is "off" - self.eval_and_check_array("ca", "const char", 10); - - # Test that a char16_t* is expanded to string when print char-array-as-string is "off" - self.eval_and_match_string("u16p", r'0x[0-9a-f]+ u\"\\t\\\"hello\\\"\\n\"', r'const char16_t \*') - - # Test that a char16_t[] isn't expanded to string when print char-array-as-string is "off" - self.eval_and_check_array("u16a", "const char16_t", 10); - - # Test that a char32_t* is expanded to string when print char-array-as-string is "off" - self.eval_and_match_string("u32p", r'0x[0-9a-f]+ U\"\\t\\\"hello\\\"\\n\"', r'const char32_t \*') - - # Test that a char32_t[] isn't expanded to string when print char-array-as-string is "off" - self.eval_and_check_array("u32a", "const char32_t", 10); + # Test that a char* is expanded to string when print + # char-array-as-string is "off" + self.eval_and_match_string( + "cp", + r'0x[0-9a-f]+ \"\\t\\\"hello\\\"\\n\"', + r'const char \*') + + # Test that a char[] isn't expanded to string when print + # char-array-as-string is "off" + self.eval_and_check_array("ca", "const char", 10) + + # Test that a char16_t* is expanded to string when print + # char-array-as-string is "off" + self.eval_and_match_string( + "u16p", + r'0x[0-9a-f]+ u\"\\t\\\"hello\\\"\\n\"', + r'const char16_t \*') + + # Test that a char16_t[] isn't expanded to string when print + # char-array-as-string is "off" + self.eval_and_check_array("u16a", "const char16_t", 10) + + # Test that a char32_t* is expanded to string when print + # char-array-as-string is "off" + self.eval_and_match_string( + "u32p", + r'0x[0-9a-f]+ U\"\\t\\\"hello\\\"\\n\"', + r'const char32_t \*') + + # Test that a char32_t[] isn't expanded to string when print + # char-array-as-string is "off" + self.eval_and_check_array("u32a", "const char32_t", 10) # Test that -gdb-set can set print char-array-as-string flag self.runCmd("-gdb-set print char-array-as-string on") @@ -77,52 +98,94 @@ class MiGdbSetShowTestCase(lldbmi_testcase.MiTestCaseBase): self.runCmd("-gdb-show print char-array-as-string") self.expect("\^done,value=\"on\"") - # Test that a char* with escape chars is expanded to string when print char-array-as-string is "on" - self.eval_and_match_string("cp", r'0x[0-9a-f]+ \"\\t\\\"hello\\\"\\n\"', r'const char \*') - - # Test that a char[] with escape chars is expanded to string when print char-array-as-string is "on" - self.eval_and_match_string("ca", r'\"\\t\\\"hello\\\"\\n\"', r'const char \[10\]') - - # Test that a char16_t* with escape chars is expanded to string when print char-array-as-string is "on" - self.eval_and_match_string("u16p", r'0x[0-9a-f]+ u\"\\t\\\"hello\\\"\\n\"', r'const char16_t \*') - - # Test that a char16_t[] with escape chars is expanded to string when print char-array-as-string is "on" - self.eval_and_match_string("u16a", r'u\"\\t\\\"hello\\\"\\n\"', r'const char16_t \[10\]') - - # Test that a char32_t* with escape chars is expanded to string when print char-array-as-string is "on" - self.eval_and_match_string("u32p", r'0x[0-9a-f]+ U\"\\t\\\"hello\\\"\\n\"', r'const char32_t \*') - - # Test that a char32_t[] with escape chars is expanded to string when print char-array-as-string is "on" - self.eval_and_match_string("u32a", r'U\"\\t\\\"hello\\\"\\n\"', r'const char32_t \[10\]') + # Test that a char* with escape chars is expanded to string when print + # char-array-as-string is "on" + self.eval_and_match_string( + "cp", + r'0x[0-9a-f]+ \"\\t\\\"hello\\\"\\n\"', + r'const char \*') + + # Test that a char[] with escape chars is expanded to string when print + # char-array-as-string is "on" + self.eval_and_match_string( + "ca", + r'\"\\t\\\"hello\\\"\\n\"', + r'const char \[10\]') + + # Test that a char16_t* with escape chars is expanded to string when + # print char-array-as-string is "on" + self.eval_and_match_string( + "u16p", + r'0x[0-9a-f]+ u\"\\t\\\"hello\\\"\\n\"', + r'const char16_t \*') + + # Test that a char16_t[] with escape chars is expanded to string when + # print char-array-as-string is "on" + self.eval_and_match_string( + "u16a", + r'u\"\\t\\\"hello\\\"\\n\"', + r'const char16_t \[10\]') + + # Test that a char32_t* with escape chars is expanded to string when + # print char-array-as-string is "on" + self.eval_and_match_string( + "u32p", + r'0x[0-9a-f]+ U\"\\t\\\"hello\\\"\\n\"', + r'const char32_t \*') + + # Test that a char32_t[] with escape chars is expanded to string when + # print char-array-as-string is "on" + self.eval_and_match_string( + "u32a", + r'U\"\\t\\\"hello\\\"\\n\"', + r'const char32_t \[10\]') # Test russian unicode strings - self.eval_and_match_string("u16p_rus", r'0x[0-9a-f]+ u\"\\\\Аламо-сквер\"', r'const char16_t \*') - self.eval_and_match_string("u16a_rus", r'u\"\\\\Бейвью\"', r'const char16_t \[8\]') - self.eval_and_match_string("u32p_rus", r'0x[0-9a-f]+ U\"\\\\Чайнатаун\"', r'const char32_t \*') - self.eval_and_match_string("u32a_rus", r'U\"\\\\Догпатч\"', r'const char32_t \[9\]') - - # Test that -gdb-set print char-array-as-string fails if "on"/"off" isn't specified + self.eval_and_match_string( + "u16p_rus", + r'0x[0-9a-f]+ u\"\\\\Аламо-сквер\"', + r'const char16_t \*') + self.eval_and_match_string( + "u16a_rus", + r'u\"\\\\Бейвью\"', + r'const char16_t \[8\]') + self.eval_and_match_string( + "u32p_rus", + r'0x[0-9a-f]+ U\"\\\\Чайнатаун\"', + r'const char32_t \*') + self.eval_and_match_string( + "u32a_rus", + r'U\"\\\\Догпатч\"', + r'const char32_t \[9\]') + + # Test that -gdb-set print char-array-as-string fails if "on"/"off" + # isn't specified self.runCmd("-gdb-set print char-array-as-string") - self.expect("\^error,msg=\"The request ''print' expects option-name and \"on\" or \"off\"' failed.\"") + self.expect( + "\^error,msg=\"The request ''print' expects option-name and \"on\" or \"off\"' failed.\"") - # Test that -gdb-set print char-array-as-string fails when option is unknown + # Test that -gdb-set print char-array-as-string fails when option is + # unknown self.runCmd("-gdb-set print char-array-as-string unknown") - self.expect("\^error,msg=\"The request ''print' expects option-name and \"on\" or \"off\"' failed.\"") + self.expect( + "\^error,msg=\"The request ''print' expects option-name and \"on\" or \"off\"' failed.\"") - @skipIfWindows #llvm.org/pr24452: Get lldb-mi working on Windows + @skipIfWindows # llvm.org/pr24452: Get lldb-mi working on Windows @expectedFailureAll(compiler="gcc", bugnumber="llvm.org/pr23357") - @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races + @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races def test_lldbmi_gdb_set_show_print_expand_aggregates(self): """Test that 'lldb-mi --interpreter' can expand aggregates everywhere.""" - self.spawnLldbMi(args = None) + self.spawnLldbMi(args=None) # Load executable self.runCmd("-file-exec-and-symbols %s" % self.myexe) self.expect("\^done") # Run to BP_gdb_set_show_print_expand_aggregates - line = line_number('main.cpp', '// BP_gdb_set_show_print_expand_aggregates') + line = line_number( + 'main.cpp', + '// BP_gdb_set_show_print_expand_aggregates') self.runCmd("-break-insert main.cpp:%d" % line) self.expect("\^done,bkpt={number=\"1\"") self.runCmd("-exec-run") @@ -133,16 +196,21 @@ class MiGdbSetShowTestCase(lldbmi_testcase.MiTestCaseBase): self.runCmd("-gdb-show print expand-aggregates") self.expect("\^done,value=\"off\"") - # Test that composite type isn't expanded when print expand-aggregates is "off" + # Test that composite type isn't expanded when print expand-aggregates + # is "off" self.runCmd("-var-create var1 * complx") - self.expect("\^done,name=\"var1\",numchild=\"3\",value=\"{\.\.\.}\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"") + self.expect( + "\^done,name=\"var1\",numchild=\"3\",value=\"{\.\.\.}\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"") - # Test that composite type[] isn't expanded when print expand-aggregates is "off" + # Test that composite type[] isn't expanded when print + # expand-aggregates is "off" self.eval_and_check_array("complx_array", "complex_type", 2) - # Test that a struct with a char first element is not formatted as a string + # Test that a struct with a char first element is not formatted as a + # string self.runCmd("-var-create - * &nstr") - self.expect("\^done,name=\"var\d+\",numchild=\"2\",value=\"0x[0-9a-f]+\",type=\"not_str \*\",thread-id=\"1\",has_more=\"0\"") + self.expect( + "\^done,name=\"var\d+\",numchild=\"2\",value=\"0x[0-9a-f]+\",type=\"not_str \*\",thread-id=\"1\",has_more=\"0\"") # Test that -gdb-set can set print expand-aggregates flag self.runCmd("-gdb-set print expand-aggregates on") @@ -152,36 +220,46 @@ class MiGdbSetShowTestCase(lldbmi_testcase.MiTestCaseBase): self.runCmd("-gdb-show print expand-aggregates") self.expect("\^done,value=\"on\"") - # Test that composite type is expanded when print expand-aggregates is "on" + # Test that composite type is expanded when print expand-aggregates is + # "on" self.runCmd("-var-create var3 * complx") - self.expect("\^done,name=\"var3\",numchild=\"3\",value=\"{i = 3, inner = {l = 3}, complex_ptr = 0x[0-9a-f]+}\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"") + self.expect( + "\^done,name=\"var3\",numchild=\"3\",value=\"{i = 3, inner = {l = 3}, complex_ptr = 0x[0-9a-f]+}\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"") - # Test that composite type[] is expanded when print expand-aggregates is "on" + # Test that composite type[] is expanded when print expand-aggregates + # is "on" self.runCmd("-var-create var4 * complx_array") - self.expect("\^done,name=\"var4\",numchild=\"2\",value=\"{\[0\] = {i = 4, inner = {l = 4}, complex_ptr = 0x[0-9a-f]+}, \[1\] = {i = 5, inner = {l = 5}, complex_ptr = 0x[0-9a-f]+}}\",type=\"complex_type \[2\]\",thread-id=\"1\",has_more=\"0\"") + self.expect( + "\^done,name=\"var4\",numchild=\"2\",value=\"{\[0\] = {i = 4, inner = {l = 4}, complex_ptr = 0x[0-9a-f]+}, \[1\] = {i = 5, inner = {l = 5}, complex_ptr = 0x[0-9a-f]+}}\",type=\"complex_type \[2\]\",thread-id=\"1\",has_more=\"0\"") - # Test that -gdb-set print expand-aggregates fails if "on"/"off" isn't specified + # Test that -gdb-set print expand-aggregates fails if "on"/"off" isn't + # specified self.runCmd("-gdb-set print expand-aggregates") - self.expect("\^error,msg=\"The request ''print' expects option-name and \"on\" or \"off\"' failed.\"") + self.expect( + "\^error,msg=\"The request ''print' expects option-name and \"on\" or \"off\"' failed.\"") - # Test that -gdb-set print expand-aggregates fails when option is unknown + # Test that -gdb-set print expand-aggregates fails when option is + # unknown self.runCmd("-gdb-set print expand-aggregates unknown") - self.expect("\^error,msg=\"The request ''print' expects option-name and \"on\" or \"off\"' failed.\"") + self.expect( + "\^error,msg=\"The request ''print' expects option-name and \"on\" or \"off\"' failed.\"") - @skipIfWindows #llvm.org/pr24452: Get lldb-mi working on Windows + @skipIfWindows # llvm.org/pr24452: Get lldb-mi working on Windows @expectedFailureAll(compiler="gcc", bugnumber="llvm.org/pr23357") - @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races + @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races def test_lldbmi_gdb_set_show_print_aggregate_field_names(self): """Test that 'lldb-mi --interpreter' can expand aggregates everywhere.""" - self.spawnLldbMi(args = None) + self.spawnLldbMi(args=None) # Load executable self.runCmd("-file-exec-and-symbols %s" % self.myexe) self.expect("\^done") # Run to BP_gdb_set_show_print_aggregate_field_names - line = line_number('main.cpp', '// BP_gdb_set_show_print_aggregate_field_names') + line = line_number( + 'main.cpp', + '// BP_gdb_set_show_print_aggregate_field_names') self.runCmd("-break-insert main.cpp:%d" % line) self.expect("\^done,bkpt={number=\"1\"") self.runCmd("-exec-run") @@ -196,13 +274,17 @@ class MiGdbSetShowTestCase(lldbmi_testcase.MiTestCaseBase): self.runCmd("-gdb-set print expand-aggregates on") self.expect("\^done") - # Test that composite type is expanded with field name when print aggregate-field-names is "on" + # Test that composite type is expanded with field name when print + # aggregate-field-names is "on" self.runCmd("-var-create var1 * complx") - self.expect("\^done,name=\"var1\",numchild=\"3\",value=\"{i = 3, inner = {l = 3}, complex_ptr = 0x[0-9a-f]+}\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"") + self.expect( + "\^done,name=\"var1\",numchild=\"3\",value=\"{i = 3, inner = {l = 3}, complex_ptr = 0x[0-9a-f]+}\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"") - # Test that composite type[] is expanded with field name when print aggregate-field-names is "on" + # Test that composite type[] is expanded with field name when print + # aggregate-field-names is "on" self.runCmd("-var-create var2 * complx_array") - self.expect("\^done,name=\"var2\",numchild=\"2\",value=\"{\[0\] = {i = 4, inner = {l = 4}, complex_ptr = 0x[0-9a-f]+}, \[1\] = {i = 5, inner = {l = 5}, complex_ptr = 0x[0-9a-f]+}}\",type=\"complex_type \[2\]\",thread-id=\"1\",has_more=\"0\"") + self.expect( + "\^done,name=\"var2\",numchild=\"2\",value=\"{\[0\] = {i = 4, inner = {l = 4}, complex_ptr = 0x[0-9a-f]+}, \[1\] = {i = 5, inner = {l = 5}, complex_ptr = 0x[0-9a-f]+}}\",type=\"complex_type \[2\]\",thread-id=\"1\",has_more=\"0\"") # Test that -gdb-set can set print aggregate-field-names flag self.runCmd("-gdb-set print aggregate-field-names off") @@ -212,18 +294,26 @@ class MiGdbSetShowTestCase(lldbmi_testcase.MiTestCaseBase): self.runCmd("-gdb-show print aggregate-field-names") self.expect("\^done,value=\"off\"") - # Test that composite type is expanded without field name when print aggregate-field-names is "off" + # Test that composite type is expanded without field name when print + # aggregate-field-names is "off" self.runCmd("-var-create var3 * complx") - self.expect("\^done,name=\"var3\",numchild=\"3\",value=\"{3,\{3\},0x[0-9a-f]+}\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"") + self.expect( + "\^done,name=\"var3\",numchild=\"3\",value=\"{3,\{3\},0x[0-9a-f]+}\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"") - # Test that composite type[] is expanded without field name when print aggregate-field-names is "off" + # Test that composite type[] is expanded without field name when print + # aggregate-field-names is "off" self.runCmd("-var-create var4 * complx_array") - self.expect("\^done,name=\"var4\",numchild=\"2\",value=\"{{4,\{4\},0x[0-9a-f]+},{5,\{5\},0x[0-9a-f]+}}\",type=\"complex_type \[2\]\",thread-id=\"1\",has_more=\"0\"") + self.expect( + "\^done,name=\"var4\",numchild=\"2\",value=\"{{4,\{4\},0x[0-9a-f]+},{5,\{5\},0x[0-9a-f]+}}\",type=\"complex_type \[2\]\",thread-id=\"1\",has_more=\"0\"") - # Test that -gdb-set print aggregate-field-names fails if "on"/"off" isn't specified + # Test that -gdb-set print aggregate-field-names fails if "on"/"off" + # isn't specified self.runCmd("-gdb-set print aggregate-field-names") - self.expect("\^error,msg=\"The request ''print' expects option-name and \"on\" or \"off\"' failed.\"") + self.expect( + "\^error,msg=\"The request ''print' expects option-name and \"on\" or \"off\"' failed.\"") - # Test that -gdb-set print aggregate-field-names fails when option is unknown + # Test that -gdb-set print aggregate-field-names fails when option is + # unknown self.runCmd("-gdb-set print aggregate-field-names unknown") - self.expect("\^error,msg=\"The request ''print' expects option-name and \"on\" or \"off\"' failed.\"") + self.expect( + "\^error,msg=\"The request ''print' expects option-name and \"on\" or \"off\"' failed.\"") diff --git a/packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiVar.py b/packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiVar.py index 51f02b9e4a740..b76b59ab97e31 100644 --- a/packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiVar.py +++ b/packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiVar.py @@ -5,22 +5,22 @@ Test lldb-mi -var-xxx commands. from __future__ import print_function - import lldbmi_testcase from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil + class MiVarTestCase(lldbmi_testcase.MiTestCaseBase): mydir = TestBase.compute_mydir(__file__) - @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows - @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races + @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows + @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races def test_lldbmi_eval(self): """Test that 'lldb-mi --interpreter' works for evaluating.""" - self.spawnLldbMi(args = None) + self.spawnLldbMi(args=None) # Load executable self.runCmd("-file-exec-and-symbols %s" % self.myexe) @@ -36,15 +36,18 @@ class MiVarTestCase(lldbmi_testcase.MiTestCaseBase): # Print non-existant variable self.runCmd("-var-create var1 * undef") - self.expect("\^error,msg=\"error: use of undeclared identifier \'undef\'\\\\n\"") + self.expect( + "\^error,msg=\"error: use of undeclared identifier \'undef\'\\\\n\"") self.runCmd("-data-evaluate-expression undef") - self.expect("\^error,msg=\"error: use of undeclared identifier \'undef\'\\\\n\"") + self.expect( + "\^error,msg=\"error: use of undeclared identifier \'undef\'\\\\n\"") # Print global "g_MyVar", modify, delete and create again self.runCmd("-data-evaluate-expression g_MyVar") self.expect("\^done,value=\"3\"") self.runCmd("-var-create var2 * g_MyVar") - self.expect("\^done,name=\"var2\",numchild=\"0\",value=\"3\",type=\"int\",thread-id=\"1\",has_more=\"0\"") + self.expect( + "\^done,name=\"var2\",numchild=\"0\",value=\"3\",type=\"int\",thread-id=\"1\",has_more=\"0\"") self.runCmd("-var-evaluate-expression var2") self.expect("\^done,value=\"3\"") self.runCmd("-var-show-attributes var2") @@ -57,17 +60,20 @@ class MiVarTestCase(lldbmi_testcase.MiTestCaseBase): self.runCmd("-data-evaluate-expression \"g_MyVar=30\"") self.expect("\^done,value=\"30\"") self.runCmd("-var-update --all-values var2") - #self.expect("\^done,changelist=\[\{name=\"var2\",value=\"30\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\]") #FIXME -var-update doesn't work + # self.expect("\^done,changelist=\[\{name=\"var2\",value=\"30\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\]") + # FIXME -var-update doesn't work self.runCmd("-var-delete var2") self.expect("\^done") self.runCmd("-var-create var2 * g_MyVar") - self.expect("\^done,name=\"var2\",numchild=\"0\",value=\"30\",type=\"int\",thread-id=\"1\",has_more=\"0\"") + self.expect( + "\^done,name=\"var2\",numchild=\"0\",value=\"30\",type=\"int\",thread-id=\"1\",has_more=\"0\"") # Print static "s_MyVar", modify, delete and create again self.runCmd("-data-evaluate-expression s_MyVar") self.expect("\^done,value=\"30\"") self.runCmd("-var-create var3 * s_MyVar") - self.expect("\^done,name=\"var3\",numchild=\"0\",value=\"30\",type=\"int\",thread-id=\"1\",has_more=\"0\"") + self.expect( + "\^done,name=\"var3\",numchild=\"0\",value=\"30\",type=\"int\",thread-id=\"1\",has_more=\"0\"") self.runCmd("-var-evaluate-expression var3") self.expect("\^done,value=\"30\"") self.runCmd("-var-show-attributes var3") @@ -77,17 +83,20 @@ class MiVarTestCase(lldbmi_testcase.MiTestCaseBase): self.runCmd("-data-evaluate-expression \"s_MyVar=3\"") self.expect("\^done,value=\"3\"") self.runCmd("-var-update --all-values var3") - #self.expect("\^done,changelist=\[\{name=\"var3\",value=\"3\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\]") #FIXME -var-update doesn't work + # self.expect("\^done,changelist=\[\{name=\"var3\",value=\"3\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\]") + # FIXME -var-update doesn't work self.runCmd("-var-delete var3") self.expect("\^done") self.runCmd("-var-create var3 * s_MyVar") - self.expect("\^done,name=\"var3\",numchild=\"0\",value=\"3\",type=\"int\",thread-id=\"1\",has_more=\"0\"") + self.expect( + "\^done,name=\"var3\",numchild=\"0\",value=\"3\",type=\"int\",thread-id=\"1\",has_more=\"0\"") # Print local "b", modify, delete and create again self.runCmd("-data-evaluate-expression b") self.expect("\^done,value=\"20\"") self.runCmd("-var-create var4 * b") - self.expect("\^done,name=\"var4\",numchild=\"0\",value=\"20\",type=\"int\",thread-id=\"1\",has_more=\"0\"") + self.expect( + "\^done,name=\"var4\",numchild=\"0\",value=\"20\",type=\"int\",thread-id=\"1\",has_more=\"0\"") self.runCmd("-var-evaluate-expression var4") self.expect("\^done,value=\"20\"") self.runCmd("-var-show-attributes var4") @@ -97,44 +106,62 @@ class MiVarTestCase(lldbmi_testcase.MiTestCaseBase): self.runCmd("-data-evaluate-expression \"b=2\"") self.expect("\^done,value=\"2\"") self.runCmd("-var-update --all-values var4") - #self.expect("\^done,changelist=\[\{name=\"var4\",value=\"2\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\]") #FIXME -var-update doesn't work + # self.expect("\^done,changelist=\[\{name=\"var4\",value=\"2\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\]") + # FIXME -var-update doesn't work self.runCmd("-var-delete var4") self.expect("\^done") self.runCmd("-var-create var4 * b") - self.expect("\^done,name=\"var4\",numchild=\"0\",value=\"2\",type=\"int\",thread-id=\"1\",has_more=\"0\"") + self.expect( + "\^done,name=\"var4\",numchild=\"0\",value=\"2\",type=\"int\",thread-id=\"1\",has_more=\"0\"") # Print temp "a + b" self.runCmd("-data-evaluate-expression \"a + b\"") self.expect("\^done,value=\"12\"") self.runCmd("-var-create var5 * \"a + b\"") - self.expect("\^done,name=\"var5\",numchild=\"0\",value=\"12\",type=\"int\",thread-id=\"1\",has_more=\"0\"") + self.expect( + "\^done,name=\"var5\",numchild=\"0\",value=\"12\",type=\"int\",thread-id=\"1\",has_more=\"0\"") self.runCmd("-var-evaluate-expression var5") self.expect("\^done,value=\"12\"") self.runCmd("-var-show-attributes var5") - self.expect("\^done,status=\"editable\"") #FIXME editable or not? + self.expect("\^done,status=\"editable\"") # FIXME editable or not? self.runCmd("-var-list-children var5") self.expect("\^done,numchild=\"0\",has_more=\"0\"") # Print argument "argv[0]" self.runCmd("-data-evaluate-expression \"argv[0]\"") - self.expect("\^done,value=\"0x[0-9a-f]+ \\\\\\\".*?%s\\\\\\\"\"" % self.myexe) + self.expect( + "\^done,value=\"0x[0-9a-f]+ \\\\\\\".*?%s\\\\\\\"\"" % + self.myexe) self.runCmd("-var-create var6 * \"argv[0]\"") - self.expect("\^done,name=\"var6\",numchild=\"1\",value=\"0x[0-9a-f]+ \\\\\\\".*?%s\\\\\\\"\",type=\"const char \*\",thread-id=\"1\",has_more=\"0\"" % self.myexe) + self.expect( + "\^done,name=\"var6\",numchild=\"1\",value=\"0x[0-9a-f]+ \\\\\\\".*?%s\\\\\\\"\",type=\"const char \*\",thread-id=\"1\",has_more=\"0\"" % + self.myexe) self.runCmd("-var-evaluate-expression var6") - self.expect("\^done,value=\"0x[0-9a-f]+ \\\\\\\".*?%s\\\\\\\"\"" % self.myexe) + self.expect( + "\^done,value=\"0x[0-9a-f]+ \\\\\\\".*?%s\\\\\\\"\"" % + self.myexe) self.runCmd("-var-show-attributes var6") self.expect("\^done,status=\"editable\"") self.runCmd("-var-list-children --all-values var6") # FIXME: The name below is not correct. It should be "var.*argv[0]". - self.expect("\^done,numchild=\"1\",children=\[child=\{name=\"var6\.\*\$[0-9]+\",exp=\"\*\$[0-9]+\",numchild=\"0\",type=\"const char\",thread-id=\"4294967295\",value=\"47 '/'\",has_more=\"0\"\}\],has_more=\"0\"") #FIXME -var-list-children shows invalid thread-id + # FIXME -var-list-children shows invalid thread-id + self.expect( + "\^done,numchild=\"1\",children=\[child=\{name=\"var6\.\*\$[0-9]+\",exp=\"\*\$[0-9]+\",numchild=\"0\",type=\"const char\",thread-id=\"4294967295\",value=\"47 '/'\",has_more=\"0\"\}\],has_more=\"0\"") + + # Print an expression with spaces and optional arguments + self.runCmd("-data-evaluate-expression \"a + b\"") + self.expect("\^done,value=\"12\"") + self.runCmd("-var-create var7 * \"a + b\" --thread 1 --frame 0") + self.expect( + "\^done,name=\"var7\",numchild=\"0\",value=\"12\",type=\"int\",thread-id=\"1\",has_more=\"0\"") - @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows - @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races - @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots + @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows + @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races + @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots def test_lldbmi_var_update(self): """Test that 'lldb-mi --interpreter' works for -var-update.""" - self.spawnLldbMi(args = None) + self.spawnLldbMi(args=None) # Load executable self.runCmd("-file-exec-and-symbols %s" % self.myexe) @@ -150,11 +177,14 @@ class MiVarTestCase(lldbmi_testcase.MiTestCaseBase): # Setup variables self.runCmd("-var-create var_l * l") - self.expect("\^done,name=\"var_l\",numchild=\"0\",value=\"1\",type=\"long\",thread-id=\"1\",has_more=\"0\"") + self.expect( + "\^done,name=\"var_l\",numchild=\"0\",value=\"1\",type=\"long\",thread-id=\"1\",has_more=\"0\"") self.runCmd("-var-create var_complx * complx") - self.expect("\^done,name=\"var_complx\",numchild=\"3\",value=\"\{\.\.\.\}\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"") + self.expect( + "\^done,name=\"var_complx\",numchild=\"3\",value=\"\{\.\.\.\}\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"") self.runCmd("-var-create var_complx_array * complx_array") - self.expect("\^done,name=\"var_complx_array\",numchild=\"2\",value=\"\[2\]\",type=\"complex_type \[2\]\",thread-id=\"1\",has_more=\"0\"") + self.expect( + "\^done,name=\"var_complx_array\",numchild=\"2\",value=\"\[2\]\",type=\"complex_type \[2\]\",thread-id=\"1\",has_more=\"0\"") # Go to BP_var_update_test_l line = line_number('main.cpp', '// BP_var_update_test_l') @@ -166,7 +196,8 @@ class MiVarTestCase(lldbmi_testcase.MiTestCaseBase): # Test that var_l was updated self.runCmd("-var-update --all-values var_l") - self.expect("\^done,changelist=\[\{name=\"var_l\",value=\"0\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\]") + self.expect( + "\^done,changelist=\[\{name=\"var_l\",value=\"0\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\]") # Go to BP_var_update_test_complx line = line_number('main.cpp', '// BP_var_update_test_complx') @@ -178,7 +209,8 @@ class MiVarTestCase(lldbmi_testcase.MiTestCaseBase): # Test that var_complx was updated self.runCmd("-var-update --all-values var_complx") - self.expect("\^done,changelist=\[\{name=\"var_complx\",value=\"\{\.\.\.\}\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\]") + self.expect( + "\^done,changelist=\[\{name=\"var_complx\",value=\"\{\.\.\.\}\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\]") # Go to BP_var_update_test_complx_array line = line_number('main.cpp', '// BP_var_update_test_complx_array') @@ -190,14 +222,15 @@ class MiVarTestCase(lldbmi_testcase.MiTestCaseBase): # Test that var_complex_array was updated self.runCmd("-var-update --all-values var_complx_array") - self.expect("\^done,changelist=\[\{name=\"var_complx_array\",value=\"\[2\]\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\]") + self.expect( + "\^done,changelist=\[\{name=\"var_complx_array\",value=\"\[2\]\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\]") - @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows - @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races + @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows + @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races def test_lldbmi_var_create_register(self): """Test that 'lldb-mi --interpreter' works for -var-create $regname.""" - self.spawnLldbMi(args = None) + self.spawnLldbMi(args=None) # Load executable self.runCmd("-file-exec-and-symbols %s" % self.myexe) @@ -218,26 +251,29 @@ class MiVarTestCase(lldbmi_testcase.MiTestCaseBase): # Create variable for register 0 # Note that message is different in Darwin and Linux: # Darwin: "^done,name=\"var_reg\",numchild=\"0\",value=\"0x[0-9a-f]+\",type=\"unsigned long\",thread-id=\"1\",has_more=\"0\" - # Linux: "^done,name=\"var_reg\",numchild=\"0\",value=\"0x[0-9a-f]+\",type=\"unsigned int\",thread-id=\"1\",has_more=\"0\" + # Linux: + # "^done,name=\"var_reg\",numchild=\"0\",value=\"0x[0-9a-f]+\",type=\"unsigned + # int\",thread-id=\"1\",has_more=\"0\" self.runCmd("-var-create var_reg * $%s" % register_name) - self.expect("\^done,name=\"var_reg\",numchild=\"0\",value=\"0x[0-9a-f]+\",type=\"unsigned (long|int)\",thread-id=\"1\",has_more=\"0\"") + self.expect( + "\^done,name=\"var_reg\",numchild=\"0\",value=\"0x[0-9a-f]+\",type=\"unsigned (long|int)\",thread-id=\"1\",has_more=\"0\"") # Assign value to variable self.runCmd("-var-assign var_reg \"6\"") - #FIXME: the output has different format for 32bit and 64bit values + # FIXME: the output has different format for 32bit and 64bit values self.expect("\^done,value=\"0x0*?6\"") # Assert register 0 updated self.runCmd("-data-list-register-values d 0") self.expect("\^done,register-values=\[{number=\"0\",value=\"6\"") - @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows - @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races - @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots + @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows + @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races + @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots def test_lldbmi_var_list_children(self): """Test that 'lldb-mi --interpreter' works for -var-list-children.""" - self.spawnLldbMi(args = None) + self.spawnLldbMi(args=None) # Load executable self.runCmd("-file-exec-and-symbols %s" % self.myexe) @@ -253,13 +289,17 @@ class MiVarTestCase(lldbmi_testcase.MiTestCaseBase): # Create variable self.runCmd("-var-create var_complx * complx") - self.expect("\^done,name=\"var_complx\",numchild=\"3\",value=\"\{\.\.\.\}\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"") + self.expect( + "\^done,name=\"var_complx\",numchild=\"3\",value=\"\{\.\.\.\}\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"") self.runCmd("-var-create var_complx_array * complx_array") - self.expect("\^done,name=\"var_complx_array\",numchild=\"2\",value=\"\[2\]\",type=\"complex_type \[2\]\",thread-id=\"1\",has_more=\"0\"") + self.expect( + "\^done,name=\"var_complx_array\",numchild=\"2\",value=\"\[2\]\",type=\"complex_type \[2\]\",thread-id=\"1\",has_more=\"0\"") self.runCmd("-var-create var_pcomplx * pcomplx") - self.expect("\^done,name=\"var_pcomplx\",numchild=\"2\",value=\"\{\.\.\.\}\",type=\"pcomplex_type\",thread-id=\"1\",has_more=\"0\"") + self.expect( + "\^done,name=\"var_pcomplx\",numchild=\"2\",value=\"\{\.\.\.\}\",type=\"pcomplex_type\",thread-id=\"1\",has_more=\"0\"") - # Test that -var-evaluate-expression can evaluate the children of created varobj + # Test that -var-evaluate-expression can evaluate the children of + # created varobj self.runCmd("-var-list-children var_complx") self.runCmd("-var-evaluate-expression var_complx.i") self.expect("\^done,value=\"3\"") @@ -282,37 +322,50 @@ class MiVarTestCase(lldbmi_testcase.MiTestCaseBase): # Test that -var-list-children lists all children with their values # (and that from and to are optional) self.runCmd("-var-list-children --all-values var_complx") - self.expect("\^done,numchild=\"3\",children=\[child=\{name=\"var_complx\.i\",exp=\"i\",numchild=\"0\",type=\"int\",thread-id=\"1\",value=\"3\",has_more=\"0\"\},child=\{name=\"var_complx\.inner\",exp=\"inner\",numchild=\"1\",type=\"complex_type::\(anonymous struct\)\",thread-id=\"1\",value=\"\{\.\.\.\}\",has_more=\"0\"\},child=\{name=\"var_complx\.complex_ptr\",exp=\"complex_ptr\",numchild=\"3\",type=\"complex_type \*\",thread-id=\"1\",value=\"0x[0-9a-f]+\",has_more=\"0\"\}\],has_more=\"0\"") + self.expect( + "\^done,numchild=\"3\",children=\[child=\{name=\"var_complx\.i\",exp=\"i\",numchild=\"0\",type=\"int\",thread-id=\"1\",value=\"3\",has_more=\"0\"\},child=\{name=\"var_complx\.inner\",exp=\"inner\",numchild=\"1\",type=\"complex_type::\(anonymous struct\)\",thread-id=\"1\",value=\"\{\.\.\.\}\",has_more=\"0\"\},child=\{name=\"var_complx\.complex_ptr\",exp=\"complex_ptr\",numchild=\"3\",type=\"complex_type \*\",thread-id=\"1\",value=\"0x[0-9a-f]+\",has_more=\"0\"\}\],has_more=\"0\"") self.runCmd("-var-list-children --simple-values var_complx_array") - self.expect("\^done,numchild=\"2\",children=\[child=\{name=\"var_complx_array\.\[0\]\",exp=\"\[0\]\",numchild=\"3\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"\},child=\{name=\"var_complx_array\.\[1\]\",exp=\"\[1\]\",numchild=\"3\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"\}\],has_more=\"0\"") + self.expect( + "\^done,numchild=\"2\",children=\[child=\{name=\"var_complx_array\.\[0\]\",exp=\"\[0\]\",numchild=\"3\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"\},child=\{name=\"var_complx_array\.\[1\]\",exp=\"\[1\]\",numchild=\"3\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"\}\],has_more=\"0\"") self.runCmd("-var-list-children 0 var_pcomplx") - self.expect("\^done,numchild=\"2\",children=\[child=\{name=\"var_pcomplx\.complex_type\",exp=\"complex_type\",numchild=\"3\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"\},child={name=\"var_pcomplx\.complx\",exp=\"complx\",numchild=\"3\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"\}\],has_more=\"0\"") + self.expect( + "\^done,numchild=\"2\",children=\[child=\{name=\"var_pcomplx\.complex_type\",exp=\"complex_type\",numchild=\"3\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"\},child={name=\"var_pcomplx\.complx\",exp=\"complx\",numchild=\"3\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"\}\],has_more=\"0\"") # Test that -var-list-children lists children without values self.runCmd("-var-list-children 0 var_complx 0 1") - self.expect("\^done,numchild=\"1\",children=\[child=\{name=\"var_complx\.i\",exp=\"i\",numchild=\"0\",type=\"int\",thread-id=\"1\",has_more=\"0\"\}\],has_more=\"1\"") + self.expect( + "\^done,numchild=\"1\",children=\[child=\{name=\"var_complx\.i\",exp=\"i\",numchild=\"0\",type=\"int\",thread-id=\"1\",has_more=\"0\"\}\],has_more=\"1\"") self.runCmd("-var-list-children --no-values var_complx 0 1") - self.expect("\^done,numchild=\"1\",children=\[child=\{name=\"var_complx\.i\",exp=\"i\",numchild=\"0\",type=\"int\",thread-id=\"1\",has_more=\"0\"\}\],has_more=\"1\"") + self.expect( + "\^done,numchild=\"1\",children=\[child=\{name=\"var_complx\.i\",exp=\"i\",numchild=\"0\",type=\"int\",thread-id=\"1\",has_more=\"0\"\}\],has_more=\"1\"") self.runCmd("-var-list-children --no-values var_complx_array 0 1") - self.expect("\^done,numchild=\"1\",children=\[child=\{name=\"var_complx_array\.\[0\]\",exp=\"\[0\]\",numchild=\"3\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"\}\],has_more=\"1\"") + self.expect( + "\^done,numchild=\"1\",children=\[child=\{name=\"var_complx_array\.\[0\]\",exp=\"\[0\]\",numchild=\"3\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"\}\],has_more=\"1\"") self.runCmd("-var-list-children --no-values var_pcomplx 0 1") - self.expect("\^done,numchild=\"1\",children=\[child=\{name=\"var_pcomplx\.complex_type\",exp=\"complex_type\",numchild=\"3\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"\}\],has_more=\"1\"") + self.expect( + "\^done,numchild=\"1\",children=\[child=\{name=\"var_pcomplx\.complex_type\",exp=\"complex_type\",numchild=\"3\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"\}\],has_more=\"1\"") # Test that -var-list-children lists children with all values self.runCmd("-var-list-children 1 var_complx 1 2") - self.expect("\^done,numchild=\"1\",children=\[child=\{name=\"var_complx\.inner\",exp=\"inner\",numchild=\"1\",type=\"complex_type::\(anonymous struct\)\",thread-id=\"1\",value=\"\{\.\.\.\}\",has_more=\"0\"\}\],has_more=\"1\"") + self.expect( + "\^done,numchild=\"1\",children=\[child=\{name=\"var_complx\.inner\",exp=\"inner\",numchild=\"1\",type=\"complex_type::\(anonymous struct\)\",thread-id=\"1\",value=\"\{\.\.\.\}\",has_more=\"0\"\}\],has_more=\"1\"") self.runCmd("-var-list-children --all-values var_complx 1 2") - self.expect("\^done,numchild=\"1\",children=\[child=\{name=\"var_complx\.inner\",exp=\"inner\",numchild=\"1\",type=\"complex_type::\(anonymous struct\)\",thread-id=\"1\",value=\"\{\.\.\.\}\",has_more=\"0\"\}\],has_more=\"1\"") + self.expect( + "\^done,numchild=\"1\",children=\[child=\{name=\"var_complx\.inner\",exp=\"inner\",numchild=\"1\",type=\"complex_type::\(anonymous struct\)\",thread-id=\"1\",value=\"\{\.\.\.\}\",has_more=\"0\"\}\],has_more=\"1\"") self.runCmd("-var-list-children --all-values var_complx_array 1 2") - self.expect("\^done,numchild=\"1\",children=\[child=\{name=\"var_complx_array\.\[1\]\",exp=\"\[1\]\",numchild=\"3\",type=\"complex_type\",thread-id=\"1\",value=\"\{\.\.\.\}\",has_more=\"0\"\}\],has_more=\"0\"") + self.expect( + "\^done,numchild=\"1\",children=\[child=\{name=\"var_complx_array\.\[1\]\",exp=\"\[1\]\",numchild=\"3\",type=\"complex_type\",thread-id=\"1\",value=\"\{\.\.\.\}\",has_more=\"0\"\}\],has_more=\"0\"") self.runCmd("-var-list-children --all-values var_pcomplx 1 2") - self.expect("\^done,numchild=\"1\",children=\[child={name=\"var_pcomplx\.complx\",exp=\"complx\",numchild=\"3\",type=\"complex_type\",thread-id=\"1\",value=\"\{\.\.\.\}\",has_more=\"0\"\}\],has_more=\"0\"") + self.expect( + "\^done,numchild=\"1\",children=\[child={name=\"var_pcomplx\.complx\",exp=\"complx\",numchild=\"3\",type=\"complex_type\",thread-id=\"1\",value=\"\{\.\.\.\}\",has_more=\"0\"\}\],has_more=\"0\"") # Test that -var-list-children lists children with simple values self.runCmd("-var-list-children 2 var_complx 2 4") - self.expect("\^done,numchild=\"1\",children=\[child=\{name=\"var_complx\.complex_ptr\",exp=\"complex_ptr\",numchild=\"3\",type=\"complex_type \*\",thread-id=\"1\",has_more=\"0\"\}\],has_more=\"0\"") + self.expect( + "\^done,numchild=\"1\",children=\[child=\{name=\"var_complx\.complex_ptr\",exp=\"complex_ptr\",numchild=\"3\",type=\"complex_type \*\",thread-id=\"1\",has_more=\"0\"\}\],has_more=\"0\"") self.runCmd("-var-list-children --simple-values var_complx 2 4") - self.expect("\^done,numchild=\"1\",children=\[child=\{name=\"var_complx\.complex_ptr\",exp=\"complex_ptr\",numchild=\"3\",type=\"complex_type \*\",thread-id=\"1\",has_more=\"0\"\}\],has_more=\"0\"") + self.expect( + "\^done,numchild=\"1\",children=\[child=\{name=\"var_complx\.complex_ptr\",exp=\"complex_ptr\",numchild=\"3\",type=\"complex_type \*\",thread-id=\"1\",has_more=\"0\"\}\],has_more=\"0\"") self.runCmd("-var-list-children --simple-values var_complx_array 2 4") self.expect("\^done,numchild=\"0\",has_more=\"0\"") self.runCmd("-var-list-children --simple-values var_pcomplx 2 4") @@ -330,15 +383,16 @@ class MiVarTestCase(lldbmi_testcase.MiTestCaseBase): # Test that a missing low-frame or high-frame is handled self.runCmd("-var-list-children 0 var_complx 0") - self.expect("\^error,msg=\"Command 'var-list-children'. Variable children range invalid\"") + self.expect( + "\^error,msg=\"Command 'var-list-children'. Variable children range invalid\"") - @skipIfWindows #llvm.org/pr24452: Get lldb-mi working on Windows - @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races - @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots + @skipIfWindows # llvm.org/pr24452: Get lldb-mi working on Windows + @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races + @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots def test_lldbmi_var_create_for_stl_types(self): """Test that 'lldb-mi --interpreter' print summary for STL types.""" - self.spawnLldbMi(args = None) + self.spawnLldbMi(args=None) # Load executable self.runCmd("-file-exec-and-symbols %s" % self.myexe) @@ -354,15 +408,16 @@ class MiVarTestCase(lldbmi_testcase.MiTestCaseBase): # Test for std::string self.runCmd("-var-create - * std_string") - self.expect('\^done,name="var\d+",numchild="[0-9]+",value="\\\\"hello\\\\"",type="std::[\S]*?string",thread-id="1",has_more="0"') - - @skipIfWindows #llvm.org/pr24452: Get lldb-mi working on Windows - @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races - @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots + self.expect( + '\^done,name="var\d+",numchild="[0-9]+",value="\\\\"hello\\\\"",type="std::[\S]*?string",thread-id="1",has_more="0"') + + @skipIfWindows # llvm.org/pr24452: Get lldb-mi working on Windows + @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races + @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots def test_lldbmi_var_create_for_unnamed_objects(self): """Test that 'lldb-mi --interpreter' can expand unnamed structures and unions.""" - self.spawnLldbMi(args = None) + self.spawnLldbMi(args=None) # Load executable self.runCmd("-file-exec-and-symbols %s" % self.myexe) @@ -378,15 +433,16 @@ class MiVarTestCase(lldbmi_testcase.MiTestCaseBase): # Evaluate struct_with_unions type and its children self.runCmd("-var-create v0 * swu") - self.expect('\^done,name="v0",numchild="2",value="\{\.\.\.\}",type="struct_with_unions",thread-id="1",has_more="0"') - + self.expect( + '\^done,name="v0",numchild="2",value="\{\.\.\.\}",type="struct_with_unions",thread-id="1",has_more="0"') + self.runCmd("-var-list-children v0") - + # inspect the first unnamed union self.runCmd("-var-list-children v0.$0") self.runCmd("-var-evaluate-expression v0.$0.u_i") self.expect('\^done,value="1"') - + # inspect the second unnamed union self.runCmd("-var-list-children v0.$1") self.runCmd("-var-evaluate-expression v0.$1.u1") @@ -395,4 +451,3 @@ class MiVarTestCase(lldbmi_testcase.MiTestCaseBase): self.runCmd("-var-list-children v0.$1.$1") self.runCmd("-var-evaluate-expression v0.$1.$1.s1") self.expect('\^done,value="-1"') - |