summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test
diff options
context:
space:
mode:
authorJason Molenda <jmolenda@apple.com>2017-01-25 01:41:48 +0000
committerJason Molenda <jmolenda@apple.com>2017-01-25 01:41:48 +0000
commita1609ff658f5be59d7441f8f7283ab485139fdd3 (patch)
tree84100a358f590728c36106829e894e0ed5ef7585 /lldb/packages/Python/lldbsuite/test
parent4dbf368e14e4e96311abd084f29b07d398f680fc (diff)
downloadbcm5719-llvm-a1609ff658f5be59d7441f8f7283ab485139fdd3.tar.gz
bcm5719-llvm-a1609ff658f5be59d7441f8f7283ab485139fdd3.zip
Jim unintentionally had the gdb-format specifiers falling through
after r276132 so that 'x/4b' would print out a series of 4 8-byte quantities. Fix that, add a test case. <rdar://problem/29930833> llvm-svn: 293002
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test')
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/memory/read/TestMemoryRead.py17
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/memory/read/main.cpp2
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;
OpenPOWER on IntegriCloud