| 1 |
import lldb |
| 2 |
from lldbsuite.test.lldbtest import * |
| 3 |
from lldbsuite.test.decorators import * |
| 4 |
import lldbsuite.test.lldbutil as lldbutil |
| 5 |
|
| 6 |
|
| 7 |
class TestObjCXXBridgedPO(TestBase): |
| 8 |
@skipIfDarwinEmbedded |
| 9 |
@skipIf(macos_version=[">=", "13.0"]) |
| 10 |
def test_bridged_type_po_old(self): |
| 11 |
self.build() |
| 12 |
lldbutil.run_to_source_breakpoint( |
| 13 |
self, "break here", lldb.SBFileSpec("main.mm") |
| 14 |
) |
| 15 |
self.expect( |
| 16 |
"po num", |
| 17 |
"did not get the Objective-C object description", |
| 18 |
substrs=["CFNumber", "0x", "42"], |
| 19 |
) |
| 20 |
pointer_val = str(self.frame().FindVariable("num").GetValue()) |
| 21 |
self.expect( |
| 22 |
"po " + pointer_val, |
| 23 |
"did not get the Objective-C object description", |
| 24 |
substrs=["CFNumber", "0x", "42"], |
| 25 |
) |
| 26 |
|
| 27 |
@skipIfDarwinEmbedded |
| 28 |
@skipIf(macos_version=["<", "13.0"]) |
| 29 |
def test_bridged_type_po(self): |
| 30 |
"""Starting on macOS 13 CoreFoundation links against Foundation, |
| 31 |
so we always get the Foundation object description. |
| 32 |
""" |
| 33 |
self.build() |
| 34 |
lldbutil.run_to_source_breakpoint( |
| 35 |
self, "break here", lldb.SBFileSpec("main.mm") |
| 36 |
) |
| 37 |
self.expect( |
| 38 |
"po num", "did not get the Objective-C object description", substrs=["42"] |
| 39 |
) |
| 40 |
pointer_val = str(self.frame().FindVariable("num").GetValue()) |
| 41 |
self.expect( |
| 42 |
"po " + pointer_val, |
| 43 |
"did not get the Objective-C object description", |
| 44 |
substrs=["42"], |
| 45 |
) |