Skip to content

Copy debug symbols to the zig build installation directory for debug builds #2848

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

Closed
IanLilleyT opened this issue Jul 8, 2019 · 7 comments
Closed
Labels
zig build system std.Build, the build runner, `zig build` subcommand, package management
Milestone

Comments

@IanLilleyT
Copy link
Contributor

IanLilleyT commented Jul 8, 2019

  • Copy debug symbols to the installation directory along with the exe in Debug builds?
  • Allow embedding debug symbols (where possible)?
  • Pick debug symbols format for systems that support multiple
  • Maybe other uses?

Edited original post to be more specific to my problem

@daurnimator
Copy link
Contributor

Duplicate of #2300?

@andrewrk
Copy link
Member

andrewrk commented Jul 8, 2019

@IanLilleyT thanks for the report. Can you turn this issue into an issue for your use case alone? What exactly are you trying to do? Let's start from there.

@andrewrk andrewrk added this to the 0.6.0 milestone Jul 8, 2019
@IanLilleyT
Copy link
Contributor Author

Sure. I'm mainly concerned with the first bullet point and only added the other bullets after some minor brainstorming on irc. It looks like they might be duplicates of #2300.

Anyway, when using zig build for a debug build, I would like the debug symbols to be copied to the installation directory along with the executable, or at least have control over whether that happens. Currently only the exe moves into the zig-cache/bin folder, which means the debugger can't find the pdb file, and thus no symbols are loaded.

I haven't been able to find a workaround for copying the pdb file either, because the zig cache folders can't be hardcoded in a script.

@IanLilleyT IanLilleyT changed the title More control over debug symbols in the build system Copy debug symbols to the zig build installation directory for Debug builds Jul 8, 2019
@IanLilleyT IanLilleyT changed the title Copy debug symbols to the zig build installation directory for Debug builds Copy debug symbols to the zig build installation directory for debug builds Jul 8, 2019
@andrewrk andrewrk added the zig build system std.Build, the build runner, `zig build` subcommand, package management label Jul 8, 2019
@andrewrk
Copy link
Member

andrewrk commented Jul 8, 2019

@IanLilleyT can you confirm that the commit I pushed allows you to use the debugger?

Now, when the target is windows, the install step will install the pdb file alongside the binaries. This can be disabled by setting strip to true for a build artifact.

@IanLilleyT
Copy link
Contributor Author

Debugging works 😄

I also confirmed strip to true does not generate pdb

@andrewrk andrewrk modified the milestones: 0.6.0, 0.5.0 Sep 29, 2019
@dominictobias
Copy link

Debugging works 😄

I also confirmed strip to true does not generate pdb

Are you able to be a bit more specific how you got debug files to be emitted? I have a custom build.zig for a C++ project and want to output a .dSYM next to the binary which would allow me to visually step through code in VSCode. Clang does this but not sure how to make Zig (then again I don't even know if I'm doing a release or debug build at this point 😅)

@milliewalky
Copy link

milliewalky commented Mar 11, 2023

Bump. I'm also wondering how to do that. @dominictobias have you found the solution yet?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
zig build system std.Build, the build runner, `zig build` subcommand, package management
Projects
None yet
Development

No branches or pull requests

5 participants