Skip to content
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

Add Visual Studio formatters for String, Array, and Hash #12212

Merged

Conversation

HertzDevil
Copy link
Contributor

This patch provides Natvis formatter definitions for String, Array, and Hash:

image

Without the formatters:

image

System-wide Natvis files are only suitable for languages supported by Visual Studio itself, and Crystal isn't one of them, so the best way to use the formatters is by embedding them directly into the PDB file during a debug build:

> crystal build main.cr --debug --link-flags=/NATVIS:...\etc\msvc\crystal.natvis

The path to crystal.natvis must be an absolute path, because linking takes place inside the cache directory, not from the current working directory.

Perhaps eventually the compiler itself could be responsible for emitting the Natvis file itself? Related: #12112

@HertzDevil HertzDevil added kind:feature topic:compiler:debugger platform:windows Windows support based on the MSVC toolchain / Win32 API labels Jul 6, 2022
@hugopl
Copy link
Contributor

hugopl commented Aug 8, 2022

Perhaps eventually the compiler itself could be responsible for emitting the Natvis file itself

I think it should for windows debug builds with msvc, and it would be possible to disable it by a flag.

@HertzDevil HertzDevil added this to the 1.6.0 milestone Aug 13, 2022
@straight-shoota straight-shoota merged commit a8fd544 into crystal-lang:master Aug 16, 2022
@HertzDevil HertzDevil deleted the feature/natvis-formatter branch August 16, 2022 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:feature platform:windows Windows support based on the MSVC toolchain / Win32 API topic:compiler:debugger
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants