Repository: go-delve/delve
Pull request #2334 (2021-01-31 12:17:45)

test: increase num of frames examined by TestClientServer_FullStacktrace
When the runtime is allocating memory the stack trace needed to reach
user code might be greater than 10 frames.



Patch:
diff --git a/.teamcity/settings.kts b/.teamcity/settings.kts
index ec8b3cb5..8ea5cf63 100644
--- a/.teamcity/settings.kts
+++ b/.teamcity/settings.kts
@@ -34,15 +34,13 @@ To debug in IntelliJ Idea, open the 'Maven Projects' tool window (View
 version = "2020.2"
 
 val targets = arrayOf(
-	"linux/amd64/1.13",
 	"linux/amd64/1.14",
         "linux/amd64/1.15",
         "linux/amd64/1.16",
         "linux/amd64/tip",
 
-        "linux/386/1.15",
+        "linux/386/1.16",
 
-        "windows/amd64/1.15",
         "windows/amd64/1.16",
         "windows/amd64/tip"
 )
diff --git a/Documentation/EditorIntegration.md b/Documentation/EditorIntegration.md
index 3bfc0308..402f31df 100644
--- a/Documentation/EditorIntegration.md
+++ b/Documentation/EditorIntegration.md
@@ -24,7 +24,7 @@ The following editor plugins for delve are available:
 * [vim-godebug](https://github.com/jodosha/vim-godebug) (only Neovim)
 
 **VisualStudio Code**
-* [Go for Visual Studio Code](https://github.com/Microsoft/vscode-go)
+* [Go for Visual Studio Code](https://github.com/golang/vscode-go)
 
 **Sublime**
 * [Go Debugger for Sublime](https://github.com/dishmaev/GoDebug)
diff --git a/Documentation/api/json-rpc/README.md b/Documentation/api/json-rpc/README.md
index c690c480..4c1fb2ea 100644
--- a/Documentation/api/json-rpc/README.md
+++ b/Documentation/api/json-rpc/README.md
@@ -1,11 +1,9 @@
 # JSON-RPC interface
 
-Delve exposes a [JSON-RPC](http://json-rpc.org/) API interface. 
+Delve exposes a [JSON-RPC](https://www.jsonrpc.org/specification_v1) API interface. 
 
 Note that this JSON-RPC interface is served over a streaming socket, *not* over HTTP.
 
-Here is an (incomplete) [list of language implementations](http://json-rpc.org/wiki/implementations).
-
 # API versions
 
 Delve currently supports two versions of its API. By default a headless instance of `dlv` will serve APIv1 for backward compatibility with old clients, however new clients should use APIv2 as new features will only be made available through version 2. To select APIv2 use `--api-version=2` command line argument. 
diff --git a/Documentation/installation/README.md b/Documentation/installation/README.md
index 8daa6434..44f52b43 100644
--- a/Documentation/installation/README.md
+++ b/Documentation/installation/README.md
@@ -1,10 +1,50 @@
 # Installation
 
-Directions for installing Delve on all supported platforms is provided here.
+Clone the git repository and build:
 
-Please note you *must* have **Go 1.10** or higher installed in order to compile Delve.
+```
+$ git clone https://github.com/go-delve/delve
+$ cd delve
+$ go install github.com/go-delve/delve/cmd/dlv
+```
 
-- [OSX](osx/install.md)
-- [Linux](linux/install.md)
-- [Windows](windows/install.md)
-- [FreeBSD](freebsd/install.md)
\ No newline at end of file
+On Go version 1.16 or later, this command will also work:
+
+```
+$ go install github.com/go-delve/delve/cmd/dlv@latest
+```
+
+See `go help install` for details on where the `dlv` executable is saved. 
+
+If during the install step you receive an error similar to this:
+
+```
+found packages native (proc.go) and your_operating_system_and_architecture_combination_is_not_supported_by_delve (support_sentinel.go) in /home/pi/go/src/github.com/go-delve/delve/pkg/proc/native
+```
+
+It means that your combination of operating system and CPU architecture is not supported, check the output of `go version`.
+
+## macOS considerations
+
+On macOS make sure you also install the command line developer tools:
+
+```
+$ xcode-select --install
+```
+
+If you didn't enable Developer Mode using Xcode you will be asked to authorize the debugger every time you use it. To enable Developer Mode and only have to authorize once per session use:
+
+```
+sudo /usr/sbin/DevToolsSecurity -enable
+```
+
+## Compiling macOS native backend
+
+You do not need the macOS native backend and it [has known problems](https://github.com/go-delve/delve/issues/1112). If you still want to build it:
+
+1. Run `xcode-select --install`
+2. On macOS 10.14 manually install the legacy include headers by running `/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg`
+3. Clone the repo into `$GOPATH/src/github.com/go-delve/delve`
+4. Run `make install` in that directory (on some versions of macOS this requires being root, the first time you run it, to install a new certificate)
+
+The makefile will take care of creating and installing a self-signed certificate automatically.
diff --git a/Documentation/installation/freebsd/install.md b/Documentation/installation/freebsd/install.md
index 46c6e4be..ddb60cc4 100644
--- a/Documentation/installation/freebsd/install.md
+++ b/Documentation/installation/freebsd/install.md
@@ -1,20 +1,1 @@
-# Installation on FreeBSD
-
-Please use the following steps to build and install Delve on FreeBSD.
-
-There are two ways to install on FreeBSD. First is the standard `go get` method:
-
-```
-go get github.com/go-delve/delve/cmd/dlv
-```
-
-Note: if you are using Go in modules mode you must execute this command outside of a module directory or Delve will be added to your project as a dependency.
-
-Alternatively make sure $GOPATH is set (e.g. as `~/.go`) and:
-
-```
-$ git clone https://github.com/go-delve/delve.git $GOPATH/src/github.com/go-delve/delve
-$ cd $GOPATH/src/github.com/go-delve/delve
-$ gmake install
-```
-
+See [general install instructions](../README.md).
\ No newline at end of file
diff --git a/Documentation/installation/linux/install.md b/Documentation/installation/linux/install.md
index ffa27325..0efc16ed 100644
--- a/Documentation/installation/linux/install.md
+++ b/Documentation/installation/linux/install.md
@@ -1,19 +1,1 @@
-# Installation on Linux
-
-Please use the following steps to build and install Delve on Linux.
-
-There are two ways to install on Linux. First is the standard `go get` method:
-
-```
-go get github.com/go-delve/delve/cmd/dlv
-```
-
-Note: if you are using Go in modules mode you must execute this command outside of a module directory or Delve will be added to your project as a dependency.
-
-Alternatively make sure $GOPATH is set (e.g. as `~/.go`) and:
-
-```
-$ git clone https://github.com/go-delve/delve.git $GOPATH/src/github.com/go-delve/delve
-$ cd $GOPATH/src/github.com/go-delve/delve
-$ make install
-```
+See [general install instructions](../README.md).
diff --git a/Documentation/installation/osx/install.md b/Documentation/installation/osx/install.md
index f4f3f88e..0efc16ed 100644
--- a/Documentation/installation/osx/install.md
+++ b/Documentation/installation/osx/install.md
@@ -1,34 +1,1 @@
-# Installation on macOS
-
-Ensure you have a proper compilation toolchain.
-
-This should be as simple as:
-
-`xcode-select --install`
-
-Now you can install delve using `go get`:
-
-```
-$ go get github.com/go-delve/delve/cmd/dlv
-```
-
-Note: if you are using Go in modules mode you must execute this command outside of a module directory or Delve will be added to your project as a dependency.
-
-With this method you will not be able to use delve's native backend, *but you don't need it anyway*: the native backend on macOS [has known problems](https://github.com/go-delve/delve/issues/1112) on recent issues of the OS and is not currently maintained.
-
-If you didn't enable Developer Mode using Xcode you will be asked to authorize the debugger every time you use it. To enable Developer Mode and only have to authorize once per session use:
-
-```
-sudo /usr/sbin/DevToolsSecurity -enable
-```
-
-## Compiling the native backend
-
-Only do this if you have a valid reason to use the native backend.
-
-1. Run `xcode-select --install`
-2. On macOS 10.14 manually install the legacy include headers by running `/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg`
-3. Clone the repo into `$GOPATH/src/github.com/go-delve/delve`
-4. Run `make install` in that directory (on some versions of macOS this requires being root, the first time you run it, to install a new certificate)
-
-The makefile will take care of creating and installing a self-signed certificate automatically.
+See [general install instructions](../README.md).
diff --git a/Documentation/installation/windows/install.md b/Documentation/installation/windows/install.md
index 30baabce..ddb60cc4 100644
--- a/Documentation/installation/windows/install.md
+++ b/Documentation/installation/windows/install.md
@@ -1,11 +1,1 @@
-# Installation on Windows
-
-Please use the standard `go get` command to build and install Delve on Windows.
-
-```
-go get github.com/go-delve/delve/cmd/dlv
-```
-
-Note: if you are using Go in modules mode you must execute this command outside of a module directory or Delve will be added to your project as a dependency.
-
-Also, if not already set, you have to add the %GOPATH%\bin directory to your PATH variable.
+See [general install instructions](../README.md).
\ No newline at end of file
diff --git a/pkg/gobuild/gobuild.go b/pkg/gobuild/gobuild.go
index fde64f80..b441b436 100644
--- a/pkg/gobuild/gobuild.go
+++ b/pkg/gobuild/gobuild.go
@@ -6,6 +6,8 @@ import (
 	"fmt"
 	"os"
 	"os/exec"
+	"runtime"
+	"time"
 
 	"github.com/go-delve/delve/pkg/config"
 	"github.com/go-delve/delve/pkg/goversion"
@@ -15,6 +17,12 @@ import (
 // This can be used to remove the temporary binary generated for the session.
 func Remove(path string) {
 	err := os.Remove(path)
+	// Open files can be removed on Unix, but not on Windows, where there also appears
+	// to be a delay in releasing the binary when the process exits. So we try again.
+	if err != nil && runtime.GOOS == "windows" {
+		time.Sleep(10 * time.Microsecond)
+		err = os.Remove(path)
+	}
 	if err != nil {
 		fmt.Fprintf(os.Stderr, "could not remove %v: %v\n", path, err)
 	}
diff --git a/pkg/goversion/compat.go b/pkg/goversion/compat.go
index 270effd2..f800b38c 100644
--- a/pkg/goversion/compat.go
+++ b/pkg/goversion/compat.go
@@ -6,7 +6,7 @@ import (
 
 var (
 	MinSupportedVersionOfGoMajor = 1
-	MinSupportedVersionOfGoMinor = 13
+	MinSupportedVersionOfGoMinor = 14
 	MaxSupportedVersionOfGoMajor = 1
 	MaxSupportedVersionOfGoMinor = 16
 	goTooOldErr                  = fmt.Errorf("Version of Go is too old for this version of Delve (minimum supported version %d.%d, suppress this error with --check-go-version=false)", MinSupportedVersionOfGoMajor, MinSupportedVersionOfGoMinor)
diff --git a/pkg/locspec/doc.go b/pkg/locspec/doc.go
index 5278ab15..1f75ac03 100644
--- a/pkg/locspec/doc.go
+++ b/pkg/locspec/doc.go
@@ -3,13 +3,13 @@
 //
 // Location spec examples:
 //
-// locStr ::= <filename>:<line> | <function>[:<line>] | /<regex>/ | (+|-)<offset> | <line> | *<address>
-// * <filename> can be the full path of a file or just a suffix
-// * <function> ::= <package>.<receiver type>.<name> | <package>.(*<receiver type>).<name> | <receiver type>.<name> | <package>.<name> | (*<receiver type>).<name> | <name>
-// * <function> must be unambiguous
-// * /<regex>/ will return a location for each function matched by regex
-// * +<offset> returns a location for the line that is <offset> lines after the current line
-// * -<offset> returns a location for the line that is <offset> lines before the current line
-// * <line> returns a location for a line in the current file
-// * *<address> returns the location corresponding to the specified address
+//  locStr ::= <filename>:<line> | <function>[:<line>] | /<regex>/ | (+|-)<offset> | <line> | *<address>
+//  * <filename> can be the full path of a file or just a suffix
+//  * <function> ::= <package>.<receiver type>.<name> | <package>.(*<receiver type>).<name> | <receiver type>.<name> | <package>.<name> | (*<receiver type>).<name> | <name>
+//    <function> must be unambiguous
+//  * /<regex>/ will return a location for each function matched by regex
+//  * +<offset> returns a location for the line that is <offset> lines after the current line
+//  * -<offset> returns a location for the line that is <offset> lines before the current line
+//  * <line> returns a location for a line in the current file
+//  * *<address> returns the location corresponding to the specified address
 package locspec
diff --git a/pkg/proc/bininfo.go b/pkg/proc/bininfo.go
index c58ddfeb..594b12a1 100644
--- a/pkg/proc/bininfo.go
+++ b/pkg/proc/bininfo.go
@@ -123,8 +123,8 @@ var (
 		elf.EM_386:     true,
 	}
 
-	supportedWindowsArch = map[PEMachine]bool{
-		IMAGE_FILE_MACHINE_AMD64: true,
+	supportedWindowsArch = map[_PEMachine]bool{
+		_IMAGE_FILE_MACHINE_AMD64: true,
 	}
 
 	supportedDarwinArch = map[macho.Cpu]bool{
@@ -227,19 +227,19 @@ func FirstPCAfterPrologue(p Process, fn *Function, sameline bool) (uint64, error
 	return pc, nil
 }
 
-// CpuArch is a stringer interface representing CPU architectures.
-type CpuArch interface {
+// cpuArch is a stringer interface representing CPU architectures.
+type cpuArch interface {
 	String() string
 }
 
 // ErrUnsupportedArch is returned when attempting to debug a binary compiled for an unsupported architecture.
 type ErrUnsupportedArch struct {
 	os      string
-	cpuArch CpuArch
+	cpuArch cpuArch
 }
 
 func (e *ErrUnsupportedArch) Error() string {
-	var supportArchs []CpuArch
+	var supportArchs []cpuArch
 	switch e.os {
 	case "linux":
 		for linuxArch, _ := range supportedLinuxArch {
@@ -1185,8 +1185,8 @@ func loadBinaryInfoElf(bi *BinaryInfo, image *Image, path string, addr uint64, w
 	return nil
 }
 
-//  STT_FUNC is a code object, see /usr/include/elf.h for a full definition.
-const STT_FUNC = 2
+//  _STT_FUNC is a code object, see /usr/include/elf.h for a full definition.
+const _STT_FUNC = 2
 
 func (bi *BinaryInfo) loadSymbolName(image *Image, file *elf.File, wg *sync.WaitGroup) {
 	defer wg.Done()
@@ -1196,7 +1196,7 @@ func (bi *BinaryInfo) loadSymbolName(image *Image, file *elf.File, wg *sync.Wait
 	symSecs, _ := file.Symbols()
 	if symSecs != nil {
 		for _, symSec := range symSecs {
-			if symSec.Info == STT_FUNC { // TODO(chainhelen), need to parse others types.
+			if symSec.Info == _STT_FUNC { // TODO(chainhelen), need to parse others types.
 				s := symSec
 				bi.SymNames[symSec.Value+image.StaticBase] = &s
 			}
@@ -1274,7 +1274,7 @@ func loadBinaryInfoPE(bi *BinaryInfo, image *Image, path string, entryPoint uint
 		return err
 	}
 	image.closer = closer
-	cpuArch := PEMachine(peFile.Machine)
+	cpuArch := _PEMachine(peFile.Machine)
 	if !supportedWindowsArch[cpuArch] {
 		return &ErrUnsupportedArch{os: "windows", cpuArch: cpuArch}
 	}
diff --git a/pkg/proc/disasm.go b/pkg/proc/disasm.go
index 8d5d50b9..5566bb82 100644
--- a/pkg/proc/disasm.go
+++ b/pkg/proc/disasm.go
@@ -56,7 +56,7 @@ type AssemblyFlavour int
 
 const (
 	// GNUFlavour will display GNU assembly syntax.
-	GNUFlavour = AssemblyFlavour(iota)
+	GNUFlavour AssemblyFlavour = iota
 	// IntelFlavour will display Intel assembly syntax.
 	IntelFlavour
 	// GoFlavour will display Go assembly syntax.
diff --git a/pkg/proc/pe.go b/pkg/proc/pe.go
index 21a9a27a..44d0eaef 100644
--- a/pkg/proc/pe.go
+++ b/pkg/proc/pe.go
@@ -5,60 +5,60 @@ import (
 )
 
 const (
-	IMAGE_FILE_MACHINE_UNKNOWN   = 0x0
-	IMAGE_FILE_MACHINE_AM33      = 0x1d3
-	IMAGE_FILE_MACHINE_AMD64     = 0x8664
-	IMAGE_FILE_MACHINE_ARM       = 0x1c0
-	IMAGE_FILE_MACHINE_ARMNT     = 0x1c4
-	IMAGE_FILE_MACHINE_ARM64     = 0xaa64
-	IMAGE_FILE_MACHINE_EBC       = 0xebc
-	IMAGE_FILE_MACHINE_I386      = 0x14c
-	IMAGE_FILE_MACHINE_IA64      = 0x200
-	IMAGE_FILE_MACHINE_M32R      = 0x9041
-	IMAGE_FILE_MACHINE_MIPS16    = 0x266
-	IMAGE_FILE_MACHINE_MIPSFPU   = 0x366
-	IMAGE_FILE_MACHINE_MIPSFPU16 = 0x466
-	IMAGE_FILE_MACHINE_POWERPC   = 0x1f0
-	IMAGE_FILE_MACHINE_POWERPCFP = 0x1f1
-	IMAGE_FILE_MACHINE_R4000     = 0x166
-	IMAGE_FILE_MACHINE_SH3       = 0x1a2
-	IMAGE_FILE_MACHINE_SH3DSP    = 0x1a3
-	IMAGE_FILE_MACHINE_SH4       = 0x1a6
-	IMAGE_FILE_MACHINE_SH5       = 0x1a8
-	IMAGE_FILE_MACHINE_THUMB     = 0x1c2
-	IMAGE_FILE_MACHINE_WCEMIPSV2 = 0x169
+	_IMAGE_FILE_MACHINE_UNKNOWN   = 0x0
+	_IMAGE_FILE_MACHINE_AM33      = 0x1d3
+	_IMAGE_FILE_MACHINE_AMD64     = 0x8664
+	_IMAGE_FILE_MACHINE_ARM       = 0x1c0
+	_IMAGE_FILE_MACHINE_ARMNT     = 0x1c4
+	_IMAGE_FILE_MACHINE_ARM64     = 0xaa64
+	_IMAGE_FILE_MACHINE_EBC       = 0xebc
+	_IMAGE_FILE_MACHINE_I386      = 0x14c
+	_IMAGE_FILE_MACHINE_IA64      = 0x200
+	_IMAGE_FILE_MACHINE_M32R      = 0x9041
+	_IMAGE_FILE_MACHINE_MIPS16    = 0x266
+	_IMAGE_FILE_MACHINE_MIPSFPU   = 0x366
+	_IMAGE_FILE_MACHINE_MIPSFPU16 = 0x466
+	_IMAGE_FILE_MACHINE_POWERPC   = 0x1f0
+	_IMAGE_FILE_MACHINE_POWERPCFP = 0x1f1
+	_IMAGE_FILE_MACHINE_R4000     = 0x166
+	_IMAGE_FILE_MACHINE_SH3       = 0x1a2
+	_IMAGE_FILE_MACHINE_SH3DSP    = 0x1a3
+	_IMAGE_FILE_MACHINE_SH4       = 0x1a6
+	_IMAGE_FILE_MACHINE_SH5       = 0x1a8
+	_IMAGE_FILE_MACHINE_THUMB     = 0x1c2
+	_IMAGE_FILE_MACHINE_WCEMIPSV2 = 0x169
 )
 
-type PEMachine uint16
+type _PEMachine uint16
 
 // PEMachineString map pe machine to name, See $GOROOT/src/debug/pe/pe.go for detail
-var PEMachineString = map[uint16]string{
-	IMAGE_FILE_MACHINE_UNKNOWN:   "unknown",
-	IMAGE_FILE_MACHINE_AM33:      "am33",
-	IMAGE_FILE_MACHINE_AMD64:     "amd64",
-	IMAGE_FILE_MACHINE_ARM:       "arm",
-	IMAGE_FILE_MACHINE_ARMNT:     "armnt",
-	IMAGE_FILE_MACHINE_ARM64:     "arm64",
-	IMAGE_FILE_MACHINE_EBC:       "ebc",
-	IMAGE_FILE_MACHINE_I386:      "i386",
-	IMAGE_FILE_MACHINE_IA64:      "ia64",
-	IMAGE_FILE_MACHINE_M32R:      "m32r",
-	IMAGE_FILE_MACHINE_MIPS16:    "mips16",
-	IMAGE_FILE_MACHINE_MIPSFPU:   "mipsfpu",
-	IMAGE_FILE_MACHINE_MIPSFPU16: "mipsfpu16",
-	IMAGE_FILE_MACHINE_POWERPC:   "powerpc",
-	IMAGE_FILE_MACHINE_POWERPCFP: "powerpcfp",
-	IMAGE_FILE_MACHINE_R4000:     "r4000",
-	IMAGE_FILE_MACHINE_SH3:       "sh3",
-	IMAGE_FILE_MACHINE_SH3DSP:    "sh3dsp",
-	IMAGE_FILE_MACHINE_SH4:       "sh4",
-	IMAGE_FILE_MACHINE_SH5:       "sh5",
-	IMAGE_FILE_MACHINE_THUMB:     "thumb",
-	IMAGE_FILE_MACHINE_WCEMIPSV2: "wcemipsv2",
+var _PEMachineString = map[_PEMachine]string{
+	_IMAGE_FILE_MACHINE_UNKNOWN:   "unknown",
+	_IMAGE_FILE_MACHINE_AM33:      "am33",
+	_IMAGE_FILE_MACHINE_AMD64:     "amd64",
+	_IMAGE_FILE_MACHINE_ARM:       "arm",
+	_IMAGE_FILE_MACHINE_ARMNT:     "armnt",
+	_IMAGE_FILE_MACHINE_ARM64:     "arm64",
+	_IMAGE_FILE_MACHINE_EBC:       "ebc",
+	_IMAGE_FILE_MACHINE_I386:      "i386",
+	_IMAGE_FILE_MACHINE_IA64:      "ia64",
+	_IMAGE_FILE_MACHINE_M32R:      "m32r",
+	_IMAGE_FILE_MACHINE_MIPS16:    "mips16",
+	_IMAGE_FILE_MACHINE_MIPSFPU:   "mipsfpu",
+	_IMAGE_FILE_MACHINE_MIPSFPU16: "mipsfpu16",
+	_IMAGE_FILE_MACHINE_POWERPC:   "powerpc",
+	_IMAGE_FILE_MACHINE_POWERPCFP: "powerpcfp",
+	_IMAGE_FILE_MACHINE_R4000:     "r4000",
+	_IMAGE_FILE_MACHINE_SH3:       "sh3",
+	_IMAGE_FILE_MACHINE_SH3DSP:    "sh3dsp",
+	_IMAGE_FILE_MACHINE_SH4:       "sh4",
+	_IMAGE_FILE_MACHINE_SH5:       "sh5",
+	_IMAGE_FILE_MACHINE_THUMB:     "thumb",
+	_IMAGE_FILE_MACHINE_WCEMIPSV2: "wcemipsv2",
 }
 
-func (m PEMachine) String() string {
-	str, ok := PEMachineString[uint16(m)]
+func (m _PEMachine) String() string {
+	str, ok := _PEMachineString[m]
 	if ok {
 		return str
 	}
diff --git a/service/dap/server.go b/service/dap/server.go
index 7206d133..7069a87f 100644
--- a/service/dap/server.go
+++ b/service/dap/server.go
@@ -599,7 +599,9 @@ func (s *Server) onSetBreakpointsRequest(request *dap.SetBreakpointsRequest) {
 			response.Body.Breakpoints[i].Line = want.Line
 			response.Body.Breakpoints[i].Message = err.Error()
 		} else {
+			response.Body.Breakpoints[i].Id = got.ID
 			response.Body.Breakpoints[i].Line = got.Line
+			response.Body.Breakpoints[i].Source = dap.Source{Name: request.Arguments.Source.Name, Path: request.Arguments.Source.Path}
 		}
 	}
 	s.send(response)
@@ -1410,7 +1412,7 @@ func newEvent(event string) *dap.Event {
 }
 
 const BetterBadAccessError = `invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation]
-Unable to propogate EXC_BAD_ACCESS signal to target process and panic (see https://github.com/go-delve/delve/issues/852)`
+Unable to propagate EXC_BAD_ACCESS signal to target process and panic (see https://github.com/go-delve/delve/issues/852)`
 
 func (s *Server) resetHandlesForStop() {
 	s.stackFrameHandles.reset()


Test patch:
diff --git a/_fixtures/testvariables2.go b/_fixtures/testvariables2.go
index 7efb06aa..4fcee1cf 100644
--- a/_fixtures/testvariables2.go
+++ b/_fixtures/testvariables2.go
@@ -144,6 +144,7 @@ func main() {
 	f1 := 3.0
 	i3 := 3
 	p1 := &i1
+	pp1 := &p1
 	s1 := []string{"one", "two", "three", "four", "five"}
 	s3 := make([]int, 0, 6)
 	a0 := [0]int{}
@@ -357,5 +358,5 @@ func main() {
 	}
 
 	runtime.Breakpoint()
-	fmt.Println(i1, i2, i3, p1, amb1, s1, s3, a0, a1, p2, p3, s2, as1, str1, f1, fn1, fn2, nilslice, nilptr, ch1, chnil, m1, mnil, m2, m3, m4, upnil, up1, i4, i5, i6, err1, err2, errnil, iface1, iface2, ifacenil, arr1, parr, cpx1, const1, iface3, iface4, recursive1, recursive1.x, iface5, iface2fn1, iface2fn2, bencharr, benchparr, mapinf, mainMenu, b, b2, sd, anonstruct1, anonstruct2, anoniface1, anonfunc, mapanonstruct1, ifacearr, efacearr, ni8, ni16, ni32, ni64, pinf, ninf, nan, zsvmap, zsslice, zsvar, tm, errtypednil, emptyslice, emptymap, byteslice, runeslice, bytearray, runearray, longstr, nilstruct, as2, as2.NonPointerRecieverMethod, s4, iface2map, issue1578, ll, unread, w2, w3, w4, w5)
+	fmt.Println(i1, i2, i3, p1, pp1, amb1, s1, s3, a0, a1, p2, p3, s2, as1, str1, f1, fn1, fn2, nilslice, nilptr, ch1, chnil, m1, mnil, m2, m3, m4, upnil, up1, i4, i5, i6, err1, err2, errnil, iface1, iface2, ifacenil, arr1, parr, cpx1, const1, iface3, iface4, recursive1, recursive1.x, iface5, iface2fn1, iface2fn2, bencharr, benchparr, mapinf, mainMenu, b, b2, sd, anonstruct1, anonstruct2, anoniface1, anonfunc, mapanonstruct1, ifacearr, efacearr, ni8, ni16, ni32, ni64, pinf, ninf, nan, zsvmap, zsslice, zsvar, tm, errtypednil, emptyslice, emptymap, byteslice, runeslice, bytearray, runearray, longstr, nilstruct, as2, as2.NonPointerRecieverMethod, s4, iface2map, issue1578, ll, unread, w2, w3, w4, w5)
 }
diff --git a/cmd/dlv/dlv_test.go b/cmd/dlv/dlv_test.go
index 8a9874a6..3d52a509 100644
--- a/cmd/dlv/dlv_test.go
+++ b/cmd/dlv/dlv_test.go
@@ -170,13 +170,11 @@ func testOutput(t *testing.T, dlvbin, output string, delveCmds []string) (stdout
 
 	_, err = os.Stat(debugbin)
 	if err == nil {
-		if strings.ToLower(os.Getenv("TRAVIS")) == "true" && runtime.GOOS == "windows" {
-			// Sometimes delve on Travis on Windows can't remove the built binary before
-			// exiting and gets an "Access is denied" error when trying.
-			// Just ignore it.
-			// See: https://travis-ci.com/go-delve/delve/jobs/296325131
-			return
-		}
+		// Sometimes delve on Windows can't remove the built binary before
+		// exiting and gets an "Access is denied" error when trying.
+		// This used to make this test flaky. See: https://travis-ci.com/go-delve/delve/jobs/296325131)
+		// But we have now added a delay to gobuild.Remove. If this flakes again,
+		// adjust it. Leaving temporary files behind can be annoying to users.
 		t.Errorf("running %q: file %v was not deleted\nstdout is %q, stderr is %q", delveCmds, debugbin, stdout, stderr)
 		return
 	}
diff --git a/service/dap/server_test.go b/service/dap/server_test.go
index aecf5520..92c8b05a 100644
--- a/service/dap/server_test.go
+++ b/service/dap/server_test.go
@@ -419,8 +419,8 @@ func TestPreSetBreakpoint(t *testing.T) {
 			t.Errorf("got %#v, want len(Breakpoints)=1", sResp)
 		}
 		bkpt0 := sResp.Body.Breakpoints[0]
-		if !bkpt0.Verified || bkpt0.Line != 8 {
-			t.Errorf("got breakpoints[0] = %#v, want Verified=true, Line=8", bkpt0)
+		if !bkpt0.Verified || bkpt0.Line != 8 || bkpt0.Id != 1 || bkpt0.Source.Name != filepath.Base(fixture.Source) || bkpt0.Source.Path != fixture.Source {
+			t.Errorf("got breakpoints[0] = %#v, want Verified=true, Line=8, Id=1, Path=%q", bkpt0, fixture.Source)
 		}
 
 		client.SetExceptionBreakpointsRequest()
@@ -1139,6 +1139,20 @@ func TestScopesAndVariablesRequests2(t *testing.T) {
 						expectVarRegex(t, err1, 0, "data", `err1\.\(data\)`, `<\*main\.astruct>\(0x[0-9a-f]+\)`, hasChildren)
 						validateEvaluateName(t, client, err1, 0)
 					}
+					ref = expectVarRegex(t, locals, -1, "ptrinf", "ptrinf", `<\*interface {}>\(0x[0-9a-f]+\)`, hasChildren)
+					if ref > 0 {
+						client.VariablesRequest(ref)
+						ptrinf_val := client.ExpectVariablesResponse(t)
+						expectChildren(t, ptrinf_val, "*ptrinf", 1)
+						ref = expectVarExact(t, ptrinf_val, 0, "", "(*ptrinf)", "<interface {}(**interface {})>", hasChildren)
+						if ref > 0 {
+							client.VariablesRequest(ref)
+							ptrinf_val_data := client.ExpectVariablesResponse(t)
+							expectChildren(t, ptrinf_val_data, "(*ptrinf).data", 1)
+							expectVarRegex(t, ptrinf_val_data, 0, "data", `\(\*ptrinf\)\.\(data\)`, `<\*\*interface {}>\(0x[0-9a-f]+\)`, hasChildren)
+							validateEvaluateName(t, client, ptrinf_val_data, 0)
+						}
+					}
 					// reflect.Kind == Map
 					expectVarExact(t, locals, -1, "mnil", "mnil", "nil <map[string]main.astruct>", noChildren)
 					// key - scalar, value - compound
@@ -1217,7 +1231,21 @@ func TestScopesAndVariablesRequests2(t *testing.T) {
 						}
 					}
 					expectVarExact(t, locals, -1, "emptymap", "emptymap", "<map[string]string> (length: 0)", noChildren)
-					// reflect.Kind == Ptr - see testvariables
+					// reflect.Kind == Ptr
+					ref = expectVarRegex(t, locals, -1, "pp1", "pp1", `<\*\*int>\(0x[0-9a-f]+\)`, hasChildren)
+					if ref > 0 {
+						client.VariablesRequest(ref)
+						pp1val := client.ExpectVariablesResponse(t)
+						expectChildren(t, pp1val, "*pp1", 1)
+						ref = expectVarRegex(t, pp1val, 0, "", `\(\*pp1\)`, `<\*int>\(0x[0-9a-f]+\)`, hasChildren)
+						if ref > 0 {
+							client.VariablesRequest(ref)
+							pp1valval := client.ExpectVariablesResponse(t)
+							expectChildren(t, pp1valval, "*(*pp1)", 1)
+							expectVarExact(t, pp1valval, 0, "", "(*(*pp1))", "1", noChildren)
+							validateEvaluateName(t, client, pp1valval, 0)
+						}
+					}
 					// reflect.Kind == Slice
 					ref = expectVarExact(t, locals, -1, "zsslice", "zsslice", "<[]struct {}> (length: 3, cap: 3)", hasChildren)
 					if ref > 0 {
@@ -1255,6 +1283,63 @@ func TestScopesAndVariablesRequests2(t *testing.T) {
 						m1 := client.ExpectVariablesResponse(t)
 						expectChildren(t, m1, "m1", 64) // TODO(polina): should be 66.
 					}
+
+					ref = expectVarExact(t, locals, -1, "c1", "c1", "<main.cstruct>", hasChildren)
+					if ref > 0 {
+						client.VariablesRequest(ref)
+						c1 := client.ExpectVariablesResponse(t)
+						expectChildren(t, c1, "c1", 2)
+						ref = expectVarExact(t, c1, 1, "sa", "c1.sa", "<[]*main.astruct> (length: 3, cap: 3)", hasChildren)
+						if ref > 0 {
+							client.VariablesRequest(ref)
+							c1sa := client.ExpectVariablesResponse(t)
+							expectChildren(t, c1sa, "c1.sa", 3)
+							ref = expectVarRegex(t, c1sa, 0, `\[0\]`, `c1\.sa\[0\]`, `<\*main\.astruct>\(0x[0-9a-f]+\)`, hasChildren)
+							if ref > 0 {
+								client.VariablesRequest(ref)
+								c1sa0 := client.ExpectVariablesResponse(t)
+								expectChildren(t, c1sa0, "c1.sa[0]", 1)
+								// TODO(polina): there should be a child here once we support auto loading
+								expectVarExact(t, c1sa0, 0, "", "(*c1.sa[0])", "<main.astruct>", noChildren)
+							}
+						}
+					}
+
+					ref = expectVarExact(t, locals, -1, "aas", "aas", "<[]main.a> (length: 1, cap: 1)", hasChildren)
+					if ref > 0 {
+						client.VariablesRequest(ref)
+						aas := client.ExpectVariablesResponse(t)
+						expectChildren(t, aas, "aas", 1)
+						ref = expectVarExact(t, aas, 0, "[0]", "aas[0]", "<main.a>", hasChildren)
+						if ref > 0 {
+							client.VariablesRequest(ref)
+							aas0 := client.ExpectVariablesResponse(t)
+							expectChildren(t, aas0, "aas[0]", 1)
+							ref = expectVarExact(t, aas0, 0, "aas", "aas[0].aas", "<[]main.a> (length: 1, cap: 1)", hasChildren)
+							if ref > 0 {
+								client.VariablesRequest(ref)
+								aas0aas := client.ExpectVariablesResponse(t)
+								expectChildren(t, aas0aas, "aas[0].aas", 1)
+								// TODO(polina): there should be a child here once we support auto loading - test for "aas[0].aas[0].aas"
+								expectVarExact(t, aas0aas, 0, "[0]", "aas[0].aas[0]", "<main.a>", noChildren)
+							}
+						}
+					}
+
+					ref = expectVarExact(t, locals, -1, "tm", "tm", "<main.truncatedMap>", hasChildren)
+					if ref > 0 {
+						client.VariablesRequest(ref)
+						tm := client.ExpectVariablesResponse(t)
+						expectChildren(t, tm, "tm", 1)
+						ref = expectVarExact(t, tm, 0, "v", "tm.v", "<[]map[string]main.astruct> (length: 1, cap: 1)", hasChildren)
+						if ref > 0 {
+							client.VariablesRequest(ref)
+							tm_v := client.ExpectVariablesResponse(t)
+							expectChildren(t, tm_v, "tm.v", 1)
+							// TODO(polina): there should be children here once we support auto loading - test for "tm.v[0]["gutters"]"
+							expectVarExact(t, tm_v, 0, "[0]", "tm.v[0]", "<map[string]main.astruct> (length: 66)", noChildren)
+						}
+					}
 				},
 				disconnect: true,
 			}})
@@ -1371,6 +1456,7 @@ func TestSetBreakpoint(t *testing.T) {
 
 					type Breakpoint struct {
 						line      int
+						path      string
 						verified  bool
 						msgPrefix string
 					}
@@ -1382,7 +1468,7 @@ func TestSetBreakpoint(t *testing.T) {
 							return
 						}
 						for i, bp := range got.Body.Breakpoints {
-							if bp.Line != bps[i].line || bp.Verified != bps[i].verified ||
+							if bp.Line != bps[i].line || bp.Verified != bps[i].verified || bp.Source.Path != bps[i].path ||
 								!strings.HasPrefix(bp.Message, bps[i].msgPrefix) {
 								t.Errorf("got breakpoints[%d] = %#v, \nwant %#v", i, bp, bps[i])
 							}
@@ -1391,11 +1477,11 @@ func TestSetBreakpoint(t *testing.T) {
 
 					// Set two breakpoints at the next two lines in main
 					client.SetBreakpointsRequest(fixture.Source, []int{17, 18})
-					expectSetBreakpointsResponse([]Breakpoint{{17, true, ""}, {18, true, ""}})
+					expectSetBreakpointsResponse([]Breakpoint{{17, fixture.Source, true, ""}, {18, fixture.Source, true, ""}})
 
 					// Clear 17, reset 18
 					client.SetBreakpointsRequest(fixture.Source, []int{18})
-					expectSetBreakpointsResponse([]Breakpoint{{18, true, ""}})
+					expectSetBreakpointsResponse([]Breakpoint{{18, fixture.Source, true, ""}})
 
 					// Skip 17, continue to 18
 					client.ContinueRequest(1)
@@ -1405,7 +1491,7 @@ func TestSetBreakpoint(t *testing.T) {
 
 					// Set another breakpoint inside the loop in loop(), twice to trigger error
 					client.SetBreakpointsRequest(fixture.Source, []int{8, 8})
-					expectSetBreakpointsResponse([]Breakpoint{{8, true, ""}, {8, false, "Breakpoint exists"}})
+					expectSetBreakpointsResponse([]Breakpoint{{8, fixture.Source, true, ""}, {8, "", false, "Breakpoint exists"}})
 
 					// Continue into the loop
 					client.ContinueRequest(1)
@@ -1418,7 +1504,7 @@ func TestSetBreakpoint(t *testing.T) {
 
 					// Edit the breakpoint to add a condition
 					client.SetConditionalBreakpointsRequest(fixture.Source, []int{8}, map[int]string{8: "i == 3"})
-					expectSetBreakpointsResponse([]Breakpoint{{8, true, ""}})
+					expectSetBreakpointsResponse([]Breakpoint{{8, fixture.Source, true, ""}})
 
 					// Continue until condition is hit
 					client.ContinueRequest(1)
@@ -1431,7 +1517,7 @@ func TestSetBreakpoint(t *testing.T) {
 
 					// Edit the breakpoint to remove a condition
 					client.SetConditionalBreakpointsRequest(fixture.Source, []int{8}, map[int]string{8: ""})
-					expectSetBreakpointsResponse([]Breakpoint{{8, true, ""}})
+					expectSetBreakpointsResponse([]Breakpoint{{8, fixture.Source, true, ""}})
 
 					// Continue for one more loop iteration
 					client.ContinueRequest(1)
@@ -1444,7 +1530,7 @@ func TestSetBreakpoint(t *testing.T) {
 
 					// Set at a line without a statement
 					client.SetBreakpointsRequest(fixture.Source, []int{1000})
-					expectSetBreakpointsResponse([]Breakpoint{{1000, false, "could not find statement"}}) // all cleared, none set
+					expectSetBreakpointsResponse([]Breakpoint{{1000, "", false, "could not find statement"}}) // all cleared, none set
 				},
 				// The program has an infinite loop, so we must kill it by disconnecting.
 				disconnect: true,
diff --git a/service/test/integration1_test.go b/service/test/integration1_test.go
index 8b5afdab..3cb3a995 100644
--- a/service/test/integration1_test.go
+++ b/service/test/integration1_test.go
@@ -728,7 +728,7 @@ func Test1ClientServer_FullStacktrace(t *testing.T) {
 		assertNoError(err, t, "GoroutinesInfo()")
 		found := make([]bool, 10)
 		for _, g := range gs {
-			frames, err := c.Stacktrace(g.ID, 10, true)
+			frames, err := c.Stacktrace(g.ID, 40, true)
 			assertNoError(err, t, fmt.Sprintf("Stacktrace(%d)", g.ID))
 			t.Logf("goroutine %d", g.ID)
 			for i, frame := range frames {
diff --git a/service/test/integration2_test.go b/service/test/integration2_test.go
index e0468a6b..5cab11d8 100644
--- a/service/test/integration2_test.go
+++ b/service/test/integration2_test.go
@@ -923,7 +923,7 @@ func TestClientServer_FullStacktrace(t *testing.T) {
 		assertNoError(err, t, "GoroutinesInfo()")
 		found := make([]bool, 10)
 		for _, g := range gs {
-			frames, err := c.Stacktrace(g.ID, 10, 0, &normalLoadConfig)
+			frames, err := c.Stacktrace(g.ID, 40, 0, &normalLoadConfig)
 			assertNoError(err, t, fmt.Sprintf("Stacktrace(%d)", g.ID))
 			t.Logf("goroutine %d", g.ID)
 			for i, frame := range frames {