[lldb] Fix nondeterminism in TestCppBitfields

The test was printing a char[3] variable without a terminating nul. The
memory after that variable (an unnamed bitfield) was not initialized. If
the memory happened to be nonzero, the summary provider for the variable
would run off into the next field.

This is probably not the right behavior (it should stop at the end of
the array), but this is not the purpose of this test. I have filed
pr44649 for this bug, and fixed the test to not depend on this behavior.
This commit is contained in:
Pavel Labath 2020-01-24 12:02:43 +01:00
parent 0ae13766ff
commit 77cedb0cdb
2 changed files with 2 additions and 2 deletions

View File

@ -80,7 +80,7 @@ class CppBitfieldsTestCase(TestBase):
"frame variable --show-types lbd",
VARIABLES_DISPLAYED_CORRECTLY,
substrs=[
'(char [3]) arr = "abc"',
'(char [3]) arr = "ab"',
'(int:32) =',
'(unsigned int:20) a = 5',
])

View File

@ -73,7 +73,7 @@ int main(int argc, char const *argv[]) {
lbd.arr[0] = 'a';
lbd.arr[1] = 'b';
lbd.arr[2] = 'c';
lbd.arr[2] = '\0';
lbd.a = 5;