zig icon indicating copy to clipboard operation
zig copied to clipboard

Use DWARF debug format option

Open chrisbodhi opened this issue 1 year ago • 7 comments

Addresses #19478

chrisbodhi avatar Apr 12 '24 18:04 chrisbodhi

I can see in past versions 32-bit format was used, and the -dwarf64 option was added to resolve a specific problem (https://github.com/ziglang/zig/issues/7962), so default to 32-bit should be good for most situations.

geezmolycos avatar Apr 16 '24 03:04 geezmolycos

Also, as a further suggestion, it might be straightforward to also support DWARF generation for windows target (COFF object) with these options. As mentioned in CodeLLDB's wiki page, LLDB's support for CodeView is incomplete, and GDB currently has no support for Codeview.

Allowing DWARF generation for windows could make it easier to integrate with mingw toolchain (which uses GDB or LLDB) and to debug zig program in Wine environment

geezmolycos avatar Apr 16 '24 03:04 geezmolycos

@geezmolycos I made a pass at adding DWARF support for COFF objects as you suggested, but with my limited time, wasn't able to come up with a good emulation solution for verifying my changes. I'd prefer to add a new issue for adding DWARF support for COFF objects, and get this code reviewed as is. How does that all sound to you?

chrisbodhi avatar Apr 23 '24 00:04 chrisbodhi

Okay, the current solution should be fine for the original problem. I know that the COFF thing might need more reviewing and testing. I will look into that and post another issue to find help or try to work with that myself. Anyways, thanks for your contribution

geezmolycos avatar Apr 23 '24 03:04 geezmolycos

Thanks for all of your guidance, @geezmolycos, and for writing a detailed & helpful issue -- that made it much easier to contribute. :D

chrisbodhi avatar Apr 23 '24 12:04 chrisbodhi

@kubkon 👋 Pinging for a review, since you've previously reviewed a different, related PR.

chrisbodhi avatar Apr 28 '24 18:04 chrisbodhi

@andrewrk 👋 Pinging for a review

chrisbodhi avatar May 03 '24 17:05 chrisbodhi

Closing since my instructions for getting the PR landed were ignored. Bug report still exists to track the issue.

andrewrk avatar Jul 01 '24 18:07 andrewrk

@andrewrk thanks for the explanation and for working to keep the repo tidy. I tried some fixes to handle the null case, but didn't arrive at a solution that worked for all cases. As a new user to Zig, I tried working it out myself, but could have reached out for assistance sooner. When I have some extra brainspace (and if the bug report is still open), I'll do so and re-open the PR.

chrisbodhi avatar Jul 01 '24 20:07 chrisbodhi