Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@ def tearDown(self):
self.runCmd("settings clear auto-confirm")
TestBase.tearDown(self)

def containsLibmallocError(self, output):
for error in [
"pointer being freed was not allocated",
"not an allocated block",
]:
if error in output:
return True
return False

@skipIfAsan # The test process intentionally double-frees.
@skipUnlessDarwin
def test_cli(self):
Expand All @@ -33,15 +42,15 @@ def test_cli(self):

self.expect("process launch", patterns=["Process .* launched: .*a.out"])

self.expect(
"process status --verbose",
patterns=[
"Extended Crash Information",
"Crash-Info Annotations",
"pointer being freed was not allocated",
],
result = lldb.SBCommandReturnObject()
self.dbg.GetCommandInterpreter().HandleCommand(
"process status --verbose", result
)

self.assertIn("Extended Crash Information", result.GetOutput())
self.assertIn("Crash-Info Annotations", result.GetOutput())
self.assertTrue(self.containsLibmallocError(result.GetOutput()))

@skipIfAsan # The test process intentionally hits a memory bug.
@skipUnlessDarwin
def test_api(self):
Expand All @@ -67,7 +76,7 @@ def test_api(self):

self.assertTrue(crash_info.IsValid())

self.assertIn("pointer being freed was not allocated", stream.GetData())
self.assertTrue(self.containsLibmallocError(stream.GetData()))

# dyld leaves permanent crash_info records when testing on device.
@skipIfDarwinEmbedded
Expand Down