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
4 changes: 0 additions & 4 deletions tests/debuginfo/path.rs
Comment thread
jieyouxu marked this conversation as resolved.
Copy link
Copy Markdown
Member

@jieyouxu jieyouxu May 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: okay, so I did some more digging with the help of @NobodyNada (thanks!!), and this is what I can gather (likely contains inaccuracies, happy to be corrected):

  • po is (typically) aliased to expr --object-description, which lldb 21 says
    -O ( --object-description )
              Display using a language-specific description API, if possible.
    
  • The problem is that AFAIK expr (and thus po) tries to "[e]valuate an expression on the current thread" plus --object-description will try to find a language-specific description API where possible
    • Rust doesn't really have this "language-specific description API" (objective C / swift have that upstream AFAICT)
    • Fallback logic previously was sth like (1) try to find lang-specific description API, (2) fallback to p (basic expr) if not found (in our case printing the "data" "/some/path"), silently.
    • @NobodyNada helped to bisect the difference to [lldb] Print ValueObject when GetObjectDescription fails llvm/llvm-project#152417 which AFAICT (IMO very correctly) changes the silent fallback to actually show a warning.
    • The existing //@ lldb-check:"/some/path" fails, because the warnings of course are extra bits, and it's not just a naive "print the data" but instead falls back to p path or expr path.
  • Also, note that on more recent versions of lldb, print is usually aliases to dwim-print (Do What I Mean™️ print).
  • IOW, I think the original po checks happened to accidentally work as it relied on a specific silent fallback behavior, and I think we should just avoid trying to test that. Sure, users can and will try to po path w/ an error message, but at least they still get p path back.

Example failure (lldb 22):

po path
error: not a pointer type (&std::path::Path) "/some/path" { data_ptr = 0x0000000100000b58 length = 10 }
# what `p path` fallback looks like
p path
(&std::path::Path) "/some/path" { data_ptr = 0x0000000100000b58 length = 10 }

For our purposes, I do agree (now) that print (DWIM print) is good enough tbh, and it's probably the best we can do absent actual upstream object description API support (happy to be corrected on this front).

I however suggest only removing the po lines and their corresponding check, but don't relax the check on print {path,pathbuf}, i.e. only do

diff --git a/tests/debuginfo/path.rs b/tests/debuginfo/path.rs
index 27b518fd897..2fffadd8510 100644
--- a/tests/debuginfo/path.rs
+++ b/tests/debuginfo/path.rs
@@ -8,12 +8,8 @@

 //@ lldb-command:print pathbuf
 //@ lldb-check:[...] "/some/path" { inner = "/some/path" { inner = { inner = size=10 { [0] = '/' [1] = 's' [2] = 'o' [3] = 'm' [4] = 'e' [5] = '/' [6] = 'p' [7] = 'a' [8] = 't' [9] = 'h' } } } }
-//@ lldb-command:po pathbuf
-//@ lldb-check:"/some/path"
 //@ lldb-command:print path
 //@ lldb-check:[...] "/some/path" { data_ptr = [...] length = 10 }
-//@ lldb-command:po path
-//@ lldb-check:"/some/path"

Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,8 @@

//@ lldb-command:print pathbuf
//@ lldb-check:[...] "/some/path" { inner = "/some/path" { inner = { inner = size=10 { [0] = '/' [1] = 's' [2] = 'o' [3] = 'm' [4] = 'e' [5] = '/' [6] = 'p' [7] = 'a' [8] = 't' [9] = 'h' } } } }
//@ lldb-command:po pathbuf
//@ lldb-check:"/some/path"
//@ lldb-command:print path
//@ lldb-check:[...] "/some/path" { data_ptr = [...] length = 10 }
//@ lldb-command:po path
//@ lldb-check:"/some/path"

use std::path::Path;

Expand Down
Loading