Skip to content

Commit 4a94b3e

Browse files
authored
Updates for go1.18beta1 (#2831)
* go.mod: update golang.org/x/tools to v0.1.8 Fixes TestGeneratedDoc on go1.18 * TeamCity: bump test matrix Add 1.18 to test matrix. Remove 1.15 from test matrix and from support range. * proc,tests: update for regabi on arm64 and 386 Make sure that stacktrace registers always contain the PC register of the current frame, even though the debug_frame rules might not specify it on architectures that use a link register. The PC register is needed to look up loclist entries for variable evaluation. * goversion: bump maximum supported Go version to 1.18 * proc: disable asyncpreempt on linux/arm64 Asyncpreempt on linux/arm64 can sometimes restart a sequence of instructions which will make breakpoint appear to be hit twice in some cases.
1 parent 07bcf0c commit 4a94b3e

File tree

18 files changed

+167
-110
lines changed

18 files changed

+167
-110
lines changed

Diff for: .teamcity/settings.kts

+6-6
Original file line numberDiff line numberDiff line change
@@ -35,23 +35,23 @@ To debug in IntelliJ Idea, open the 'Maven Projects' tool window (View
3535
version = "2020.2"
3636

3737
val targets = arrayOf(
38-
"linux/amd64/1.15",
3938
"linux/amd64/1.16",
4039
"linux/amd64/1.17",
40+
"linux/amd64/1.18",
4141
"linux/amd64/tip",
4242

43-
"linux/386/1.17",
43+
"linux/386/1.18",
4444

45-
"linux/arm64/1.17",
45+
"linux/arm64/1.18",
4646
"linux/arm64/tip",
4747

48-
"windows/amd64/1.17",
48+
"windows/amd64/1.18",
4949
"windows/amd64/tip",
5050

51-
"mac/amd64/1.17",
51+
"mac/amd64/1.18",
5252
"mac/amd64/tip",
5353

54-
"mac/arm64/1.17",
54+
"mac/arm64/1.18",
5555
"mac/arm64/tip"
5656
)
5757

Diff for: _scripts/test_linux.sh

-4
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@ function getgo {
2121
}
2222

2323
if [ "$version" = "gotip" ]; then
24-
# TODO: remove this
25-
if [ "$arch" != "amd64" ]; then
26-
exit 0
27-
fi
2824
echo Building Go from tip
2925
getgo $(curl https://go.dev/VERSION?m=text)
3026
export GOROOT_BOOTSTRAP=$GOROOT

Diff for: _scripts/test_mac.sh

-4
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@ ARCH=$2
88
TMPDIR=$3
99

1010
if [ "$GOVERSION" = "gotip" ]; then
11-
# TODO: remove this
12-
if [ "$arch" != "amd64" ]; then
13-
exit 0
14-
fi
1511
bootstrapver=$(curl https://go.dev/VERSION?m=text)
1612
cd $TMPDIR
1713
curl -sSL "https://storage.googleapis.com/golang/$bootstrapver.darwin-$ARCH.tar.gz" | tar -xz

Diff for: _scripts/test_windows.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function GetGo($version) {
3434
}
3535

3636
if ($version -eq "gotip") {
37-
Exit 0
37+
#Exit 0
3838
$latest = Invoke-WebRequest -Uri https://golang.org/VERSION?m=text -UseBasicParsing | Select-Object -ExpandProperty Content
3939
GetGo $latest
4040
$env:GOROOT_BOOTSTRAP = $env:GOROOT

Diff for: go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ require (
1818
go.starlark.net v0.0.0-20200821142938-949cc6f4b097
1919
golang.org/x/arch v0.0.0-20190927153633-4e8777c89be4
2020
golang.org/x/sys v0.0.0-20211019181941-9d821ace8654
21-
golang.org/x/tools v0.1.8-0.20211028023602-8de2a7fd1736
21+
golang.org/x/tools v0.1.8
2222
gopkg.in/yaml.v2 v2.4.0
2323
)

Diff for: go.sum

+2
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,8 @@ golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtn
309309
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
310310
golang.org/x/tools v0.1.8-0.20211028023602-8de2a7fd1736 h1:cw6nUxdoEN5iEIWYD8aAsTZ8iYjLVNiHAb7xz/80WO4=
311311
golang.org/x/tools v0.1.8-0.20211028023602-8de2a7fd1736/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU=
312+
golang.org/x/tools v0.1.8 h1:P1HhGGuLW4aAclzjtmJdf0mJOjVUZUzOTqkAkWL+l6w=
313+
golang.org/x/tools v0.1.8/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU=
312314
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
313315
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
314316
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

Diff for: pkg/goversion/compat.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ import (
88

99
var (
1010
MinSupportedVersionOfGoMajor = 1
11-
MinSupportedVersionOfGoMinor = 15
11+
MinSupportedVersionOfGoMinor = 16
1212
MaxSupportedVersionOfGoMajor = 1
13-
MaxSupportedVersionOfGoMinor = 17
13+
MaxSupportedVersionOfGoMinor = 18
1414
goTooOldErr = fmt.Sprintf("Go version %%s is too old for this version of Delve (minimum supported version %d.%d, suppress this error with --check-go-version=false)", MinSupportedVersionOfGoMajor, MinSupportedVersionOfGoMinor)
1515
goTooOldWarn = fmt.Sprintf("WARNING: undefined behavior - Go version %%s is too old for this version of Delve (minimum supported version %d.%d)", MinSupportedVersionOfGoMajor, MinSupportedVersionOfGoMinor)
1616
dlvTooOldErr = fmt.Sprintf("Version of Delve is too old for Go version %%s (maximum supported version %d.%d, suppress this error with --check-go-version=false)", MaxSupportedVersionOfGoMajor, MaxSupportedVersionOfGoMinor)

Diff for: pkg/proc/native/proc.go

+17-5
Original file line numberDiff line numberDiff line change
@@ -266,11 +266,23 @@ func (dbp *nativeProcess) initialize(path string, debugInfoDirs []string) (*proc
266266
stopReason = proc.StopAttached
267267
}
268268
tgt, err := proc.NewTarget(dbp, dbp.pid, dbp.memthread, proc.NewTargetConfig{
269-
Path: path,
270-
DebugInfoDirs: debugInfoDirs,
271-
DisableAsyncPreempt: runtime.GOOS == "windows" || runtime.GOOS == "freebsd",
272-
StopReason: stopReason,
273-
CanDump: runtime.GOOS == "linux"})
269+
Path: path,
270+
DebugInfoDirs: debugInfoDirs,
271+
272+
// We disable asyncpreempt for the following reasons:
273+
// - on Windows asyncpreempt is incompatible with debuggers, see:
274+
// https://github.com/golang/go/issues/36494
275+
// - freebsd's backend is generally broken and asyncpreempt makes it even more so, see:
276+
// https://github.com/go-delve/delve/issues/1754
277+
// - on linux/arm64 asyncpreempt can sometimes restart a sequence of
278+
// instructions, if the sequence happens to contain a breakpoint it will
279+
// look like the breakpoint was hit twice when it was "logically" only
280+
// executed once.
281+
// See: https://go-review.googlesource.com/c/go/+/208126
282+
DisableAsyncPreempt: runtime.GOOS == "windows" || runtime.GOOS == "freebsd" || (runtime.GOOS == "linux" && runtime.GOARCH == "arm64"),
283+
284+
StopReason: stopReason,
285+
CanDump: runtime.GOOS == "linux"})
274286
if err != nil {
275287
return nil, err
276288
}

Diff for: pkg/proc/proc_test.go

+4
Original file line numberDiff line numberDiff line change
@@ -1335,6 +1335,10 @@ func TestFrameEvaluation(t *testing.T) {
13351335
g, err := proc.GetG(p.CurrentThread())
13361336
assertNoError(err, t, "GetG()")
13371337

1338+
frames, err := g.Stacktrace(40, 0)
1339+
t.Logf("Goroutine %d %#v", g.ID, g.Thread)
1340+
logStacktrace(t, p, frames)
1341+
13381342
for i := 0; i <= 3; i++ {
13391343
scope, err := proc.ConvertEvalScope(p, g.ID, i+1, 0)
13401344
assertNoError(err, t, fmt.Sprintf("ConvertEvalScope() on frame %d", i+1))

Diff for: pkg/proc/stack.go

+3
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,9 @@ func (it *stackIterator) newStackframe(ret, retaddr uint64) Stackframe {
276276
it.regs.FrameBase = it.frameBase(fn)
277277
}
278278
r := Stackframe{Current: Location{PC: it.pc, File: f, Line: l, Fn: fn}, Regs: it.regs, Ret: ret, addrret: retaddr, stackHi: it.stackhi, SystemStack: it.systemstack, lastpc: it.pc}
279+
if r.Regs.Reg(it.regs.PCRegNum) == nil {
280+
r.Regs.AddReg(it.regs.PCRegNum, op.DwarfRegisterFromUint64(it.pc))
281+
}
279282
r.Call = r.Current
280283
if !it.top && r.Current.Fn != nil && it.pc != r.Current.Fn.Entry {
281284
// if the return address is the entry point of the function that

Diff for: pkg/proc/test/support.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -383,11 +383,11 @@ func MustHaveCgo(t *testing.T) {
383383
func RegabiSupported() bool {
384384
// Tracks regabiSupported variable in ParseGOEXPERIMENT internal/buildcfg/exp.go
385385
switch {
386-
case !goversion.VersionAfterOrEqual(runtime.Version(), 1, 17): // < 1.17
387-
return false
386+
case goversion.VersionAfterOrEqual(runtime.Version(), 1, 18):
387+
return runtime.GOARCH == "amd64" || runtime.GOARCH == "arm64" || runtime.GOARCH == "ppc64le" || runtime.GOARCH == "ppc64"
388388
case goversion.VersionAfterOrEqual(runtime.Version(), 1, 17):
389389
return runtime.GOARCH == "amd64" && (runtime.GOOS == "android" || runtime.GOOS == "linux" || runtime.GOOS == "darwin" || runtime.GOOS == "windows")
390-
default: // >= 1.18
391-
return runtime.GOARCH == "amd64" || runtime.GOARCH == "arm64"
390+
default:
391+
return false
392392
}
393393
}

Diff for: service/dap/server_test.go

+11
Original file line numberDiff line numberDiff line change
@@ -2387,6 +2387,11 @@ func TestGlobalScopeAndVariables(t *testing.T) {
23872387
[]onBreakpoint{{
23882388
// Stop at line 36
23892389
execute: func() {
2390+
if runtime.GOARCH == "386" && goversion.VersionAfterOrEqual(runtime.Version(), 1, 18) {
2391+
client.StepInRequest(1)
2392+
client.ExpectStepInResponse(t)
2393+
client.ExpectStoppedEvent(t)
2394+
}
23902395
client.StackTraceRequest(1, 0, 20)
23912396
stack := client.ExpectStackTraceResponse(t)
23922397
checkStackFramesExact(t, stack, "main.main", 36, 1000, 3, 3)
@@ -2454,6 +2459,12 @@ func TestRegistersScopeAndVariables(t *testing.T) {
24542459
[]onBreakpoint{{
24552460
// Stop at line 36
24562461
execute: func() {
2462+
if runtime.GOARCH == "386" && goversion.VersionAfterOrEqual(runtime.Version(), 1, 18) {
2463+
client.StepInRequest(1)
2464+
client.ExpectStepInResponse(t)
2465+
client.ExpectStoppedEvent(t)
2466+
}
2467+
24572468
client.StackTraceRequest(1, 0, 20)
24582469
stack := client.ExpectStackTraceResponse(t)
24592470
checkStackFramesExact(t, stack, "main.main", 36, 1000, 3, 3)

Diff for: vendor/golang.org/x/tools/go/internal/gcimporter/iimport.go

+20-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: vendor/golang.org/x/tools/go/internal/gcimporter/support_go118.go

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: vendor/golang.org/x/tools/internal/typeparams/common.go

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)