diff options
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test')
-rw-r--r-- | lldb/packages/Python/lldbsuite/test/functionalities/memory/read/TestMemoryRead.py | 17 | ||||
-rw-r--r-- | lldb/packages/Python/lldbsuite/test/functionalities/memory/read/main.cpp | 2 |
2 files changed, 19 insertions, 0 deletions
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 9d4e44c96bb..91342fdaf1c 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/memory/read/TestMemoryRead.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/memory/read/TestMemoryRead.py @@ -118,3 +118,20 @@ class MemoryReadTestCase(TestBase): '16', '18', '20']) + + # the gdb format specifier and the size in characters for + # the returned values including the 0x prefix. + variations = [['b', 4], ['h', 6], ['w', 10], ['g', 18]] + for v in variations: + formatter = v[0] + expected_object_length = v[1] + self.runCmd( + "memory read --gdb-format 4%s &my_uint64s" % formatter) + lines = self.res.GetOutput().splitlines() + objects_read = [] + for l in lines: + objects_read.extend(l.split(':')[1].split()) + # Check that we got back 4 0x0000 etc bytes + for o in objects_read: + self.assertTrue (len(o) == expected_object_length) + self.assertTrue(len(objects_read) == 4) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/memory/read/main.cpp b/lldb/packages/Python/lldbsuite/test/functionalities/memory/read/main.cpp index cd367ff318a..fdc7b8bdba1 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/memory/read/main.cpp +++ b/lldb/packages/Python/lldbsuite/test/functionalities/memory/read/main.cpp @@ -7,12 +7,14 @@ // //===----------------------------------------------------------------------===// #include <stdio.h> +#include <stdint.h> int main (int argc, char const *argv[]) { char my_string[] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 0}; double my_double = 1234.5678; int my_ints[] = {2,4,6,8,10,12,14,16,18,20,22}; + uint64_t my_uint64s[] = {0, 1, 2, 3, 4, 5, 6, 7}; printf("my_string=%s\n", my_string); // Set break point at this line. printf("my_double=%g\n", my_double); return 0; |