forked from go-delve/delve
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'go-delve:master' into master
- Loading branch information
Showing
395 changed files
with
28,139 additions
and
9,004 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -76,3 +76,35 @@ ssh -NL 4040:localhost:4040 [email protected] | |
``` | ||
dlv connect :4040 | ||
``` | ||
|
||
#### <a name="substpath"></a> Can not set breakpoints or see source listing in a complicated debugging environment | ||
|
||
This problem manifests when one or more of these things happen: | ||
|
||
* Can not see source code when the program stops at a breakpoint | ||
* Setting a breakpoint using full path, or through an IDE, does not work | ||
|
||
While doing one of the following things: | ||
|
||
* **The program is built and run inside a container** and Delve (or an IDE) is remotely connecting to it | ||
* Generally, every time the build environment (VM, container, computer...) differs from the environment where Delve's front-end (dlv or a IDE) runs | ||
* Using `-trimpath` or `-gcflags=-trimpath` | ||
* Using a build system other than `go build` (eg. bazel) | ||
* Using symlinks in your source tree | ||
|
||
If you are affected by this problem then the `list main.main` command (in the command line interface) will have this result: | ||
|
||
``` | ||
(dlv) list main.main | ||
Showing /path/to/the/mainfile.go:42 (PC: 0x47dfca) | ||
Command failed: open /path/to/the/mainfile.go: no such file or directory | ||
(dlv) | ||
``` | ||
|
||
This is not a bug. The Go compiler embeds the paths of source files into the executable so that debuggers, including Delve, can use them. Doing any of the things listed above will prevent this feature from working seamlessly. | ||
|
||
The substitute-path feature can be used to solve this problem, see `config help substitute-path` or the `substitutePath` option in launch.json. | ||
|
||
The `source` command could also be useful in troubleshooting this problem, it shows the list of file paths that has been embedded by the compiler into the executable. | ||
|
||
If you still think this is a bug in Delve and not a configuration problem, open an [issue](https://github.com/go-delve/delve/issues), filling the issue template and including the logs produced by delve with the options `--log --log-output=rpc,dap`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,11 @@ | ||
## Homebrew | ||
|
||
You can install Delve via HomeBrew with the following command: | ||
|
||
```shell | ||
$ brew install delve | ||
``` | ||
|
||
## Other installation methods | ||
|
||
See [general install instructions](../README.md). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
) | ||
|
||
func g() { | ||
} | ||
|
||
func main() { | ||
g() | ||
a := os.Args[1] == "1" | ||
if a { | ||
fmt.Printf("true branch %v\n", a) | ||
} else { | ||
fmt.Printf("false branch %v\n", a) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#include "textflag.h" | ||
|
||
TEXT ·asmBrk(SB),0,$0-0 | ||
BYTE $0xcc | ||
RET |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package main | ||
|
||
func asmBrk() | ||
|
||
func main() { | ||
asmBrk() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package main | ||
|
||
/* | ||
int a(int v) { | ||
return 0xff + v; | ||
} | ||
*/ | ||
import "C" | ||
import "fmt" | ||
|
||
func main() { | ||
fmt.Println("aaa") | ||
print(C.a(11)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package main | ||
|
||
import ( | ||
"sync" | ||
"time" | ||
) | ||
|
||
func main() { | ||
var wg sync.WaitGroup | ||
wg.Add(2) | ||
for i := 0; i < 2; i++ { | ||
go func() { | ||
j := 0 | ||
for { | ||
j++ | ||
if j > 10 { | ||
break | ||
} | ||
} | ||
wg.Done() | ||
}() | ||
time.Sleep(time.Second) | ||
} | ||
wg.Wait() | ||
} |
Oops, something went wrong.