-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Provide a gdb pretty printer for smol_str::SmolStr #21011
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
Provide a gdb pretty printer for smol_str::SmolStr #21011
Conversation
3712013 to
c58810b
Compare
|
We had to force push, you need to rebase on master. |
c58810b to
ccc0856
Compare
|
Done. |
lib/smol_str/src/lib.rs
Outdated
| } | ||
|
|
||
| #[debugger_visualizer(gdb_script_file = "gdb_smolstr_printer.py")] | ||
| mod smolstr_gdb_visualizer {} |
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.
You can make it a crate-level attribute (#![debugger_visualizer(gdb_script_file = "gdb_smolstr_printer.py")]).
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.
Thanks, I didn't know this existed.
Done.
ChayimFriedman2
left a comment
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 don't really have experience with gdb prettyprinters, but the code looks correct to me, and you reported it works, so 👍
ccc0856 to
474df6d
Compare
Auto-loaded via the debugger_visualizer attribute. Tested on smolstr's unittest: $ RUSTFLAGS="-C debuginfo=2 -C opt-level=0" cargo test -p smol_str --no-run $ rust-gdb target/debug/deps/test-a806b111557a7133 (gdb) break test::conversions (gdb) run (gdb) next (gdb) print s (and other locations in that file, to test the three cases: Inline, Static and Heap)
474df6d to
0e24a86
Compare
Auto-loaded via the debugger_visualizer attribute. Tested on smolstr's unittest:
$ RUSTFLAGS="-C debuginfo=2 -C opt-level=0" cargo test -p smol_str --no-run $ rust-gdb target/debug/deps/test-a806b111557a7133 (gdb) break test::conversions
(gdb) run
(gdb) next
(gdb) print s
(and other locations in that file, to test the three cases: Inline, Static and Heap)