Uh oh!
There was an error while loading. Please reload this page.
Fix GDB pretty-printer for tuples and pointers - #42278
Conversation
Names of children should not be the same, because GDB uses them to distinguish the children.
rust-highfive
commented
May 28, 2017
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
carols10cents
commented
May 29, 2017
Thanks for the PR! We’ll periodically check in on it to make sure that @alexcrichton or someone else from the team reviews it soon. |
Some pointers values include additional info, so they can't be parsed with int().
8de9edb to
167e4b0Comparealexcrichton
commented
May 30, 2017
( knows more about debuginfo and pretty printers than I ) This looks great though! |
…ters str() can't handle unicode strings
gentoo90
commented
May 30, 2017
|
michaelwoerister
commented
May 30, 2017
Thanks a lot for the PR, @gentoo90! I would be great if you could add test cases to the |
gentoo90
commented
May 31, 2017
Hi @michaelwoerister, is there any way to run a single test using the nightly binary build from |
michaelwoerister
commented
May 31, 2017
You could try |
gentoo90
commented
May 31, 2017
Most of the tests are |
michaelwoerister
commented
May 31, 2017
You should not need LLDB for the GDB based tests. I assume this is on Linux? What's the GDB version you are using? |
gentoo90
commented
May 31, 2017
Yes, gentoo linux, gdb 7.12 |
gentoo90
commented
May 31, 2017
I've found another issue while trying to debug But if I remove |
michaelwoerister
commented
Jun 1, 2017
I just tested with GDB 7.12 on Ubuntu and tests are not ignored for me. If you remove all
Would you mind opening an issue about that? |
A proper way to test tuple field names would be // gdbr-command:interpreter-exec mi2 "-enable-pretty-printing"// gdbr-check:^done// gdbr-command:interpreter-exec mi2 "-var-create noPadding8 @ noPadding8"// gdbr-check:^done,name="noPadding8",numchild="2",value="{...}",type="(i8, u8)",thread-id="1",has_more="0"// gdbr-command:interpreter-exec mi2 "-var-list-children noPadding8"// gdbr-check:^done,numchild="2",displayhint="array",children=[child={name="noPadding8.0",exp="0",numchild="0",value="-100",type="i8",thread-id="1"},child={name="noPadding8.1",exp="1",numchild="0",value="100",type="u8",thread-id="1"}],has_more="0"but |
Use a class without children() method for printing empty structs. Presence of this method makes GDB's variable objects interface act like if the struct had children.
gentoo90
commented
Jun 2, 2017
Added separate pretty-printer for empty structs, which prints the struct type instead of
Testing against variable objects is impossible again without |
arielb1
commented
Jun 6, 2017
| // gdbr-check:$6 = core::option::Option::None | ||
| // gdb-command: print some_string | ||
| // gdbr-check:$7 = Some = {"IAMA optional string!"} |
There was a problem hiding this comment.
We should try making this gdb-check instead of just gdbr-check, so both kinds of GDB are tested.
michaelwoerister
commented
Jun 9, 2017
Ping @gentoo90, regarding #42278 (comment). Could you make these regular |
GDB can be built with Python 2 or with Python 3
gentoo90
commented
Jun 9, 2017
Sorry for delay.
ahh, so that's why |
michaelwoerister
commented
Jun 9, 2017
No worries. Thanks for continuing to work on this!
Yes, that seems like a likely reason. I'm actually not sure what version of GDB is on our test infrastructure. |
michaelwoerister
commented
Jun 9, 2017
@bors r+ Let's give it a try. |
bors
commented
Jun 9, 2017
📌 Commit 63076dd has been approved by |
bors
commented
Jun 9, 2017
Fix GDB pretty-printer for tuples and pointers Names of children should not be the same, because GDB uses them to distinguish the children. |Before|After| |---|---| ||| `main.rs` ```rust enum Test { Zero, One(i32), Two(i32, String), Three(i32, String, Vec<String>), } fn main() { let tuple = (1, 2, "Asdfgh"); let zero = Test::Zero; let one = Test::One(10); let two = Test::Two(42, "Qwerty".to_owned()); let three = Test::Three(9000, "Zxcvbn".to_owned(), vec!["lorem".to_owned(), "ipsum".to_owned(), "dolor".to_owned()]); println!(""); // breakpoint here } ``` `launch.json` ```json { "version": "0.2.0", "configurations": [ { "type": "gdb", "request": "launch", "gdbpath": "rust-gdb", "name": "Launch Program", "valuesFormatting": "prettyPrinters", //this requires plugin Native Debug >= 0.20.0 "target": "./target/debug/test_pretty_printers", "cwd": "${workspaceRoot}" } ] } ```
bors
commented
Jun 9, 2017
☀️ Test successful - status-appveyor, status-travis |
michaelwoerister
commented
Jun 12, 2017
🎉 |




Names of children should not be the same, because GDB uses them to distinguish the children.
main.rslaunch.json{ "version": "0.2.0", "configurations": [ { "type": "gdb", "request": "launch", "gdbpath": "rust-gdb", "name": "Launch Program", "valuesFormatting": "prettyPrinters", //this requires plugin Native Debug >= 0.20.0"target": "./target/debug/test_pretty_printers", "cwd": "${workspaceRoot}" } ] }