закешированный к нам в целях безопасности дебаггер
Go to file
Alessandro Arzilli 0843376018
proc/*: remove proc.Thread.Blocked, refactor memory access (#2206)
On linux we can not read memory if the thread we use to do it is
occupied doing certain system calls. The exact conditions when this
happens have never been clear.

This problem was worked around by using the Blocked method which
recognized the most common circumstances where this would happen.

However this is a hack: Blocked returning true doesn't mean that the
problem will manifest and Blocked returning false doesn't necessarily
mean the problem will not manifest. A side effect of this is issue
#2151 where sometimes we can't read the memory of a thread and find its
associated goroutine.

This commit fixes this problem by always reading memory using a thread
we know to be good for this, specifically the one returned by
ContinueOnce. In particular the changes are as follows:

1. Remove (ProcessInternal).CurrentThread and
(ProcessInternal).SetCurrentThread, the "current thread" becomes a
field of Target, CurrentThread becomes a (*Target) method and
(*Target).SwitchThread basically just sets a field Target.

2. The backends keep track of their own internal idea of what the
current thread is, to use it to read memory, this is the thread they
return from ContinueOnce as trapthread

3. The current thread in the backend and the current thread in Target
only ever get synchronized in two places: when the backend creates a
Target object the currentThread field of Target is initialized with the
backend's current thread and when (*Target).Restart gets called (when a
recording is rewound the currentThread used by Target might not exist
anymore).

4. We remove the MemoryReadWriter interface embedded in Thread and
instead add a Memory method to Process that returns a MemoryReadWriter.
The  backends will return something here that will read memory using
the current thread saved by the backend.

5. The Thread.Blocked method is removed

One possible problem with this change is processes that have threads
with different memory maps. As far as I can determine this could happen
on old versions of linux but this option was removed in linux 2.5.

Fixes #2151
2020-11-09 11:28:40 -08:00
_fixtures *: Closer close and use assertNoError for testcase (#2204) 2020-10-19 14:44:04 -07:00
_scripts proc/tests: keep track of tests skipped due to backend problems (#2178) 2020-09-24 08:10:20 -07:00
assets Add high-res images 2015-05-19 12:25:26 -05:00
cmd/dlv proc/*: add launch option to disable ASLR (#2202) 2020-10-21 12:50:52 -07:00
Documentation proc: support reading deferred calls' arguments on linux/arm64 (#2210) 2020-10-22 08:26:19 -07:00
pkg proc/*: remove proc.Thread.Blocked, refactor memory access (#2206) 2020-11-09 11:28:40 -08:00
service proc/*: remove proc.Thread.Blocked, refactor memory access (#2206) 2020-11-09 11:28:40 -08:00
vendor service/dap: pull in newer version of google/go-dap (#2167) 2020-09-15 14:43:13 -07:00
.cirrus.yml *: Update freebsd image 2020-04-08 11:40:24 +02:00
.deepsource.toml *: mv scripts _scripts 2020-03-28 20:28:51 +01:00
.gitattributes makefile: use git's $Id$ instead of setting ver.Build in makefile (#807) 2017-04-28 10:14:33 -07:00
.gitignore vendor: check vendor directory (#1962) 2020-03-26 09:25:50 -07:00
.travis.yml service/*: remove threadID argument of (*Debugger).PackageVariables (#2182) 2020-09-24 08:02:29 -07:00
CHANGELOG.md all: bump version and release notes 2020-07-29 21:59:07 +02:00
CONTRIBUTING.md README: Remove gitter chat link. 2020-01-21 09:06:53 -08:00
go.mod service/dap: pull in newer version of google/go-dap (#2167) 2020-09-15 14:43:13 -07:00
go.sum service/dap: pull in newer version of google/go-dap (#2167) 2020-09-15 14:43:13 -07: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 *: mv scripts _scripts 2020-03-28 20:28:51 +01:00
README.md Documentation: Add FreeBSD under main README (#2107) 2020-07-20 09:32:08 -07:00

Delve

license GoDoc Build Status

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.