diff options
author | Frederic Riss <friss@apple.com> | 2018-08-28 22:50:01 +0000 |
---|---|---|
committer | Frederic Riss <friss@apple.com> | 2018-08-28 22:50:01 +0000 |
commit | ae6ca2fc3f5d043eab69e9f3122d7775d6354f98 (patch) | |
tree | c95dbd007ea9156290357a193735d735d1bbff5f /lldb/packages/Python/lldbsuite/test/lang/c/bitfields/TestBitfields.py | |
parent | a65bf65e0bb4f2c119bb388e7f036e664d108669 (diff) | |
download | bcm5719-llvm-ae6ca2fc3f5d043eab69e9f3122d7775d6354f98.tar.gz bcm5719-llvm-ae6ca2fc3f5d043eab69e9f3122d7775d6354f98.zip |
Allow IRInterpreter to deal with non-power-of-2 sized types to support some bitfield accesses.
Summary:
For some bitfield patterns (like the one added by this commit), Clang will
generate non-regular data types like i24 or i48. This patch follows a
pretty naive approach of just bumping the type size to the next power of 2.
DataExtractor know how to deal with weird sizes. The operations on Scalar
do not know how to deal with those types though, so we have to legalize the
size when creating a Scalar.
Reviewers: jingham, clayborg
Subscribers: lldb-commits
Differential Revision: https://reviews.llvm.org/D51245
llvm-svn: 340880
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/lang/c/bitfields/TestBitfields.py')
-rw-r--r-- | lldb/packages/Python/lldbsuite/test/lang/c/bitfields/TestBitfields.py | 32 |
1 files changed, 32 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 22b8a299100..ba924683ad7 100644 --- a/lldb/packages/Python/lldbsuite/test/lang/c/bitfields/TestBitfields.py +++ b/lldb/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) |