This is an archive of the discontinued LLVM Phabricator instance.

[codeview] Try to avoid emitting .cv_loc with line zero
ClosedPublic

Authored by rnk on Oct 9 2019, 5:13 PM.

Details

Summary

Visual Studio doesn't like it while stepping. It kicks you out of the
source view of the file being stepped through and tries to fall back to
the disassembly view.

Fixes PR43530

The fix is incomplete, because it's possible to have a basic block with
no source locations at all. In this case, we don't emit a .cv_loc, but
that will result in wrong stepping behavior in the debugger if the
layout predecessor of the location-less BB has an unrelated source
location. We could try harder to find a valid location that dominates or
post-dominates the current BB, but in general it's a dataflow problem,
and one still might not exist. I left a FIXME about this.

As an alternative, we might want to consider having the middle-end check
if its emitting codeview and get it to stop using line zero.

Diff Detail

Event Timeline

rnk created this revision.Oct 9 2019, 5:13 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 9 2019, 5:13 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
akhuang accepted this revision.Oct 9 2019, 5:50 PM

lgtm-

llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
2863

typo

This revision is now accepted and ready to land.Oct 9 2019, 5:50 PM
This revision was automatically updated to reflect the committed changes.