diff options
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/functionalities/memory')
3 files changed, 77 insertions, 44 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/memory/cache/TestMemoryCache.py b/lldb/packages/Python/lldbsuite/test/functionalities/memory/cache/TestMemoryCache.py index a65882d3fa4..f2126e9ffd5 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/memory/cache/TestMemoryCache.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/memory/cache/TestMemoryCache.py @@ -5,14 +5,15 @@ Test the MemoryCache L1 flush. from __future__ import print_function - -import os, time +import os +import time import re import lldb from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * import lldbsuite.test.lldbutil as lldbutil + class MemoryCacheTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) @@ -31,17 +32,18 @@ class MemoryCacheTestCase(TestBase): self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) # Break in main() after the variables are assigned values. - lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True) + lldbutil.run_break_set_by_file_and_line( + self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True) self.runCmd("run", RUN_SUCCEEDED) # The stop reason of the thread should be breakpoint. self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs = ['stopped', 'stop reason = breakpoint']) + substrs=['stopped', 'stop reason = breakpoint']) # The breakpoint should have a hit count of 1. self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE, - substrs = [' resolved, hit count = 1']) + substrs=[' resolved, hit count = 1']) # Read a chunk of memory containing &my_ints[0]. The number of bytes read # must be greater than m_L2_cache_line_byte_size to make sure the L1 diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/memory/find/TestMemoryFind.py b/lldb/packages/Python/lldbsuite/test/functionalities/memory/find/TestMemoryFind.py index 6cdf5bf48e9..ddbe6409cb8 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/memory/find/TestMemoryFind.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/memory/find/TestMemoryFind.py @@ -5,14 +5,15 @@ Test the 'memory find' command. from __future__ import print_function - -import os, time +import os +import time import re import lldb from lldbsuite.test.lldbtest import * import lldbsuite.test.lldbutil as lldbutil from lldbsuite.test.decorators import * + class MemoryFindTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) @@ -30,31 +31,40 @@ class MemoryFindTestCase(TestBase): self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) # Break in main() aftre the variables are assigned values. - lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True) + lldbutil.run_break_set_by_file_and_line( + self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True) self.runCmd("run", RUN_SUCCEEDED) # The stop reason of the thread should be breakpoint. self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs = ['stopped', 'stop reason = breakpoint']) + substrs=['stopped', 'stop reason = breakpoint']) # The breakpoint should have a hit count of 1. self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE, - substrs = [' resolved, hit count = 1']) + substrs=[' resolved, hit count = 1']) # Test the memory find commands. - self.expect('memory find -s "in const" `stringdata` `stringdata+(int)strlen(stringdata)`', - substrs = ['data found at location: 0x', '69 6e 20 63', 'in const']) - - self.expect('memory find -e "(uint8_t)0x22" `&bytedata[0]` `&bytedata[15]`', - substrs = ['data found at location: 0x', '22 33 44 55 66']) - - self.expect('memory find -e "(uint8_t)0x22" `&bytedata[0]` `&bytedata[2]`', - substrs = ['data not found within the range.']) + self.expect( + 'memory find -s "in const" `stringdata` `stringdata+(int)strlen(stringdata)`', + substrs=[ + 'data found at location: 0x', + '69 6e 20 63', + 'in const']) + + self.expect( + 'memory find -e "(uint8_t)0x22" `&bytedata[0]` `&bytedata[15]`', + substrs=[ + 'data found at location: 0x', + '22 33 44 55 66']) + + self.expect( + 'memory find -e "(uint8_t)0x22" `&bytedata[0]` `&bytedata[2]`', + substrs=['data not found within the range.']) self.expect('memory find -s "nothere" `stringdata` `stringdata+5`', - substrs = ['data not found within the range.']) + substrs=['data not found within the range.']) self.expect('memory find -s "nothere" `stringdata` `stringdata+10`', - substrs = ['data not found within the range.']) + substrs=['data not found within the range.']) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/memory/read/TestMemoryRead.py b/lldb/packages/Python/lldbsuite/test/functionalities/memory/read/TestMemoryRead.py index 7410650ad65..9d4e44c96bb 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/memory/read/TestMemoryRead.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/memory/read/TestMemoryRead.py @@ -5,13 +5,14 @@ Test the 'memory read' command. from __future__ import print_function - -import os, time +import os +import time import re import lldb from lldbsuite.test.lldbtest import * import lldbsuite.test.lldbutil as lldbutil + class MemoryReadTestCase(TestBase): mydir = TestBase.compute_mydir(__file__) @@ -29,17 +30,18 @@ class MemoryReadTestCase(TestBase): self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) # Break in main() aftre the variables are assigned values. - lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True) + lldbutil.run_break_set_by_file_and_line( + self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True) self.runCmd("run", RUN_SUCCEEDED) # The stop reason of the thread should be breakpoint. self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT, - substrs = ['stopped', 'stop reason = breakpoint']) + substrs=['stopped', 'stop reason = breakpoint']) # The breakpoint should have a hit count of 1. self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE, - substrs = [' resolved, hit count = 1']) + substrs=[' resolved, hit count = 1']) # Test the memory read commands. @@ -61,39 +63,58 @@ class MemoryReadTestCase(TestBase): # 0x7fff5fbff9a4: {0x00000000} # 0x7fff5fbff9a8: {0x0ec0bf27} # 0x7fff5fbff9ac: {0x215db505} - self.runCmd("memory read --format uint32_t[] --size 4 --count 4 `&argc`") + self.runCmd( + "memory read --format uint32_t[] --size 4 --count 4 `&argc`") lines = self.res.GetOutput().splitlines() for i in range(4): if i == 0: # Verify that the printout for argc is correct. - self.assertTrue(argc == int(lines[i].split(':')[1].strip(' {}'), 0)) + self.assertTrue( + argc == int( + lines[i].split(':')[1].strip(' {}'), 0)) addr = int(lines[i].split(':')[0], 0) # Verify that the printout for addr is incremented correctly. - self.assertTrue(addr == (address + i*4)) + self.assertTrue(addr == (address + i * 4)) # (lldb) memory read --format char[] --size 7 --count 1 `&my_string` # 0x7fff5fbff990: {abcdefg} - self.expect("memory read --format char[] --size 7 --count 1 `&my_string`", - substrs = ['abcdefg']) + self.expect( + "memory read --format char[] --size 7 --count 1 `&my_string`", + substrs=['abcdefg']) # (lldb) memory read --format 'hex float' --size 16 `&argc` - # 0x7fff5fbff5b0: error: unsupported byte size (16) for hex float format - self.expect("memory read --format 'hex float' --size 16 `&argc`", - substrs = ['unsupported byte size (16) for hex float format']) + # 0x7fff5fbff5b0: error: unsupported byte size (16) for hex float + # format + self.expect( + "memory read --format 'hex float' --size 16 `&argc`", + substrs=['unsupported byte size (16) for hex float format']) - self.expect("memory read --format 'float' --count 1 --size 8 `&my_double`", - substrs = ['1234.']) + self.expect( + "memory read --format 'float' --count 1 --size 8 `&my_double`", + substrs=['1234.']) # (lldb) memory read --format 'float' --count 1 --size 20 `&my_double` # 0x7fff5fbff598: error: unsupported byte size (20) for float format - self.expect("memory read --format 'float' --count 1 --size 20 `&my_double`", - substrs = ['unsupported byte size (20) for float format']) + self.expect( + "memory read --format 'float' --count 1 --size 20 `&my_double`", + substrs=['unsupported byte size (20) for float format']) self.expect('memory read --type int --count 5 `&my_ints[0]`', - substrs=['(int) 0x', '2','4','6','8','10']) - - self.expect('memory read --type int --count 5 --format hex `&my_ints[0]`', - substrs=['(int) 0x', '0x','0a']) - - self.expect('memory read --type int --count 5 --offset 5 `&my_ints[0]`', - substrs=['(int) 0x', '12', '14','16','18', '20']) + substrs=['(int) 0x', '2', '4', '6', '8', '10']) + + self.expect( + 'memory read --type int --count 5 --format hex `&my_ints[0]`', + substrs=[ + '(int) 0x', + '0x', + '0a']) + + self.expect( + 'memory read --type int --count 5 --offset 5 `&my_ints[0]`', + substrs=[ + '(int) 0x', + '12', + '14', + '16', + '18', + '20']) |