Skip to content

[debuginfo][codeview] avoid using line zero artificial location for t… #72534

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 1 commit into from
Mar 26, 2024

Conversation

hyp
Copy link
Contributor

@hyp hyp commented Mar 22, 2024

…raps when emitting codeview

This fixes an issue where the debug locations for Swift traps were dropped in the produced PDB files, as they were pointing to line 0

I validated this on a sample project using WinDbgx, which can now correctly trap on the same line in multiple places.

Before:
Screenshot 2024-03-22 at 12 58 48 PM

After:
Screenshot 2024-03-22 at 1 36 33 PM

@hyp
Copy link
Contributor Author

hyp commented Mar 22, 2024

@swift-ci please test

@hyp hyp marked this pull request as ready for review March 25, 2024 15:40
@hyp hyp requested a review from adrian-prantl as a code owner March 25, 2024 15:40
@hyp hyp force-pushed the eng/win-dbg-trapz branch from d6489c8 to 6541be9 Compare March 25, 2024 15:40
@hyp hyp requested review from compnerd and hjyamauchi March 25, 2024 15:40
@hyp
Copy link
Contributor Author

hyp commented Mar 25, 2024

@swift-ci please test

Copy link
Contributor

@adrian-prantl adrian-prantl left a comment

Choose a reason for hiding this comment

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

Long-term, I wonder if we should investigate whether we couldn't produce both CodeView and DWARF at the same time, so users of WinDbg see something, while users of LLDB get the full experience.

: 0,
Opts.DebugInfoFormat == IRGenDebugInfoFormat::CodeView ? TrapLoc.getCol()
: 0,
TrapSP, TrapLoc);
Copy link
Contributor

Choose a reason for hiding this comment

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

This will likely result in larger debug info, since the abstract origin of the inlined function can no longer be uniqued but that's the kind of tradeoff you'll need to make.

Copy link
Contributor Author

@hyp hyp Mar 25, 2024

Choose a reason for hiding this comment

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

Yep, I agree. I think the win in crash investigation is worth it here.

…raps when emitting codeview

This fixes an issue where the debug locations for Swift traps were dropped in the produced PDB files, as they were pointing to line 0

I validated this on a sample project using WinDbgx, which can now correctly trap on the same line in multiple places
@hyp hyp force-pushed the eng/win-dbg-trapz branch from 6541be9 to 8484c61 Compare March 25, 2024 20:35
@hyp hyp removed request for xedin, slavapestov and hborla March 25, 2024 20:35
@hyp
Copy link
Contributor Author

hyp commented Mar 25, 2024

Long-term, I wonder if we should investigate whether we couldn't produce both CodeView and DWARF at the same time, so users of WinDbg see something, while users of LLDB get the full experience.

What specifically are you thinking of? making the frontend emit IR that's compatible with both DWARF and CodeView, and then lowering it to something that emits both DWARF and CodeView files in LLVM?

@hyp
Copy link
Contributor Author

hyp commented Mar 25, 2024

@swift-ci please test

@adrian-prantl
Copy link
Contributor

Long-term, I wonder if we should investigate whether we couldn't produce both CodeView and DWARF at the same time, so users of WinDbg see something, while users of LLDB get the full experience.

What specifically are you thinking of? making the frontend emit IR that's compatible with both DWARF and CodeView, and then lowering it to something that emits both DWARF and CodeView files in LLVM?

Yes something along those lines. Of course we'd then need to make the kinds of decisions done in this patch in the backend instead.

@hyp hyp enabled auto-merge March 26, 2024 00:05
@hyp hyp merged commit 327b07b into swiftlang:main Mar 26, 2024
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.

4 participants