Open
Description
In the case of Vec<T>
and String
, it would be possible to have e.g.:
impl<'a, T> DebuggerView<'a> for Vec<T> {
type View = &'a [T];
fn debugger_view(&'a self) -> Self::View { &self[..] }
}
impl<'a> DebuggerView<'a> for String {
type View = &'a str;
fn debugger_view(&'a self) -> Self::View { &self[..] }
}
We would then need:
- support for pretty-printing
&[T]
and&str
- already exists in our custom pretty-printing scripts
- long-term DWARF should allow us to express these directly (see debuginfo: How to (ideally) represent reference and pointer types in DWARF #37504)
- a way to encode
<X as DebuggerView>::debugger_view
inX
's debuginfo- i.e. a symbol name, or maybe we can make symbol names based on DWARF type IDs?
- support for going through
<X as DebuggerView>::debugger_view
for pretty-printing- the method signature above should be relatively simple to call
I suspect there are better APIs that could accommodate more complex data structures, but I'm not sure what the limitation of the pretty-printer scripts are, around being able to call arbitrary functions.
There's also the possibility that we could encode this sort of information as data, instead of compiling it into functions, but that's probably a lot more work.
Metadata
Metadata
Assignees
Labels
Area: Debugging information in compiled programs (DWARF, PDB, etc.)Call for participation: Hard difficulty. Experience needed to fix: A lot.This issue needs exploration and design to see how and if we can fix/implement itCall for partcipation: This issues needs some investigation to determine current statusMedium priorityRelevant to the compiler team, which will review and decide on the PR/issue.Working group: Bad Rust debugging experiences