cmd/compile: DWARF IsStmt flag not set for line although it is executed #45680
What version of Go are you using (
The text was updated successfully, but these errors were encountered:
I can reproduce this problem in 1.16 and on tip.
The problem seems to be happening in the expand_calls phase. Looking at the SSA for main.main, prior to expand_calls we have:
with IsStmt flag set on the deref prior to the call (call itself does not have flag set). In expand_calls, the Deref is rewritten to a Move, and in the process the IsStmt flag is explicitly turned off (https://go.googlesource.com/go/+/f12cf7694f491a13bb39741d183034a917a994b3/src/cmd/compile/internal/ssa/expand_calls.go#634). SSA after expand calls looks like
Note v14 above -- before it had "IstStmt" and now it does not (which makes sense given line 634).
Resulting final assembly for Go 1.16 is:
which explains why we can't set a breakpoint on line 19.
On tip things are also unhappy, however in a slightly different and interesting way (worse in fact):
At the trim phase we have:
which is more or less what was happening in 1.16 modulo reg abi (e.g. the IsStmt marker on the Deref has been lost), but then the final assembly looks like:
Note the IsStmt + line 20 on the MOVQ at 00003. This is a good deal more unhappy than what we had in 1.16. I think the weird position in the MOVQ is being introduced by this code, first
Requesting help from @dr2chase , author of expand_calls and also the firstPos code in ssagen/ssa.go lines 6602/6679.