• David Chase's avatar
    cmd/compile: use src.NoXPos for entry-block constants · f22cf713
    David Chase authored
    The ssa backend is aggressive about placing constants and
    certain other values in the Entry block.  It's implausible
    that the original line numbers for these constants makes
    any sort of sense when it appears to a user stepping in a
    debugger, and they're also not that useful in dumps since
    entry-block instructions tend to be constants (i.e.,
    unlikely to be the cause of a crash).
    
    Therefore, use src.NoXPos for any values that are explicitly
    inserted into a function's entry block.
    
    Passes all tests, including ssa/debug_test.go with both
    gdb and a fairly recent dlv.  Hand-verified that it solves
    the reported problem; constructed a test that reproduced
    a problem, and fixed it.
    
    Modified test harness to allow injection of slightly more
    interesting inputs.
    
    Fixes #22558.
    
    Change-Id: I4476927067846bc4366da7793d2375c111694c55
    Reviewed-on: https://go-review.googlesource.com/81215
    Run-TryBot: David Chase <drchase@google.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarKeith Randall <khr@golang.org>
    f22cf713
func.go 18.3 KB