summaryrefslogtreecommitdiff
path: root/packages/Python/lldbsuite/test/lang/c/bitfields
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2019-01-19 10:06:29 +0000
committerDimitry Andric <dim@FreeBSD.org>2019-01-19 10:06:29 +0000
commit94994d372d014ce4c8758b9605d63fae651bd8aa (patch)
tree51c0b708bd59f205d6b35cb2a8c24d62f0c33d77 /packages/Python/lldbsuite/test/lang/c/bitfields
parent39be7ce23363d12ae3e49aeb1fdb2bfeb892e836 (diff)
downloadsrc-test2-94994d372d014ce4c8758b9605d63fae651bd8aa.tar.gz
src-test2-94994d372d014ce4c8758b9605d63fae651bd8aa.zip
Notes
Diffstat (limited to 'packages/Python/lldbsuite/test/lang/c/bitfields')
-rw-r--r--packages/Python/lldbsuite/test/lang/c/bitfields/TestBitfields.py32
-rw-r--r--packages/Python/lldbsuite/test/lang/c/bitfields/main.c15
2 files changed, 47 insertions, 0 deletions
diff --git a/packages/Python/lldbsuite/test/lang/c/bitfields/TestBitfields.py b/packages/Python/lldbsuite/test/lang/c/bitfields/TestBitfields.py
index 22b8a2991001..ba924683ad75 100644
--- a/packages/Python/lldbsuite/test/lang/c/bitfields/TestBitfields.py
+++ b/packages/Python/lldbsuite/test/lang/c/bitfields/TestBitfields.py
@@ -116,6 +116,38 @@ class BitfieldsTestCase(TestBase):
self.expect("expr/x (packed.c)", VARIABLES_DISPLAYED_CORRECTLY,
substrs=['uint32_t', "7112233"])
+ for bit in range(1,18):
+ expected = "1" if bit in [1, 5, 7, 13] else "0"
+ self.expect("expr even_more_bits.b" + str(bit), VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=['uint8_t', expected])
+
+ for bit in [3, 10, 14]:
+ self.expect("expr even_more_bits.b" + str(bit) + " = 1", VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=['uint8_t', "1"])
+
+ self.expect(
+ "frame variable --show-types even_more_bits",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ '(uint8_t:1) b1 = \'\\x01\'',
+ '(uint8_t:1) b2 = \'\\0\'',
+ '(uint8_t:1) b3 = \'\\x01\'',
+ '(uint8_t:1) b4 = \'\\0\'',
+ '(uint8_t:1) b5 = \'\\x01\'',
+ '(uint8_t:1) b6 = \'\\0\'',
+ '(uint8_t:1) b7 = \'\\x01\'',
+ '(uint8_t:1) b8 = \'\\0\'',
+ '(uint8_t:1) b9 = \'\\0\'',
+ '(uint8_t:1) b10 = \'\\x01\'',
+ '(uint8_t:1) b12 = \'\\0\'',
+ '(uint8_t:1) b13 = \'\\x01\'',
+ '(uint8_t:1) b14 = \'\\x01\'',
+ '(uint8_t:1) b15 = \'\\0\'',
+ '(uint8_t:1) b16 = \'\\0\'',
+ '(uint8_t:1) b17 = \'\\0\'',
+ ])
+
+
@add_test_categories(['pyapi'])
# BitFields exhibit crashes in record layout on Windows
# (http://llvm.org/pr21800)
diff --git a/packages/Python/lldbsuite/test/lang/c/bitfields/main.c b/packages/Python/lldbsuite/test/lang/c/bitfields/main.c
index 236c926d81bd..fe972dbbe856 100644
--- a/packages/Python/lldbsuite/test/lang/c/bitfields/main.c
+++ b/packages/Python/lldbsuite/test/lang/c/bitfields/main.c
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
#include <stdint.h>
#include <stdio.h>
+#include <string.h>
int main (int argc, char const *argv[])
{
@@ -63,6 +64,20 @@ int main (int argc, char const *argv[])
more_bits.c = 1;
more_bits.d = 0;
+ struct EvenMoreBits
+ {
+ uint8_t b1 : 1, b2 : 1, b3 : 1, b4 : 1, b5 : 1, b6 : 1,
+ b7 : 1, b8 : 1, b9 : 1, b10 : 1, b11 : 1, b12 : 1,
+ b13 : 1, b14 : 1, b15 : 1, b16 : 1, b17 : 1;
+ };
+
+ struct EvenMoreBits even_more_bits;
+ memset(&even_more_bits, 0, sizeof(even_more_bits));
+ even_more_bits.b1 = 1;
+ even_more_bits.b5 = 1;
+ even_more_bits.b7 = 1;
+ even_more_bits.b13 = 1;
+
#pragma pack(1)
struct PackedBits
{