Commit Graph

2018 Commits

Author SHA1 Message Date
polinasok
a224f17374
service/dap: use address, not index to differentiate compound map keys (#2291)
* Use address, not index to differentiate compound map keys

* Clean up calls to expectVarRegex

Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com>
2021-01-08 09:17:54 -08:00
polinasok
3e0ddf2bd1
Fix race condition in TestAttachStopOnEntry (#2290)
Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com>
2021-01-06 09:07:47 -08:00
Alessandro Arzilli
6d1c00e56d
terminal,service: print WaitReason, WaitSince for goroutines (#2270)
Fixes #637
2021-01-05 10:59:17 -08:00
Alex Zamai
433eafb280
*: Expand --build-flags= description in the document (#2273)
add example for multiple  --build-flags

add example description to --build-flags
2021-01-05 10:57:30 -08:00
Alessandro Arzilli
6dd686ca49
Go 1.16 support branch (#2214)
* proc: misc test fixes for Go 1.16

* proc: fix cgo stacktraces in Go 1.16 with simplified C -> Go call path

* dwarf/line: make dwarf/line correct when '\\' are used

Our code depends heavily on paths being '/' separated because go always
produced '/' separated file paths. The call to filepath.Join will
normalize the paths, on windows, to always be '\\' separated, which
violated our assumptions.

This didn't use to be a problem because the codepath that calls
filepath.Join was never exercised by executable files produced by Go,
but Go 1.16 started producing debug_line sections that use the
directory table with https://go-review.googlesource.com/c/go/+/263017/.

Fix this to always use path.Join after making sure, on windows, to
always normalize paths to use '/' as a separator. Replace the use of
filepath.IsAbs with an operating system independent version.

* goversion: bump supported Go version
2021-01-05 10:56:30 -08:00
Alessandro Arzilli
75f00b963c
terminal: add way to cancel goroutines command with ctrl-C (#2278)
The goroutines command can take a long time to complete if there are
many goroutines, add the possibility to terminate it early by pressing
ctrl-C.
2021-01-04 08:54:39 -08:00
nd
6726ec3aa3
pkg/proc: Fix panic in goroutine parsing for binaries compiled with go1.10 (#2283)
Before go1.11 waitreason field was a string, not an int. Return 0
waitreason for old go versions.

Should fix #2282
2021-01-04 08:53:23 -08:00
Christian Banse
57f033e4bc
proc/gdbserial: Added support for darwin/arm64 using gdbserver (#2285)
* Added support for reading darwin/arm64 using gdbserver

* Trying to fix test failures

* Addressing review comments
2021-01-04 08:52:04 -08:00
Alessandro Arzilli
6328edaa1b
pkg/prog/native/linux: change handling of ESRCH in trapWaitInternal (#2286)
If a thread exits while we are looking at it just treat it as if the
status had reported it as exited instead of doing something special.
Fixes flakiness in TestIssue387.
2021-01-04 08:42:08 -08:00
polinasok
796278ecba
service/dap: Support local attach (#2260)
* Support local attach

* Undo loopprog change

* Remove test check for system-specific error message

* Skip attach tests on freebasd

Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com>
2020-12-28 09:14:15 -08:00
Alessandro Arzilli
6667387e01
pkg/proc/native: fix nil pointer dereference in linux backend (#2279) 2020-12-28 09:12:33 -08:00
Alessandro Arzilli
8462d5c7d4
native/proc/linux: wait for the target process to be killed in kill (#2280)
Waits for the target process to have received the kill signal in
native.nativeProcess.kill. Fixes an infrequent error in TestKill.
2020-12-28 09:08:47 -08:00
nd
0ae77bd6c5
Don't call suspend on DbgUiRemoteBreakin threads (#2281)
Sometimes it makes debuggee to hang.

Should fix #2244
2020-12-28 09:07:50 -08:00
Alessandro Arzilli
7dcd7b4d1e
Miscellaneous fixes for problems uncovered by Github Actions tests (#2274)
Fix bug in DAP test: TestEvaluateCallRequest.
In Go 1.15 the call injection will be executed on a different goroutine
from the goroutine where it was started on to avoid confusing the
garbage collector, the test must be aware of this fact and use the
goroutine ID from the stopped response instead of assuming 1 is the
currently selected goroutine.

Disables TestAttachDetach when running in Github Actions.

Disable some coredump tests when running in Github Actions (core size
limits?).
2020-12-27 15:11:02 -08:00
Alessandro Arzilli
e7558c5bc5
proc/native: fix linux/386 native backend (#2276)
Change 24ec175 (use CPUID to determine maximum size of XSAVE area)
broke the linux/386 backend, this commit fixes it.
2020-12-21 10:56:09 -08:00
Alessandro Arzilli
8221250e65
split testing load between more CI services (#2251) 2020-12-16 08:56:15 -08:00
Alessandro Arzilli
d61bf018f0
debugger: check that target is valid when detaching (#2263)
Do not call detach if the target is no longer valid.

Fixes #2259

Co-authored-by: a <a@kra>
2020-12-15 08:13:13 -08:00
Alessandro Arzilli
24ec1754b2
proc: use CPUID to determine maximum size of XSAVE area (#2256)
the maximum size of the Xsave area was previously hardcoded but the
CPUID instruction can be used to determine its maximum size.
2020-12-14 09:39:01 -08:00
Florin Pățan
7ac317a7e8
service/api: Expose WaitSince and WaitReason fields for goroutines (#2264)
This adds the WaitSince and WaitReason fields for the goroutines to allow the users to easily understand why a goroutine is waiting.
2020-12-14 09:31:45 -08:00
hitzhangjie
d481eabab9
dwarf/*: add godoc comments (#2265) 2020-12-14 09:31:11 -08:00
Alessandro Arzilli
69009f87bb
_scripts: remove accidentally committed file (#2268) 2020-12-14 09:13:07 -08:00
Andrei Matei
36050b1a37
proc: update a comment (#2266)
The comment on the advanceRegs() method was referencing several
nonexistent fields. This patch fixes that, and improves the comment to
reference the peculiar interaction between the method and it.regs.
2020-12-14 09:00:27 -08:00
Alessandro Arzilli
fbfad81968
proc/gdbserial: use --unmask-signal debugserver option (#2255)
Fixes #852

Co-authored-by: a <a@kra>
2020-12-10 09:04:35 -08:00
Alessandro Arzilli
d3e9158e9e
proc: make nested function calls work when stopped at a sw breakpoint (#2232)
evalFunctionCall needs to remove the breakpoint from the current thread
after starting the function call injection, otherwise Continue will
think that the thread is stopped at a breakpoint and return to the user
instead of continuing the call injection.
2020-12-10 09:03:11 -08:00
Alessandro Arzilli
807664b34b
proc: add flag to distinguish ReturnValues (#2230)
Adds a flag that distinguishes the return values of an injected
function call from the return values of a function call executed by the
target program.
2020-12-10 08:57:50 -08:00
aarzilli
f7542d69fe all: bump version and release notes
Thank you to: @polinasok, @aurkenb, @pohzipohzi, @chainhelen,
@hitzhangjie, @eliben, @suzmue, @andreimatei, @aaronsky.
2020-12-09 11:38:21 +01:00
Andrei Matei
60b5e9d4ba
dwarf/reader: minor comments around variable resolving (#2253)
Fix some stale comments and add some comments that I would have found
useful.
2020-12-08 11:46:40 -08:00
Alessandro Arzilli
34ffa2e763
dwarf/line: do not consider end of sequence entries valid (#2235)
This is needed to fix the problem we have with 1.15.4+ after the
backport is applied to it. The DWARF standard isn't clear on what
should happen with the end_of_sequence opcode but this is consistent
with debug/dwarf.LineReader as well as gdb.
2020-12-04 09:35:57 -08:00
polinasok
731f5ed346
go.mod: update google/go-dap to 0.4.0 (#2248)
Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com>
2020-12-04 08:58:55 -08:00
polinasok
98cba03f7d
service/dap: expand goroutine info in threads response (#2233)
* service/dap: expand goroutine info in threads response

* Fix checks

* Make DeepSource happy

Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com>
2020-11-30 09:43:37 -08:00
polinasok
d3d2910de2
Enable supportsDelayedStackTraceLoading capability (#2238)
Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com>
2020-11-30 09:43:09 -08:00
Aaron Sky
579b17ce27
proc/gdbserial: Use the active xcode-select path instead of a hardcoded Xcode path (#2229)
* Use the active xcode-select path instead of a hardcoded Xcode path

* Refactored exec.Command to invoke Output instead of running with a custom buffer for stdout

Addresses review comment by @derekparker
2020-11-17 08:49:15 -08:00
aarzilli
db93049813 service,terminal: apply substitute path to trace/break argument
Change FindLocation to apply substitute path rules to location
expressions. Changes terminal to always print paths after applying
substitutions.

Implements #2203
2020-11-17 16:41:35 +01:00
aarzilli
6ab6929b9a proc/gdbserial: fix redirect bugs with debugserver
1. Forward stdin/stdout/stderr to the target process when in foreground
   mode instead of always forwarding the current tty (issue #1964)
2. When redirecting a file descriptor make sure to also specify
   something for all three otherwise debugserver will misbehave (either
   exit on launch or run but giving the target process a closed file
   descriptor).

Fixes #1964
2020-11-17 16:00:22 +01:00
Alessandro Arzilli
4f03ef0bc4
proc: fix TestStepIntoWrapperForEmbeddedPointer for Go 1.15.4 (#2223) 2020-11-16 10:37:21 -08:00
Alessandro Arzilli
fe1db25d16
Travis-CI: hold back version of Go 1.15.x (#2225)
See https://github.com/golang/go/issues/42484
2020-11-16 10:36:32 -08:00
Andrei Matei
42f56e2862
proc: add minor comments (#2228)
This patch adds some comments around RequestManualStop().
2020-11-16 08:55:59 -08:00
polinasok
c94db60d27
service/dap: support evaluate requests with expressions and calls (#2185)
* Support evaluate request

* Fix failing tests

* Call support

* Remove debugger.CurrentThread() that got accidentally reintroduced during merge

* Address review comments

* Function to stringify stop reason

* Add resetHandlesForStop

* Handle stop inside call

* More tests

* Address review comments

* Check all threads to determine if call completed

* Fix test

* Fix test

* Fix test

* Address review comments

Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com>
2020-11-12 15:24:31 -08:00
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
Alessandro Arzilli
e69d536e81
proc/native: fix flakyness of TestStepConcurrentDirect on linux/386 (#2179)
TestStepConcurrentDirect will occasionally fail (7% of the time on my
setup) by either causing the target processs to execute an invalid
instruction or (more infrequently) by switching to the wrong thread.

Both of those are caused by receiving SIGTRAPs for threads hitting a
breakpoint after it has been removed (the thread hits the breakpoint,
we stop everything and remove the breakpoint and only after we receive
the signal).

Change native.(*nativeProcess).stop to handle SIGTRAPs that can't be
attributed to a breakpoint, a hardcoded breakpoint in the program's
text, or manual stops (and therefore are likely caused by phantom
breakpoint hits).

Co-authored-by: a <a@kra>
2020-11-03 10:28:37 -08:00
Alessandro Arzilli
1f552c5a4c
pkg/proc/native: increase max size of XSTATE area to support newer CPUs (#2220)
Fixes #2219
2020-11-03 07:19:09 -08:00
Polina Sokolova
42a4c80678 Remove redundant check in call tests 2020-11-03 11:59:16 +01:00
polinasok
3fd78fc498
Relax flaky check in TestScopesAndVariables on windows/go1.15 (#2215)
Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com>
2020-10-30 13:53:54 +01:00
Alessandro Arzilli
775c923ec4
proc: support reading deferred calls' arguments on linux/arm64 (#2210) 2020-10-22 08:26:19 -07:00
Alessandro Arzilli
1a782d321d
service/rpccommon: log error for conns rejected by --only-same-user (#2211)
* service/rpccommon: log error for conns rejected by --only-same-user

If no logger is enabled manually write to stderr instead.

Fixes #2209

* logflags: fix style complaints from DeepSource
2020-10-22 08:23:55 -07:00
Alessandro Arzilli
9a3c9ebad1
proc/*: add launch option to disable ASLR (#2202)
Fixes #1847
2020-10-21 12:50:52 -07:00
chainhelen
0bbf9e4eaf
*: Closer close and use assertNoError for testcase (#2204) 2020-10-19 14:44:04 -07:00
chainhelen
9b7bc63886
Doc: update KnownBugs and faq. (#2196)
1. Remove bug about unsupport systems, because we has pretty error msg.
2. Add usage for remote debugging.

Relate: #1883, #1829, #861, #1332.
2020-10-19 08:21:03 -07:00
Alessandro Arzilli
a31631b5f9
proc/test: fix TestStepCallPtr on linux/386 (#2193)
The test needs to set a breakpoint on main.CallFn after the prologue,
on linux/386 this function does not have any instruction after the
prologue on the function header line  because it doesn't need to
allocate space for local variables. Change the fixture so that this
isn't a problem.

This bug results on the test failing a small percentage of the time.

Co-authored-by: a <a@kra>
2020-10-12 15:07:24 -07:00
Alessandro Arzilli
a2550b4809
proc: Remove (*Arch).Prologues method (#2192)
It returns an unexported type and is only used in a single place.
2020-10-12 15:05:28 -07:00