blob: b504c01b06da4c57a9f7add93634377df4dd5897 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
"""
Test lldb behaves sanely when formatting corrupted `std::string`s.
"""
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class LibcxxInvalidStringDataFormatterTestCase(TestBase):
@add_test_categories(["libc++"])
@skipIf(oslist=[lldbplatformutil.getDarwinOSTriples()], archs=["arm", "aarch64"])
def test(self):
self.build()
(target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(
self, "Set break point at this line.", lldb.SBFileSpec("main.cpp")
)
frame = thread.frames[0]
if not self.process().GetAddressByteSize() == 8:
self.skipTest("The test requires a 64-bit process")
# The test assumes that std::string is in its cap-size-data layout.
self.expect(
"frame variable garbage1", substrs=["garbage1 = Summary Unavailable"]
)
self.expect(
"frame variable garbage2", substrs=[r'garbage2 = "\xfa\xfa\xfa\xfa"']
)
self.expect("frame variable garbage3", substrs=[r'garbage3 = "\xf0\xf0"'])
self.expect(
"frame variable garbage4", substrs=["garbage4 = Summary Unavailable"]
)
self.expect(
"frame variable garbage5", substrs=["garbage5 = Summary Unavailable"]
)
|