Skip to content

rust-lldb unable to pretty-print PathBuf or OsString #48462

Closed
@tmccombs

Description

@tmccombs

If path is a PathBuf, printing it from lldb does not give a string representation as I would expect.

(lldb) frame variable path
Traceback (most recent call last):
  File "/home/thayne/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/etc/lldb_rust_formatters.py", line 99, in print_val
    is_tuple_like = False)
  File "/home/thayne/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/etc/lldb_rust_formatters.py", line 220, in print_struct_val
    body = separator.join([render_child(idx) for idx in range(field_start_index, len(fields))])
  File "/home/thayne/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/etc/lldb_rust_formatters.py", line 213, in render_child
    return this + print_val(field_val.get_wrapped_value(), internal_dict)
TypeError: cannot concatenate 'str' and 'NoneType' objects
(std::path::PathBuf) path = {
  inner = None
}

If I explicitly refer to path.inner it shows "None" for the inner OsString:

(lldb) frame variable path.inner
(std::ffi::os_str::OsString) path.inner = None

If I use path.inner.inner I finally get a vec representation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-debuginfoArea: Debugging information in compiled programs (DWARF, PDB, etc.)C-enhancementCategory: An issue proposing an enhancement or a PR with one.P-mediumMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions