diff options
Diffstat (limited to 'lldb/test')
| -rw-r--r-- | lldb/test/lang/c/bitfields/TestBitfields.py | 33 | ||||
| -rw-r--r-- | lldb/test/lang/c/bitfields/main.c | 17 |
2 files changed, 50 insertions, 0 deletions
diff --git a/lldb/test/lang/c/bitfields/TestBitfields.py b/lldb/test/lang/c/bitfields/TestBitfields.py index e9bd2ee359a..684c2021cd8 100644 --- a/lldb/test/lang/c/bitfields/TestBitfields.py +++ b/lldb/test/lang/c/bitfields/TestBitfields.py @@ -86,6 +86,39 @@ class BitfieldsTestCase(TestBase): '(uint32_t:7) b7 = 127', '(uint32_t:4) four = 15']) + self.expect("expr (bits.b1)", VARIABLES_DISPLAYED_CORRECTLY, + substrs = ['uint32_t', '1']) + self.expect("expr (bits.b2)", VARIABLES_DISPLAYED_CORRECTLY, + substrs = ['uint32_t', '3']) + self.expect("expr (bits.b3)", VARIABLES_DISPLAYED_CORRECTLY, + substrs = ['uint32_t', '7']) + self.expect("expr (bits.b4)", VARIABLES_DISPLAYED_CORRECTLY, + substrs = ['uint32_t', '15']) + self.expect("expr (bits.b5)", VARIABLES_DISPLAYED_CORRECTLY, + substrs = ['uint32_t', '31']) + self.expect("expr (bits.b6)", VARIABLES_DISPLAYED_CORRECTLY, + substrs = ['uint32_t', '63']) + self.expect("expr (bits.b7)", VARIABLES_DISPLAYED_CORRECTLY, + substrs = ['uint32_t', '127']) + self.expect("expr (bits.four)", VARIABLES_DISPLAYED_CORRECTLY, + substrs = ['uint32_t', '15']) + + self.expect("frame variable --show-types more_bits", VARIABLES_DISPLAYED_CORRECTLY, + substrs = ['(uint32_t:3) a = 3', + '(int:1) = 0', + '(uint8_t:1) b = \'\\0\'', + '(uint8_t:1) c = \'\\x01\'', + '(uint8_t:1) d = \'\\0\'']) + + self.expect("expr (more_bits.a)", VARIABLES_DISPLAYED_CORRECTLY, + substrs = ['uint32_t', '3']) + self.expect("expr (more_bits.b)", VARIABLES_DISPLAYED_CORRECTLY, + substrs = ['uint8_t', '\\0']) + self.expect("expr (more_bits.c)", VARIABLES_DISPLAYED_CORRECTLY, + substrs = ['uint8_t', '\\x01']) + self.expect("expr (more_bits.d)", VARIABLES_DISPLAYED_CORRECTLY, + substrs = ['uint8_t', '\\0']) + def bitfields_variable_python(self): """Use Python APIs to inspect a bitfields variable.""" exe = os.path.join(os.getcwd(), "a.out") diff --git a/lldb/test/lang/c/bitfields/main.c b/lldb/test/lang/c/bitfields/main.c index b833791b3f7..951dd0e5c3a 100644 --- a/lldb/test/lang/c/bitfields/main.c +++ b/lldb/test/lang/c/bitfields/main.c @@ -45,6 +45,23 @@ int main (int argc, char const *argv[]) bits.b7 = i; //// break $source:$line for (i=0; i<(1<<4); i++) bits.four = i; //// break $source:$line + + struct MoreBits + { + uint32_t a : 3; + uint8_t : 1; + uint8_t b : 1; + uint8_t c : 1; + uint8_t d : 1; + }; + + struct MoreBits more_bits; + + more_bits.a = 3; + more_bits.b = 0; + more_bits.c = 1; + more_bits.d = 0; + return 0; //// Set break point at this line. } |

