-
Notifications
You must be signed in to change notification settings - Fork 387
DBG: Show the contents of references and pointers with LLDB #10059
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
269142c
to
51ee74a
Compare
073d77f
to
f230a53
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you resolve merge conflicts, please?
f230a53
to
dc134d0
Compare
@Undin I've resolved merge conflicts and reordered the regexes for readability |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works for me!
Don't forget before merge:
- drop changes on CI
- describe that multiple dereferences don't work after these changes
// lldbr-check:[...]xs = size=4 { [0] = (0 = 1, 1 = 10) [1] = (0 = 2, 1 = 20) [2] = (0 = 3, 1 = 30) [3] = (0 = 4, 1 = 40) } | ||
// lldbg-check:[...]$0 = size=4 { [0] = (__0 = 1, __1 = 10) [1] = (__0 = 2, __1 = 20) [2] = (__0 = 3, __1 = 30) [3] = (__0 = 4, __1 = 40) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did it change and how does it affect users? I can't see any difference with macOS lldb but didn't check with MSVC lldb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should not affect users, so the UI representation for HashMap
is supposed to be the same.
@intellij-rust/qa Please pay attention to this ^
dc134d0
to
d4b7524
Compare
This commit brings automatic dereferencing of Rust references and pointers when debugging with LLDB. For example, now the debugger renders the contents of `&Vec`, `*const Vec` and `*mut Vec`, in addition to previously supported `Vec`. ### Technical information Previously, for each Rust type regex `$type` (for `String`, `Vec`, etc.), we ran the following LLDB commands: ``` (lldb) type summary add -F lldb_lookup.summary_lookup -e -x -h $type --category Rust (lldb) type synthetic add -l lldb_lookup.synthetic_lookup -x $type --category Rust ``` They attach `summary_lookup` and `synthetic_lookup` Python functions as summary/synthetic providers for the given types. Actual providers are invoked by these lookup functions. This was done for two main reasons: - for consistency, as GDB pretty-printing API requires us to use lookup functions (https://sourceware.org/gdb/onlinedocs/gdb/Writing-a-Pretty_002dPrinter.html); - for flexibility, for example, to be able to choose the provider depending not only on the type regex, but also on its type class (`eTypeClassStruct`, `eTypeClassPointer`, etc.). It turned out, however, that such flexibility is not needed for LLDB anymore. Moreover, it appeared that the current implementation breaks the automatic dereferencing of pointers provided by LLDB by default when registering pretty-printers just by regex. So now, for each pair of `$type` and the corresponding `$provider`, we run these LLDB commands instead: ``` (lldb) type summary add -F lldb_formatters.lldb_providers.$provider -e -x -h $type --category Rust (lldb) type synthetic add -l lldb_formatters.lldb_providers.$provider -x $type --category Rust ```
d4b7524
to
2e498db
Compare
bors r=Undin |
Build succeeded: |
Fixes #9050.
Partially fixes #9252 (LLDB only).
This PR brings automatic dereferencing of Rust references and pointers when debugging with LLDB. For example, now the debugger renders the contents of
&Vec
,*const Vec
and*mut Vec
, in addition to previously supportedVec
.Technical information
Previously, for each Rust type regex
$type
(forString
,Vec
, etc.), we ran the following LLDB commands:They attach
summary_lookup
andsynthetic_lookup
Python functions as summary/synthetic providers for the given types. Actual providers are invoked by these lookup functions. This was done for two main reasons:eTypeClassStruct
,eTypeClassPointer
, etc.).It turned out, however, that such flexibility is not needed for LLDB anymore. Moreover, it appeared that the current implementation breaks the automatic dereferencing of pointers provided by LLDB by default when registering pretty-printers just by regex.
So now, for each pair of
$type
and the corresponding$provider
, we run these LLDB commands instead:changelog: Show the contents of references and pointers when debugging with LLDB