llvm-project/lldb/test/API/lang/objc/struct-description/TestObjCStructDescription.py
Dave Lee fb0653c36b
[lldb] Change po fallback messaging (#175847)
When an object description expression fails, instead of emitting an error, mark it as a
warning instead. Additionally, send the more low level details of the failure to the
`expr` log, and show a more user friendly message:

> `po` was unsuccessful, running `p` instead

rdar://165190497
2026-01-13 16:19:54 -08:00

36 lines
1.1 KiB
Python

import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class TestCase(TestBase):
def test(self):
self.build()
lldbutil.run_to_source_breakpoint(self, "break here", lldb.SBFileSpec("main.m"))
log = self.getBuildArtifact("expr.log")
self.runCmd(f"log enable lldb expr -f {log}")
self.expect(
"vo pair",
substrs=[
"warning: `po` was unsuccessful, running `p` instead",
"(Pair) pair = (f = 2, e = 3)",
],
)
self.filecheck(f"platform shell cat {log}", __file__, f"-check-prefix=CHECK-VO")
# CHECK-VO: Object description fallback due to error: not a pointer type
self.expect(
"expr -O -- pair",
substrs=[
"warning: `po` was unsuccessful, running `p` instead",
"(Pair) (f = 2, e = 3)",
],
)
self.filecheck(
f"platform shell cat {log}", __file__, f"-check-prefix=CHECK-EXPR"
)
# CHECK-EXPR: Object description fallback due to error: not a pointer type