Skip to content

Conversation

@dfaure-kdab
Copy link

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)

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 10, 2025
@dfaure-kdab dfaure-kdab force-pushed the wip/dfaure/smolstr_pretty_printer branch 2 times, most recently from 3712013 to c58810b Compare November 14, 2025 19:05
@ChayimFriedman2
Copy link
Contributor

We had to force push, you need to rebase on master.

@dfaure-kdab dfaure-kdab force-pushed the wip/dfaure/smolstr_pretty_printer branch from c58810b to ccc0856 Compare November 23, 2025 11:27
@dfaure-kdab
Copy link
Author

Done.

}

#[debugger_visualizer(gdb_script_file = "gdb_smolstr_printer.py")]
mod smolstr_gdb_visualizer {}
Copy link
Contributor

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")]).

Copy link
Author

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.

Copy link
Contributor

@ChayimFriedman2 ChayimFriedman2 left a 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 👍

@dfaure-kdab dfaure-kdab force-pushed the wip/dfaure/smolstr_pretty_printer branch from ccc0856 to 474df6d Compare November 23, 2025 13:48
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)
@dfaure-kdab dfaure-kdab force-pushed the wip/dfaure/smolstr_pretty_printer branch from 474df6d to 0e24a86 Compare November 23, 2025 13:50
@ChayimFriedman2 ChayimFriedman2 added this pull request to the merge queue Nov 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants