go-deadlock version bump to fix crash with go 1.23

This commit is contained in:
Chris McDonnell 2025-02-10 01:43:35 -05:00
parent a5698b86fa
commit f117eed614
21 changed files with 201 additions and 124 deletions

View file

@ -1,5 +1,4 @@
# goid [![Build Status](https://travis-ci.org/petermattis/goid.svg?branch=master)](https://travis-ci.org/petermattis/goid)
# goid ![Build Status](https://github.com/petermattis/goid/actions/workflows/go.yml/badge.svg)
Programatically retrieve the current goroutine's ID. See [the CI
configuration](.travis.yml) for supported Go versions. In addition,
gccgo 7.2.1 (Go 1.8.3) is supported.
configuration](.github/workflows/go.yml) for supported Go versions.

View file

@ -13,6 +13,7 @@
// permissions and limitations under the License. See the AUTHORS file
// for names of contributors.
//go:build gccgo
// +build gccgo
package goid

View file

@ -13,6 +13,7 @@
// permissions and limitations under the License. See the AUTHORS file
// for names of contributors.
//go:build !go1.4
// +build !go1.4
package goid

View file

@ -13,6 +13,7 @@
// permissions and limitations under the License. See the AUTHORS file
// for names of contributors.
//go:build go1.4 && !go1.5
// +build go1.4,!go1.5
package goid

View file

@ -13,13 +13,15 @@
// permissions and limitations under the License. See the AUTHORS file
// for names of contributors.
// +build arm
// +build gc,go1.5
//go:build (386 || amd64 || amd64p32 || arm || arm64 || s390x) && gc && go1.5
// +build 386 amd64 amd64p32 arm arm64 s390x
// +build gc
// +build go1.5
package goid
// Backdoor access to runtime·getg().
func getg() *g // in goid_go1.5plus.s
// Defined in goid_go1.5.s.
func getg() *g
func Get() int64 {
return getg().goid

View file

@ -1,4 +1,4 @@
// Copyright 2016 Peter Mattis.
// Copyright 2021 Peter Mattis.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@ -14,14 +14,31 @@
// for names of contributors.
// Assembly to mimic runtime.getg.
// This should work on arm64 as well, but it hasn't been tested.
// +build arm
// +build gc,go1.5
//go:build (386 || amd64 || amd64p32 || arm || arm64 || s390x) && gc && go1.5
// +build 386 amd64 amd64p32 arm arm64 s390x
// +build gc
// +build go1.5
#include "textflag.h"
// func getg() *g
TEXT ·getg(SB),NOSPLIT,$0-8
#ifdef GOARCH_386
MOVL (TLS), AX
MOVL AX, ret+0(FP)
#endif
#ifdef GOARCH_amd64
MOVQ (TLS), AX
MOVQ AX, ret+0(FP)
#endif
#ifdef GOARCH_arm
MOVW g, ret+0(FP)
#endif
#ifdef GOARCH_arm64
MOVD g, ret+0(FP)
#endif
#ifdef GOARCH_s390x
MOVD g, ret+0(FP)
#endif
RET

View file

@ -1,21 +0,0 @@
// Copyright 2016 Peter Mattis.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
// implied. See the License for the specific language governing
// permissions and limitations under the License. See the AUTHORS file
// for names of contributors.
// +build amd64 amd64p32
// +build gc,go1.5
package goid
func Get() int64

View file

@ -1,29 +0,0 @@
// Copyright 2016 Peter Mattis.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
// implied. See the License for the specific language governing
// permissions and limitations under the License. See the AUTHORS file
// for names of contributors.
// Assembly to mimic runtime.getg.
// +build amd64 amd64p32
// +build gc,go1.5
#include "go_asm.h"
#include "textflag.h"
// func Get() int64
TEXT ·Get(SB),NOSPLIT,$0-8
MOVQ (TLS), R14
MOVQ g_goid(R14), R13
MOVQ R13, ret+0(FP)
RET

View file

@ -13,7 +13,8 @@
// permissions and limitations under the License. See the AUTHORS file
// for names of contributors.
// +build go1.4,!go1.5,!amd64,!amd64p32,!arm,!386 go1.5,!go1.6,!amd64,!amd64p32,!arm go1.6,!amd64,!amd64p32,!arm go1.9,!amd64,!amd64p32,!arm
//go:build (go1.4 && !go1.5 && !amd64 && !amd64p32 && !arm && !386) || (go1.5 && !386 && !amd64 && !amd64p32 && !arm && !arm64 && !s390x)
// +build go1.4,!go1.5,!amd64,!amd64p32,!arm,!386 go1.5,!386,!amd64,!amd64p32,!arm,!arm64,!s390x
package goid

View file

@ -1,8 +1,9 @@
//go:build gccgo && go1.8
// +build gccgo,go1.8
package goid
// https://github.com/gcc-mirror/gcc/blob/gcc-7-branch/libgo/go/runtime/runtime2.go#L329-L422
// https://github.com/gcc-mirror/gcc/blob/releases/gcc-7/libgo/go/runtime/runtime2.go#L329-L354
type g struct {
_panic uintptr

38
vendor/github.com/petermattis/goid/runtime_go1.23.go generated vendored Normal file
View file

@ -0,0 +1,38 @@
//go:build gc && go1.23
// +build gc,go1.23
package goid
type stack struct {
lo uintptr
hi uintptr
}
type gobuf struct {
sp uintptr
pc uintptr
g uintptr
ctxt uintptr
ret uintptr
lr uintptr
bp uintptr
}
type g struct {
stack stack
stackguard0 uintptr
stackguard1 uintptr
_panic uintptr
_defer uintptr
m uintptr
sched gobuf
syscallsp uintptr
syscallpc uintptr
syscallbp uintptr
stktopsp uintptr
param uintptr
atomicstatus uint32
stackLock uint32
goid int64 // Here it is!
}

View file

@ -13,6 +13,7 @@
// permissions and limitations under the License. See the AUTHORS file
// for names of contributors.
//go:build go1.5 && !go1.6
// +build go1.5,!go1.6
package goid

View file

@ -1,3 +1,4 @@
//go:build gc && go1.6 && !go1.9
// +build gc,go1.6,!go1.9
package goid

View file

@ -1,4 +1,5 @@
// +build gc,go1.9
//go:build gc && go1.9 && !go1.23
// +build gc,go1.9,!go1.23
package goid