ted created this revision. Herald added a subscriber: aprantl. Test was skipped because -data-evaluate-expression was thought to not work on globals. This is not the case - the issue was clang removes debug info for globals in cpp files that are not used.
Add a reference to the globals in question, and fix memory patter in test to match memory pattern in testcase. https://reviews.llvm.org/D37533 Files: packages/Python/lldbsuite/test/tools/lldb-mi/data/TestMiData.py packages/Python/lldbsuite/test/tools/lldb-mi/data/main.cpp Index: packages/Python/lldbsuite/test/tools/lldb-mi/data/main.cpp =================================================================== --- packages/Python/lldbsuite/test/tools/lldb-mi/data/main.cpp +++ packages/Python/lldbsuite/test/tools/lldb-mi/data/main.cpp @@ -17,6 +17,8 @@ { char array[] = { 0x01, 0x02, 0x03, 0x04 }; char *first_element_ptr = &array[0]; + char g = g_CharArray[0]; + char s = s_CharArray[0]; // BP_local_array_test_inner return; } Index: packages/Python/lldbsuite/test/tools/lldb-mi/data/TestMiData.py =================================================================== --- packages/Python/lldbsuite/test/tools/lldb-mi/data/TestMiData.py +++ packages/Python/lldbsuite/test/tools/lldb-mi/data/TestMiData.py @@ -88,8 +88,6 @@ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races - # FIXME: the global case worked before refactoring - @unittest2.skip("-data-evaluate-expression doesn't work on globals") def test_lldbmi_data_read_memory_bytes_global(self): """Test that -data-read-memory-bytes can access global buffers.""" @@ -115,7 +113,7 @@ # Test that -data-read-memory-bytes works for char[] type (global) self.runCmd("-data-read-memory-bytes %#x %d" % (addr, size)) self.expect( - "\^done,memory=\[{begin=\"0x0*%x\",offset=\"0x0+\",end=\"0x0*%x\",contents=\"1112131400\"}\]" % + "\^done,memory=\[{begin=\"0x0*%x\",offset=\"0x0+\",end=\"0x0*%x\",contents=\"1011121300\"}\]" % (addr, addr + size)) # Get address of static char[] @@ -127,7 +125,7 @@ # Test that -data-read-memory-bytes works for static char[] type self.runCmd("-data-read-memory-bytes %#x %d" % (addr, size)) self.expect( - "\^done,memory=\[{begin=\"0x0*%x\",offset=\"0x0+\",end=\"0x0*%x\",contents=\"1112131400\"}\]" % + "\^done,memory=\[{begin=\"0x0*%x\",offset=\"0x0+\",end=\"0x0*%x\",contents=\"2021222300\"}\]" % (addr, addr + size)) @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
Index: packages/Python/lldbsuite/test/tools/lldb-mi/data/main.cpp =================================================================== --- packages/Python/lldbsuite/test/tools/lldb-mi/data/main.cpp +++ packages/Python/lldbsuite/test/tools/lldb-mi/data/main.cpp @@ -17,6 +17,8 @@ { char array[] = { 0x01, 0x02, 0x03, 0x04 }; char *first_element_ptr = &array[0]; + char g = g_CharArray[0]; + char s = s_CharArray[0]; // BP_local_array_test_inner return; } Index: packages/Python/lldbsuite/test/tools/lldb-mi/data/TestMiData.py =================================================================== --- packages/Python/lldbsuite/test/tools/lldb-mi/data/TestMiData.py +++ packages/Python/lldbsuite/test/tools/lldb-mi/data/TestMiData.py @@ -88,8 +88,6 @@ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races - # FIXME: the global case worked before refactoring - @unittest2.skip("-data-evaluate-expression doesn't work on globals") def test_lldbmi_data_read_memory_bytes_global(self): """Test that -data-read-memory-bytes can access global buffers.""" @@ -115,7 +113,7 @@ # Test that -data-read-memory-bytes works for char[] type (global) self.runCmd("-data-read-memory-bytes %#x %d" % (addr, size)) self.expect( - "\^done,memory=\[{begin=\"0x0*%x\",offset=\"0x0+\",end=\"0x0*%x\",contents=\"1112131400\"}\]" % + "\^done,memory=\[{begin=\"0x0*%x\",offset=\"0x0+\",end=\"0x0*%x\",contents=\"1011121300\"}\]" % (addr, addr + size)) # Get address of static char[] @@ -127,7 +125,7 @@ # Test that -data-read-memory-bytes works for static char[] type self.runCmd("-data-read-memory-bytes %#x %d" % (addr, size)) self.expect( - "\^done,memory=\[{begin=\"0x0*%x\",offset=\"0x0+\",end=\"0x0*%x\",contents=\"1112131400\"}\]" % + "\^done,memory=\[{begin=\"0x0*%x\",offset=\"0x0+\",end=\"0x0*%x\",contents=\"2021222300\"}\]" % (addr, addr + size)) @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits