diff options
author | Greg Clayton <gclayton@apple.com> | 2016-04-22 23:14:35 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2016-04-22 23:14:35 +0000 |
commit | cae0855a62d2dc09fddc581f7a52d10c43b17571 (patch) | |
tree | a81b57f09ec7b70aafcbab97bfbbd74608ebc264 /lldb/packages/Python/lldbsuite/test | |
parent | 6010f97ee66fdc11f8f85b46c8e24f440ab8c72e (diff) | |
download | bcm5719-llvm-cae0855a62d2dc09fddc581f7a52d10c43b17571.tar.gz bcm5719-llvm-cae0855a62d2dc09fddc581f7a52d10c43b17571.zip |
DWARF layout for bitfields is wrong when the bit offset is negative.
Some older versions of clang emitted bit offsets that were negative and these bitfields would have their bitfield-ness stripped off and it would cause a clang assertion in clang assertions were enabled. I updated the bitfield C test to make sure we don't regress.
<rdar://problem/21082998>
llvm-svn: 267248
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test')
-rw-r--r-- | lldb/packages/Python/lldbsuite/test/lang/c/bitfields/TestBitfields.py | 8 | ||||
-rw-r--r-- | lldb/packages/Python/lldbsuite/test/lang/c/bitfields/main.c | 14 |
2 files changed, 22 insertions, 0 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/lang/c/bitfields/TestBitfields.py b/lldb/packages/Python/lldbsuite/test/lang/c/bitfields/TestBitfields.py index 60c1c0992d2..0afec0a3c1a 100644 --- a/lldb/packages/Python/lldbsuite/test/lang/c/bitfields/TestBitfields.py +++ b/lldb/packages/Python/lldbsuite/test/lang/c/bitfields/TestBitfields.py @@ -96,6 +96,14 @@ class BitfieldsTestCase(TestBase): self.expect("expr (more_bits.d)", VARIABLES_DISPLAYED_CORRECTLY, substrs = ['uint8_t', '\\0']) + self.expect("expr (packed.a)", VARIABLES_DISPLAYED_CORRECTLY, + substrs = ['char', "'a'"]) + self.expect("expr (packed.b)", VARIABLES_DISPLAYED_CORRECTLY, + substrs = ['uint32_t', "10"]) + self.expect("expr/x (packed.c)", VARIABLES_DISPLAYED_CORRECTLY, + substrs = ['uint32_t', "7112233"]) + + @add_test_categories(['pyapi']) @skipIfWindows # BitFields exhibit crashes in record layout on Windows (http://llvm.org/pr21800) def test_and_python_api(self): diff --git a/lldb/packages/Python/lldbsuite/test/lang/c/bitfields/main.c b/lldb/packages/Python/lldbsuite/test/lang/c/bitfields/main.c index 26c0176d759..236c926d81b 100644 --- a/lldb/packages/Python/lldbsuite/test/lang/c/bitfields/main.c +++ b/lldb/packages/Python/lldbsuite/test/lang/c/bitfields/main.c @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// #include <stdint.h> #include <stdio.h> + int main (int argc, char const *argv[]) { struct Bits @@ -62,6 +63,19 @@ int main (int argc, char const *argv[]) more_bits.c = 1; more_bits.d = 0; +#pragma pack(1) + struct PackedBits + { + char a; + uint32_t b : 5, + c : 27; + }; +#pragma pack() + struct PackedBits packed; + packed.a = 'a'; + packed.b = 10; + packed.c = 0x7112233; + return 0; //// Set break point at this line. } |