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

Link: Add natvis file support #19873

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

The-King-of-Toasters
Copy link
Contributor

@The-King-of-Toasters The-King-of-Toasters commented May 6, 2024

This PR the ability to include Natvis files into a module's PDB using Compile.addObjectFile. This is eventually passed to the linker via the -NATVIS:[file] flag. Fixes: #19646.

This is my first PR that touches the compiler, so review by people working in that area would be great.

Features:

  • Link natvis files for executables.
  • Include natvis files specified by any dependency using Compile.linkLibrary.
  • Create a set of visualisations for the language & standard library and add them to every PDB by default.

Reasons for Inclusion

  • Enhances the ability for the Zig build system to be used to build existing C/C++ projects on Windows.
  • Improves the debugging experience for Zig devs on windows, which is already an underserved market.
  • Doesn't modify/bloat the code as it only add a named stream to PDBs.

Issues

There is no way to add visualizers for slices as they have square brackets in their type name, which isn't allowed for C++ types. This is an issue the Rust devs ran into and AFAIK still hasn't been fixed. Note that it is still possible to do (char*)buf.ptr,[buf.len]s8 for a []u8 slice when in the debugger.

Some types like packed structs/comptime known enums are lowered to their integer representation when debugging, and these base types cannot be selected for visualization.

Adds the ability to include Natvis[1] files into a module's PDB using
`Compile.addObjectFile`. This is eventually passed to the linker via the
`-NATVIS:[file]` flag.

Fixes: ziglang#19646
@The-King-of-Toasters
Copy link
Contributor Author

@kubkon Could you put this on your review queue? I don't want the pr to get deleted due to being a draft for a month :x.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add the ability to link Natvis files into PDBs
1 participant