delve/_scripts/test_windows.ps1
Alessandro Arzilli f0a32c8e1b
Go 1.17 support branch (#2451)
* proc: support new Go 1.17 panic/defer mechanism

Go 1.17 will create wrappers for deferred calls that take arguments.
Change defer reading code so that wrappers are automatically unwrapped.

Also the deferred function is called directly by runtime.gopanic, without going through runtime.callN which means that sometimes when a panic happens the stack is either:

0. deferred function call
1. deferred call wrapper
2. runtime.gopanic

or:

0. deferred function call
1. runtime.gopanic

instead of always being:

0. deferred function call
1. runtime.callN
2. runtime.gopanic

the isPanicCall check is changed accordingly.

* test: miscellaneous minor test fixes for Go 1.17

* proc: resolve inlined calls when stepping out of runtime.breakpoint

Calls to runtime.Breakpoint are inlined in Go 1.17 when inlining is
enabled, resolve inlined calls in stepInstructionOut.

* proc: add support for debugCallV2 with regabi

This change adds support for the new debug call protocol which had to
change for the new register ABI introduced in Go 1.17.

Summary of changes:
- Abstracts over the debug call version depending on the Go version
  found in the binary.
- Uses R12 instead of RAX as the debug protocol register when the binary
  is from Go 1.17 or later.
- Creates a variable directly from the DWARF entry for function
  arguments to support passing arguments however the ABI expects.
- Computes a very conservative stack frame size for the call when
  injecting a call into a Go process whose version is >=1.17.

Co-authored-by: Michael Anthony Knyszek <mknyszek@google.com>
Co-authored-by: Alessandro Arzilli <alessandro.arzilli@gmail.com>

* TeamCity: enable tests on go-tip

* goversion: version compatibility bump

* TeamCity: fix go-tip builds on macOS/arm64

Co-authored-by: Michael Anthony Knyszek <mknyszek@google.com>
2021-07-08 08:47:53 -07:00

67 lines
2.3 KiB
PowerShell

param (
[Parameter(Mandatory = $true)][string]$version,
[Parameter(Mandatory = $true)][string]$arch
)
# Install Chocolatey
#Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
# Install MinGW.
choco install -y mingw
# Install Procdump
if (-Not(Test-Path "C:\procdump"))
{
mkdir C:\procdump
Invoke-WebRequest -UserAgent wget -Uri https://download.sysinternals.com/files/Procdump.zip -OutFile C:\procdump\procdump.zip
&7z x -oC:\procdump\ C:\procdump\procdump.zip > $null
}
$env:PATH += ";C:\procdump;C:\mingw64\bin"
function GetGo($version) {
$env:GOROOT = "C:\go\$version"
if (-Not(Test-Path $env:GOROOT))
{
$file = "$version.windows-$arch.zip"
$url = "https://dl.google.com/go/$file"
Invoke-WebRequest -UserAgent wget -Uri $url -OutFile $file
&7z x -oC:\go $file > $null
Move-Item -Path C:\go\go -Destination $env:GOROOT -force
}
}
if ($version -eq "gotip") {
#Exit 0
$latest = Invoke-WebRequest -Uri https://golang.org/VERSION?m=text -UseBasicParsing | Select-Object -ExpandProperty Content
GetGo $latest
$env:GOROOT_BOOTSTRAP = $env:GOROOT
$env:GOROOT = "C:\go\go-tip"
Write-Host "Building Go with GOROOT_BOOTSTRAP $env:GOROOT_BOOTSTRAP"
if (-Not(Test-Path $env:GOROOT)) {
git clone https://go.googlesource.com/go C:\go\go-tip
Push-Location -Path C:\go\go-tip\src
} else {
Push-Location -Path C:\go\go-tip\src
git pull
}
.\make.bat
Pop-Location
} else {
# Install Go
Write-Host "Finding latest patch version for $version"
$version = Invoke-WebRequest -Uri 'https://golang.org/dl/?mode=json&include=all' -UseBasicParsing | foreach {$_.Content} | ConvertFrom-Json | foreach {$_.version} | Select-String -Pattern "^$version($|\.|beta|rc)" | Select-Object -First 1 | foreach {$_.Line}
Write-Host "Go $version on $arch"
GetGo $version
}
$env:GOPATH = "C:\gopath"
$env:PATH += ";$env:GOROOT\bin;$env:GOPATH\bin"
Write-Host $env:PATH
Write-Host $env:GOROOT
Write-Host $env:GOPATH
go version
go env
go run _scripts/make.go test