Skip to content

DBG: add support for pretty printing nonzero numbers #5270

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

Merged
merged 2 commits into from
Apr 30, 2020

Conversation

Kobzol
Copy link
Member

@Kobzol Kobzol commented Apr 21, 2020

This PR adds support for pretty printing NonZero numbers from the standard library. So far I have implemented support for GDB, if you think that my approach is OK, let me know and I'll try to add support for LLDB.

Fixes: #5247

@Kobzol
Copy link
Member Author

Kobzol commented Apr 22, 2020

Rust 1.32.0 doesn't seem to know about NonZeroI32, that's why the test is failing. Should I change the test to only include NonZeroU32?

@Undin
Copy link
Member

Undin commented Apr 23, 2020

@Kobzol some time ago we introduced special comments to restrict version of rustc that should be used for a particular test
They are // min-version: %rustc-version% or // max-version: %rustc-version%. You can find them, for example, here
So you may restrict minimal version of rustc for NonZero* test. Or you may split it into several tests and specify min rustc version only for part of them

@Kobzol
Copy link
Member Author

Kobzol commented Apr 23, 2020

Thank you, I have added a minimum rustc version comment.

When I added tests for LLDB, I have noticed something peculiar: they immediately passed, even though I have not implemented the LLDB formatter for NonZero integers yet. As you can see in my latest commit (c55a3a7), I have purposefully added an error to a different LLDB test and CI failed, as expected, so something is wrong with my setup.
I'm running the tests locally with ./gradlew runPrettyPrintersTests --no-daemon. Do you have any idea what might be causing the problem?

@Kobzol Kobzol force-pushed the debugger-nonzero branch from 3d31a18 to 1135330 Compare April 29, 2020 16:31
@artemmukhin
Copy link
Member

@Kobzol I'm not sure what might be wrong with your setup. You can try to debug pretty_printers_tests by running pretty_printers_tests/main.rs with the following command in the run configuration:

run --package pretty_printers_test --bin pretty_printers_test -- lldb "<IntelliJ_Rust>/deps/clion-2020.1/bin/lldb/linux/lib/python3.6/site-packages" <193 or 201>

@artemmukhin artemmukhin added this to the v122 milestone Apr 30, 2020
@Kobzol
Copy link
Member Author

Kobzol commented Apr 30, 2020

Thank you. I didn't notice before that LLDB needs special syntax for checking the output in 201 -- this was the problem. I also used a wrong minimum rustc version. The tests should now be fixed (I hope :)
).

@Kobzol
Copy link
Member Author

Kobzol commented Apr 30, 2020

Damn, the tests failed on my fork's Github actions :-( I use the exact same // min-version: 1.X.Y annotation that is used in other tests that are successfully skipped.

I thought that this annotation will skip compilation of the test, but it seems that it only skips checking the test debug output, is that correct? In that case I have to modify the test to work with Rust 1.32, otherwise the tests will not pass.

@artemmukhin
Copy link
Member

@Kobzol Oh, you're right. You can try changing test_runner.rs to compile the test after parsing & checking debugger commands (i.e. to call compile_test after calling parse_debugger_commands).

@Kobzol
Copy link
Member Author

Kobzol commented Apr 30, 2020

Thanks, now the tests finally pass. They are possibly also just a teeeeny tiny bit faster now that skipped tests are not being compiled :)

Copy link
Member

@artemmukhin artemmukhin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Let's squash the commits into two (one about NonZero and another one about test_runner.rs) before merge

@Kobzol Kobzol force-pushed the debugger-nonzero branch from a8ed3df to cdc3fd1 Compare April 30, 2020 14:56
@artemmukhin
Copy link
Member

Thank you!

bors r+

@bors
Copy link
Contributor

bors bot commented Apr 30, 2020

Build succeeded:

@bors bors bot merged commit 43b4373 into intellij-rust:master Apr 30, 2020
@Kobzol Kobzol deleted the debugger-nonzero branch April 30, 2020 17:54
@artemmukhin artemmukhin mentioned this pull request Sep 3, 2021
50 tasks
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jun 26, 2022
…rk-Simulacrum

Add GDB/LLDB pretty-printers for NonZero types

Add GDB/LLDB pretty-printers for `NonZero` types.
These pretty-printers were originally implemented for IntelliJ Rust by `@Kobzol` in intellij-rust/intellij-rust#5270.

Part of rust-lang#29392.
JohnTitor added a commit to JohnTitor/rust that referenced this pull request Aug 23, 2022
…sleywiser

Add GDB/LLDB pretty-printers for NonZero types

Add GDB/LLDB pretty-printers for `NonZero` types.
These pretty-printers were originally implemented for IntelliJ Rust by `@Kobzol` in intellij-rust/intellij-rust#5270.

Part of rust-lang#29392.
JohnTitor added a commit to JohnTitor/rust that referenced this pull request Aug 24, 2022
…sleywiser

Add GDB/LLDB pretty-printers for NonZero types

Add GDB/LLDB pretty-printers for `NonZero` types.
These pretty-printers were originally implemented for IntelliJ Rust by ``@Kobzol`` in intellij-rust/intellij-rust#5270.

Part of rust-lang#29392.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Aug 28, 2022
…sleywiser

Add GDB/LLDB pretty-printers for NonZero types

Add GDB/LLDB pretty-printers for `NonZero` types.
These pretty-printers were originally implemented for IntelliJ Rust by ``@Kobzol`` in intellij-rust/intellij-rust#5270.

Part of rust-lang#29392.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Aug 28, 2022
…sleywiser

Add GDB/LLDB pretty-printers for NonZero types

Add GDB/LLDB pretty-printers for `NonZero` types.
These pretty-printers were originally implemented for IntelliJ Rust by ```@Kobzol``` in intellij-rust/intellij-rust#5270.

Part of rust-lang#29392.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Show NonZero* types in debugger view without additional level of nesting
3 participants