закешированный к нам в целях безопасности дебаггер
Go to file
Matt Bauer beb3e76f33 proc: Handle race between fork and task_for_pid (#1117)
* Handle race between fork and task_for_pid

On macOS a call to fork and a subsequent call to task_for_pid will race each other. This is because the macOS kernel assigns a new proc_t structure early but the new task, thread and uthread come much later. The function exec_mach_imgact in the XNU sources contains this logic.

In a system under load or one with delays in fork processing (i.e. various security software), task_for_pid as currently called by Delve often returns the parent task. This can be seen by printing out the task number around line 86. In a normal system we would see three calls:

-> ~/go/bin/dlv --listen=localhost:59115 --headless=true --api-version=2 --backend=native exec ./___main_go -- 
Task: 9731
Task: 9731
Task: 9731
API server listening at: 127.0.0.1:59115

This is the result on a system where the race is lost:

-> ~/go/bin/dlv --listen=localhost:59115 --headless=true --api-version=2 --backend=native exec ./___main_go -- 
Task: 8707
Task: 10499
Task: 10499
could not launch process: could not get thread count

In this latter case, task 8707 is the parent task. The child task of 10499 was desired and hence the error.

This code change checks to make sure the returned task is not that of the parent. If it is, it retries. It's possible other macOS reported Delve issues are the result of this failed race.

* proc: correct formatting
2018-02-07 10:25:34 -08:00
_fixtures proc,prettyprint: guard against autodereferenced escaped pointers (#1077) 2018-01-19 15:50:28 +01:00
assets Add high-res images 2015-05-19 12:25:26 -05:00
cmd/dlv command/terminal: allow restart to change process args (#1060) 2018-01-18 14:16:11 -08:00
Documentation Documentation: Document passing flags with --. (#1096) 2018-01-25 11:59:02 -08:00
pkg proc: Handle race between fork and task_for_pid (#1117) 2018-02-07 10:25:34 -08:00
scripts pkg/proc, pkg/dwarf/op: support DW_OP_piece, DW_OP_regX, DW_OP_fbreg 2017-11-21 11:51:02 -08:00
service proc,prettyprint: guard against autodereferenced escaped pointers (#1077) 2018-01-19 15:50:28 +01:00
vendor command/terminal: allow restart to change process args (#1060) 2018-01-18 14:16:11 -08:00
.gitattributes makefile: use git's $Id$ instead of setting ver.Build in makefile (#807) 2017-04-28 10:14:33 -07:00
.gitignore git: Update gitignore 2015-10-20 20:55:11 -07:00
.travis.yml core_test: fix TestCoreFpRegisters on go1.9 (#1082) 2018-01-24 11:42:35 -08:00
appveyor.yml *: Update appveyor.yml 2017-05-27 14:12:31 +02:00
CHANGELOG.md CHANGELOG: changed rc.2 date. 2017-10-20 12:14:15 -07:00
CONTRIBUTING.md Update CONTRIBUTING.md 2016-05-13 10:43:09 +08:00
glide.lock pkg/dwarf/godwarf: split out type parsing from x/debug/dwarf 2017-08-01 11:20:25 -06:00
glide.yaml pkg/dwarf/godwarf: split out type parsing from x/debug/dwarf 2017-08-01 11:20:25 -06:00
ISSUE_TEMPLATE.md misc: Include issue template for GitHub 2016-03-03 10:40:14 -08:00
LICENSE Add License and README 2014-05-03 15:31:52 -05:00
Makefile Makefile: use go env GOPATH for install path 2017-12-20 16:34:11 -08:00
README.md Documentation: fix link to Getting Started 2018-01-04 11:17:36 -08:00

Delve

license GoDoc Build Status Build status Join the chat at https://gitter.im/derekparker/delve

The Github issue tracker is for bugs only. Please use the developer mailing list for any feature proposals and discussions.

About Delve

Delve is a debugger for the Go programming language. The goal of the project is to provide a simple, full featured debugging tool for Go. Delve should be easy to invoke and easy to use. Chances are if you're using a debugger, things aren't going your way. With that in mind, Delve should stay out of your way as much as possible.