Skip to content

Improve debugger visualization for ndarray arrays using #[debugger_visualizer] #1519

Open
@NeLeGo

Description

@NeLeGo

This issue has been discussed in #827 and #366, but it remains partially unresolved.

Problem and Previous solution

When debugging ndarray arrays in VSCode, their display is often not human-readable:

image

However, with this custom formatter.py file (along with some additional configuration), the display becomes much more readable:

image

(This solution was originally provided by @MartinRJDagleish in this comment)

More Discussion

The #[debugger_visualizer] attribute has been stabalized in Rust 1.71.0 for 2 years, which can be used to embed a debugger visualizer file into the debug information. This means we can write pretty-printer files (Python script, for GDB and LLDB) and .natvis files (for Windbg) for ndarray arrays, and embed them into the Rust code using the attribute, to provide official support for debugger visualization of ndarray arrays.

I'm not sure whether it is a feasible approach, but I'm glad to have a discussion.

Relevant Links

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions