Commit Graph

2018 Commits

Author SHA1 Message Date
Alessandro Arzilli
38aaf274a9
service/dap: fix TestPreSetBreakpoint (#2600)
TestPreSetBreakpoint sometimes fail because a goroutine is stopped in
some runtime/internal package instead of just 'runtime'.
2021-07-19 08:09:18 -07:00
Alessandro Arzilli
d6556b85b1
TeamCity: remove 1.16 testing for linux/arm64, windows/amd64 and mac/* (#2601)
We've only ever tested the latest version of Go on everything except
linux/amd64.
2021-07-19 08:03:18 -07:00
polinasok
4e78f7f391
service/dap: add modes comments (TODO from PR/2367) (#2575)
Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com>
2021-07-18 20:06:52 +02:00
polinasok
af378d396f
service/dap: add backend launch/attach attribute (#2567)
Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com>
2021-07-18 11:37:41 +02:00
nd
2a22af2e77
teamcity: fix settings (#2598) 2021-07-17 09:58:45 -07:00
Suzy Mueller
feb55342eb
service/dap: add len as metadata for map (#2584) 2021-07-16 09:50:37 -07:00
polinasok
5459034a98
cmd/dap: server - always headless, target - always foregrounded (#2589)
Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com>
2021-07-16 09:49:16 -07:00
Derek Parker
584191a75c
*: Release 1.7.0 (#2591) 2021-07-16 15:31:52 +02:00
polinasok
9df8f1499f
service/dap: variables response must not have null variables array (#2592)
Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com>
2021-07-15 14:15:49 -07:00
Suzy Mueller
890cde3d4c
service/dap: send terminated event when disconnecting (#2587)
* service/dap: send terminated event when disconnecting

If the program terminates while disconnecting, either because it
was killed or otherwise, send a terminated event.
2021-07-14 14:32:46 -07:00
Derek Parker
175ca0c769
service/rpc2: Fix panic in ListDynamicLibraries (#2586)
The slice `out.List` is created with a length of 0 but a capacity of
`len(imgs)`. This causes the line below to panic as we try to index into
the `out.List` slice instead of append to it. This patch resolves the
issue by appending instead of indexing into the slice.

Co-authored-by: Derek Parker <deparker@redhat.com>
2021-07-14 18:28:54 +02:00
Suzy Mueller
f86ed675d8
service/dap: add panic and throw text to stopped event (#2559)
* service/dap: add panic and throw text to stopped event

We can add more information to the stopped events on errors using
the `Text` field in the stopped event. We already use this to display
the runtime errors. Adding this information to the stopped reason will
also help to show the user additional info when a stopped event is not
associated with a particular goroutine.
2021-07-13 08:38:28 -07:00
Augusto Yao
686989e1b3
debugserver: fix typo in checking whether debugserver support unmask_… (#2581)
* debugserver: fix typo in checking whether debugserver support unmask_signals

* gdbserver.go: fix issues in deepsource:go
2021-07-13 08:37:26 -07:00
polinasok
569b772b82
proc/gdbserial: ContinueOnce returns StopUnknown, not StopExited on non-exited error (#2577)
Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com>
2021-07-12 09:49:02 -07:00
Alessandro Arzilli
1399f20585
TeamCity: add go1.17 to test matrix, disable go-tip builds (#2576) 2021-07-12 09:48:11 -07:00
Alessandro Arzilli
f0a32c8e1b
Go 1.17 support branch (#2451)
* proc: support new Go 1.17 panic/defer mechanism

Go 1.17 will create wrappers for deferred calls that take arguments.
Change defer reading code so that wrappers are automatically unwrapped.

Also the deferred function is called directly by runtime.gopanic, without going through runtime.callN which means that sometimes when a panic happens the stack is either:

0. deferred function call
1. deferred call wrapper
2. runtime.gopanic

or:

0. deferred function call
1. runtime.gopanic

instead of always being:

0. deferred function call
1. runtime.callN
2. runtime.gopanic

the isPanicCall check is changed accordingly.

* test: miscellaneous minor test fixes for Go 1.17

* proc: resolve inlined calls when stepping out of runtime.breakpoint

Calls to runtime.Breakpoint are inlined in Go 1.17 when inlining is
enabled, resolve inlined calls in stepInstructionOut.

* proc: add support for debugCallV2 with regabi

This change adds support for the new debug call protocol which had to
change for the new register ABI introduced in Go 1.17.

Summary of changes:
- Abstracts over the debug call version depending on the Go version
  found in the binary.
- Uses R12 instead of RAX as the debug protocol register when the binary
  is from Go 1.17 or later.
- Creates a variable directly from the DWARF entry for function
  arguments to support passing arguments however the ABI expects.
- Computes a very conservative stack frame size for the call when
  injecting a call into a Go process whose version is >=1.17.

Co-authored-by: Michael Anthony Knyszek <mknyszek@google.com>
Co-authored-by: Alessandro Arzilli <alessandro.arzilli@gmail.com>

* TeamCity: enable tests on go-tip

* goversion: version compatibility bump

* TeamCity: fix go-tip builds on macOS/arm64

Co-authored-by: Michael Anthony Knyszek <mknyszek@google.com>
2021-07-08 08:47:53 -07:00
Suzy Mueller
e1febcf609
service/dap: send dap error response on dap error (#2561)
The code previously expected the server to close when receiving
a message that it could not decode. However, there may be changes to
the spec that make new requests that we have not handled yet. In
that case, it would be preferable to return an error and continue handling
incoming requests.
2021-07-07 22:27:54 -07:00
Suzy Mueller
0bf3e790cd
service/dap: set hit breakpoint ids (#2550) 2021-07-07 22:08:52 -07:00
Alessandro Arzilli
c617ed8189
proc/core/minidump,proc/gdbserial: update broken ext links (#2570)
The LLVM project archived their repository and moved it elsewhere,
Microsoft broke their minidump documentation URLs.
2021-07-06 09:28:53 -07:00
Alessandro Arzilli
b9fcb03ff4
proc/native,proc/gdbserial: detect and complain about Rosetta (#2569)
Delve does not run under Rosetta. Detect this condition and point
confused users towards the solution.
2021-07-06 08:53:39 -07:00
Suzy Mueller
de117a2f4f
pkg/proc: fix bug where frame parameter is ignored if no goroutine (#2563)
ConvertEvalScope() attempts to find the scope for the specified
goroutine id and frame index. If the goroutine that is found is nil,
then it falls back to the threads stack trace to find the scope.
This fix makes sure that the frame id is taken into account for
thread strack traces as well.
2021-07-03 15:48:35 +02:00
polinasok
9dfd164cf9
service/dap: tune up shutdown logic (#2564)
Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com>
2021-07-02 10:14:43 -07:00
Alessandro Arzilli
1b0c4310c4
proc: give unique addresses to registerized variables (#2527)
We told clients that further loading of variables can be done by
specifying a type cast using the address of a variable that we
returned.
This does not work for registerized variables (or, in general,
variables that have a complex location expression) because we don't
give them unique addresses and we throw away the compositeMemory object
we made to read them.

This commit changes proc so that:

1. variables with location expression divided in pieces do get a unique
   memory address
2. the compositeMemory object is saved somewhere
3. when an integer is cast back into a pointer type we look through our
   saved compositeMemory objects to see if there is one that covers the
   specified address and use it.

The unique memory addresses we generate have the MSB set to 1, as
specified by the Intel 86x64 manual addresses in this form are reserved
for kernel memory (which we can not read anyway) so we are guaranteed
to never generate a fake memory address that overlaps a real memory
address of the application.

The unfortunate side effect of this is that it will break clients that
do not deserialize the address to a 64bit integer. This practice is
contrary to how we defined our types and contrary to the specification
of the JSON format, as of json.org, however it is also fairly common,
due to javascript itself having only 53bit integers.

We could come up with a new mechanism but then even more old clients
would have to be changed.
2021-07-02 18:37:55 +02:00
Alessandro Arzilli
7c82164264
terminal,service: Add filtering and grouping to goroutines command (#2504)
Adds filtering and grouping to the goroutines command.

The current implementation of the goroutines command is modeled after
the threads command of gdb. It works well for programs that have up to
a couple dozen goroutines but becomes unusable quickly after that.

This commit adds the ability to filter and group goroutines by several
different properties, allowing a better debugging experience on
programs that have hundreds or thousands of goroutines.
2021-07-01 11:25:33 -07:00
polinasok
4fd6c483e1
dap: update dlv dap --help (#2558)
Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com>
2021-06-29 15:15:47 +02:00
Derek Parker
96b379b5a2
service/debugger: improve CreateBreakpoint docs (#2553)
The existing documentation was a little light on details. This patch
gives more insight into how the argument to this function is used and
interpreted.

* service/rpc2,service/debugger: more doc updates

Combine debugger.CreateBreakpoint documentation with the documentation
that already existed for the rpc2 server CreateBreakpoint method.

Also adds more contextual information for both the server and client
with links to debugger.CreateBreakpoint documentation.
2021-06-29 15:14:24 +02:00
Alessandro Arzilli
d9ba60dcfe
test: disable avx512 test when backend is 'rr' (#2547)
The rr backend does not report avx512 registers back to us.
2021-06-28 09:48:51 -07:00
Alessandro Arzilli
7f527d26a8
gdbserial: actually fix ZMM register support (#2516)
PR #2498 / commit d552b338 left out some code due to a clerical error.
2021-06-28 08:42:06 -07:00
Suzy Mueller
1ebfc5c37b
service/dap: add throw reason to exception info (#2524)
We can get the throw reason by looking at the argument "s" in runtime.throw. This is not currently working in Go 1.16 or Go 1.17 (see golang/go#46425), but does work in Go 1.15 and Go 1.14
2021-06-28 08:39:34 -07:00
Derek Parker
7411290468
*: Add .vscode to .gitignore (#2554)
We should ignore this by default.
2021-06-26 09:16:35 +02:00
Suzy Mueller
7b98f5870d
service/dap: add string value of byte/rune slice as child (#2541)
Load limit for metadata string is set to MaxStringLen
2021-06-23 16:51:57 -07:00
Suzy Mueller
0b38b5d4ec
service/dap: fix error string format (#2549) 2021-06-23 20:21:19 +02:00
polinasok
0a19c78021
service/dap: increase default string loading limit and refactor (#2546)
Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com>
2021-06-22 08:14:47 -07:00
Derek Parker
544a803a80
proc,dwarf: Improve DWARF v5 support (#2544)
While Go still mostly uses DWARF v4, newer versions of GCC will emit
DWARF v5 by default. This patch improves support for DWARF v5 by parsing
the .debug_line_str section and using that during file:line lookups.

This patch only includes support for files, not directories.

Co-authored-by: Derek Parker <deparker@redhat.com>
2021-06-22 13:37:46 +02:00
Derek Parker
42ecbd4413
proc,terminal: Ensure correct exit status (#2543)
Ensure that any command executed after the process we are trying to
debug prints a correct and consistent exit status.

Previously the exit code was being lost after the first time we printed
that a process has exited. Additionally, certain commands would print
the PID of the process and other would not. This change makes everything
more correct and consistent.
2021-06-22 13:35:13 +02:00
Derek Parker
d3f4a8d443
proc: remove stack barrier support (#2540)
* proc: remove stack barrier support

Stack barriers were removed way back in Go 1.9 so it's safe to
eliminate and clean up this code now.
2021-06-17 14:35:33 +02:00
polinasok
69485a639d
service/dap: separate tests for var value truncation and str loading limits (#2539)
Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com>
2021-06-16 13:27:38 -07:00
Alessandro Arzilli
29825d41a6
terminal,api: move PrintStack function (#2537)
Commit 30cdedae6910f5e9af6739845bacfd5b8778e745 introduced a dependency
from service/dap to pkg/terminal to call a stack printing function,
it's weird to have code that implements the DAP protocol depend on the
code for the JSON-RPC client.
Move PrintStack to a different package that can be called by both.
2021-06-16 13:05:17 -07:00
Hyang-Ah Hana Kim
1ecdb3be05
sameuser: log the uid/remoteUID when they are not matching (#2535)
Updates https://github.com/golang/vscode-go/issues/1555
2021-06-15 15:36:39 +02:00
Suzy Mueller
688f94a4f8
service/dap: truncate value for expandable types in hover (#2529)
On hovers, including the full value for complex types is unnecessary, since the user will likely need to expand the children to inspect the values. Additionally, this can really slow down getting the hover values. This change will allow truncating the value in hover if the variable has a variables reference.

Updates golang/vscode-go#1435
2021-06-11 10:46:49 -07:00
Suzy Mueller
aa377789b0
service/dap: deemphasize internal runtime stack frames (#2522)
Apply a presentation hint to the internal runtime stack frames, so that these can be deemphasized in the UI. This should allow
users to more easily inspect their own code, and will keep the option to view those frames if they choose to.
2021-06-10 10:59:24 -07:00
Suzy Mueller
30b3cc2c6f
service/dap: implement array, slice, and map paging (#2512)
If the client supports paging, we allow them to fetch array and slice items in chunks that we assume will be of a reasonable size. For example, VS Code requests indexed variables in chunks of 100.

Fixes golang/vscode-go#1518
2021-06-10 09:34:20 -07:00
polinasok
fb4d6f1144
service/dap: handle no-such-process error on disconnect and fix flaky test (#2476)
Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com>
2021-06-10 09:30:31 -07:00
Suzy Mueller
7a3faca71f
service/dap: make stopped event description more concise (#2523) 2021-06-04 17:35:50 +02:00
Hyang-Ah Hana Kim
152c74e94e
dap: add 'clipboard' support, and truncate a long value (#2513)
- add 'clipboard' capability
- apply a larger string limit for 'hover' and 'clipboard' context
- truncate the string representation of compound (or pointer of compound)
type variable
2021-06-04 09:27:57 +02:00
Suzy Mueller
054e3f8ef2
service/dap: generate continued events for step tests (#2525) 2021-06-03 09:50:53 -07:00
Alessandro Arzilli
d72b03b846
terminal: support setting hitcount conditions on breakpoints (#2518)
Adds a -hitcount argument to condition that sets a hitcount condition
on breakpoints.
2021-06-02 13:47:32 -07:00
Alessandro Arzilli
585c711ce5
proc: when converting registers to slices set Base address (#2517)
If the base address isn't set then indexing and slicing will not work.
Large floating point registers already had the base set but small
general purpose registers did not.
2021-06-02 13:46:24 -07:00
Suzy Mueller
b2afb7cd20
pkg/proc: add support for hit count condition breakpoints (#2490)
* pkg/proc: implement support for hit count breakpoints

* update comment

* udpate hitcount comment

* update HitCond description

* add test for hit condition error

* respond to review

* service/dap: add support for hit count breakpoints

* use amendbps to preserve hit counts

* update test health doc

* fix failing test

* simplify hit conditions

* REmove RequestString, use name instead

* update backend_test_health.md

* document hit count cond

* fix tests
2021-05-28 11:21:53 -07:00
Hyang-Ah Hana Kim
0e5b81528f
dap: clean output executable name for windows (#2514)
If the output binary name does not end with .exe, it can't run on Windows
in noDebug mode. If user-provided output name doesn't have file extension
name (.exe), append it.

Fixes golang/vscode-go#1473
2021-05-27 14:23:32 -07:00