This is an archive of the discontinued LLVM Phabricator instance.

llgo: Generate llvm.dbg.value calls
AbandonedPublic

Authored by axw on Dec 13 2014, 11:38 PM.

Details

Reviewers
pcc
Summary

This patch introduces calls to llvm.dbg.value for all local variables,
regardless of whether they are in memory or registers. We translate
go/ssa's DebugRef instructions directly, only where the target expression
is an identifier. go/ssa only generates DebugRef instructions for
referenced variables; the only local variables that may exist in a
function without being referenced are parameters, so we generate initial
calls for each decoded argument.

The "Debug Info Version" module flag has been bumped up to 2, to
match trunk LLVM's version.

We no longer emit source locations until the body has been entered.
This will cause debuggers to process the initial instructions when
breaking on the function.

Diff Detail

Event Timeline

axw updated this revision to Diff 17260.Dec 13 2014, 11:38 PM
axw retitled this revision from to llgo: Generate llvm.dbg.value calls.
axw updated this object.
axw edited the test plan for this revision. (Show Details)
axw added a reviewer: pcc.
axw added a subscriber: Unknown Object (MLST).
pcc edited edge metadata.Dec 14 2014, 6:50 PM

This probably will not apply correctly after the changes I made in r224180. Would you mind updating and fixing any merge conflicts? Thanks.

debug/debug.go
97

The cwd changes seem unrelated. Can you move those to a separate revision, please?

irgen/ssa.go
888

Perhaps you want to check IsAddr to decide whether to emit an llvm.dbg.value here or not?

axw abandoned this revision.Dec 14 2014, 10:27 PM

Thanks for the review. I'll create a new revision when I've fixed it.

debug/debug.go
97

Note entirely unrelated, the metadata generated for files in getFile lacks directory names. I'll move it anyway, and keep this revision about DebugRefs.

irgen/ssa.go
888

Yes, thanks. This highlights another problem: if only the *address* of a local var is referenced, then only an address DebugRef gets generated. I'll need to rework this, since my assertions in the summary were wrong.