Commit Graph

2270 Commits

Author SHA1 Message Date
Alessandro Arzilli
0764cc3aa0
vendor: update version of go/packages to 0.1.11 (#3053)
The current version we use now crashes with go1.19:

https://github.com/golang/go/issues/45584
2022-07-05 10:04:48 -07:00
Alessandro Arzilli
ff3370e676
proc: fix arm64SwitchStack for go1.19 (#3038)
In commit eee6f9f82 Go changed the order that crosscall2 uses to save
its registers, update arm64SwitchStack to use the new order when the
binary was compiled by go 1.19.

Fixes #2993
2022-06-24 06:49:43 -07:00
Alessandro Arzilli
2d09ea65bc
dwarf/frame: discard indirect flag reading personality func in eh_frame (#3032)
We don't do anything with the personality function so there is no point
in complaining that we don't fully support the pointer encoding flags
used to describe it.

This matches the current level of support of pointer encodings in gdb
(they are discarded when reading the personality function and not
supported for FDEs because gcc doesn't generate them).

Fixes #3015
2022-06-24 06:49:18 -07:00
Alessandro Arzilli
76ecc53293
proc/native: fix Ctrl-C handling on non-headless instances on windows (#3039)
In non-headless instances Ctrl-C should pause the process, not
terminate it. To make this work on Windows we have to pass the
syscall.CREATE_NEW_PROCESS_GROUP flag to os.StartProcess.
2022-06-24 06:48:42 -07:00
Alessandro Arzilli
db3e5ef2cd
proc: map access with string literal key should always succeed (#3036)
When doing a map lookup with a string literal we should load as much of
the keys to at least match the length of the string literal, so that
the lookup doesn't fail with the "string too long" error.

Fixes #3034
2022-06-24 06:48:16 -07:00
zhsj
a501814a99
testcase: remove accidental debug binary (#3035) 2022-06-19 17:28:26 +02:00
Alessandro Arzilli
c412dcdc4f
*: run go1.19 'go fmt' on everything and fix problems (#3031)
Go 1.19 also formats doc comments according to the new godoc syntax.
Some of our comments, especially unexported symbols did not conform to
the godoc syntax and therefore are mangled by 'go fmt'.

This PR runs 'go fmt' from go1.19 on everything and manually fixes the
problems.

See also:
	https://github.com/golang/proposal/blob/master/design/51082-godocfmt.md
2022-06-17 10:08:11 -07:00
Alessandro Arzilli
2827145f1e
proc/gdbserver: ignore spurious stop packet from debugserver (#3021)
When we send an interrupt request to debugserver we, sometimes, get one
extra spurious stop packet back.
This stop packet gets interpreted as a response to a qThreadStopInfo request
we make causing the protocol to become desynchronized for a while, until
eventually some kind of error appears.

Here's an example of this problem, distilled from issue #3013:

     1 <- $vCont;c#a8
     2 <- interrupt
     3 -> $T05thread:12efb47;threads:12efb47,12efb8d,12efb8e,12efb8f,12efb90,12efb91;thread-pcs:10abe83,7ff81b20e2be,7ff81b20e3ea,...
     4 <- $qThreadStopInfo12efb8e#28
     5 -> $T05thread:12efb47;threads:12efb47,12efb8d,12efb8e,12efb8f,12efb90,12efb91;thread-pcs:10abe83,7ff81b20e2be,7ff81b20e3ea,...
     6 <- $qThreadStopInfo12efb8f#29
     7 -> $T00thread:12efb8e;threads:12efb47,12efb8d,12efb8e,12efb8f,12efb90,12efb91;thread-pcs:10abe83,7ff81b20e2be,7ff81b20e3ea,...
     8 <- $qThreadStopInfo12efb90#f4
     9 -> $T00thread:12efb8f;threads:12efb47,12efb8d,12efb8e,12efb8f,12efb90,12efb91;thread-pcs:10abe83,7ff81b20e2be,7ff81b20e3ea,...
    10 <- $qThreadStopInfo12efb91#f5
    11 -> $T00thread:12efb90;threads:12efb47,12efb8d,12efb8e,12efb8f,12efb90,12efb91;thread-pcs:10abe83,7ff81b20e2be,7ff81b20e3ea,...
    12 <- $qThreadStopInfo12efb47#f6
    13 -> $T00thread:12efb91;threads:12efb47,12efb8d,12efb8e,12efb8f,12efb90,12efb91;thread-pcs:10abe83,7ff81b20e2be,7ff81b20e3ea,...
    14 <- $qThreadStopInfo12efb8d#27
    15 -> $T05thread:12efb47;threads:12efb47,12efb8d,12efb8e,12efb8f,12efb90,12efb91;thread-pcs:10abe83,7ff81b20e2be,7ff81b20e3ea,...
    16 <- $p0;thread:12efb8e;#f5
    17 -> $T00thread:12efb8d;threads:12efb47,12efb8d,12efb8e,12efb8f,12efb90,12efb91;thread-pcs:10abe83,7ff81b20e2be,7ff81b20e3ea,...

response (3) is interpreted as the response to the vCont request at (1). We
then make a qThreadStopInfo request (4) and receive a stop packet in
response (5). Packet (5) is interpreted as the response to (4) but it
actually isn't, note how the thread ID is different, packet (5) is actually
a spurious stop packet sent by debug server. From response (5) onward the
protocol is desynchronized, none of the response we process are actually the
response to the preceding request.
This eventually causes a failure at packet (17) which debugserver sent as
the response to request (14) but we interpret as the response to (16).

Fixes #3013
2022-06-08 10:56:50 -07:00
Alessandro Arzilli
ac8720eb6e
service/test,proc: move variable evaluation test to pkg/proc (#3024)
Moves variable evaluation tests to pkg/proc which is where most of the
code they test exists, this also allows the removal of a bunch of
duplicate support code.
2022-06-08 08:59:42 -07:00
Alessandro Arzilli
ac81269eef
proc: fix prettyprint for register components with large values (#3022)
Fix pretty printing for CPU register components (created with the
XMM0.uintN syntax) while using format strings
Also fixes printing large literal constants with format strings.

Fixes #3020
2022-06-02 10:16:32 -07:00
Hyang-Ah Hana Kim
d05e88cca2
go.mod: use pseudo verion for github.com/go-delve/liner (#3026)
Fixes #3025
2022-06-02 17:56:28 +02:00
Joel Sing
9c5777e762
pkg/proc: fix and improve freebsd register handling (#3019)
* pkg/proc: convert freebsd ptrace code to cgo

There is little point in having cgo call a custom C function, when the same
can be done directly from cgo (with less code and effort). Split the amd64
specific code into ptrace_freebsd_amd64.go. Also avoid mixing C.ptrace()
with syscall.SYS_PTRACE.

This will make further changes easier - no functional change intended.

* pkg/proc: check return values of ptrace calls on freebsd

The return values of the PT_GETNUMLWPS and PT_GETLWPLIST ptrace calls were
previously unchecked. While these should not fail, panic instead of using
-1 with slice allocation/handling.

* pkg/proc: return *amd64util.AMD64Xstate from freebsd ptraceGetRegset

Return a pointer to a struct, rather than a struct - this simplifies the
code in both the caller and the ptraceGetRegset function, while also avoiding
struct copying.

* pkg/proc: fix floating point register setting on freebsd

The original code could never work - PT_SETREGS on freebsd does not
take an iovec, nor does it set FP registers. Furthermore, the xsave
bytes were not stored in the amd64util.AMD64Xstate struct.

Updates #3001

* pkg/proc: re-enable function call injection on freebsd

Floating point registers can now be set and restored correctly.

This is a partial revert of 51090f003bace1f8cc37b8480ffdb6f6cc91fa5a.

Fixes #3001

* pkg/proc: deduplicate register setting code on freebsd
2022-05-31 16:04:36 -07:00
Alessandro Arzilli
5b88e45ca9
proc/native: fix Windows build (#3023)
Commit b53fcbe broke the build on Windows, we didn't notice because 2d9a9d broke the test script.
2022-05-31 16:03:57 -07:00
Alessandro Arzilli
78471b3a5a
proc,service: represent logical breakpoints explicitly (#2946)
Adds a LogicalBreakpoint type to represent logical breakpoints
explicitly. Until now logical breakpoints were constructed implicitly
by grouping physical breakpoints together by their LogicalID.

Having logical breakpoints represented explicitly allows for a simpler
implementation of disabled breakpoints, as well as allowing a simple
implementation of delayed breakpoints (#1653, #2551) and in general of
breakpoints spanning multiple processes if we implement debugging
process trees (#2551).

Updates #1653
Updates #2551
2022-05-25 13:58:26 -07:00
polinasok
5bc8460328
dap: add MultiClientCloseServerMock and fix test shutdown leak (#3011)
Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com>
2022-05-18 10:33:06 -07:00
Fabio Falzoi
928e34d50f
pkg/terminal: Add auto-complete for local variables (#3004)
* pkg/terminal: fix typo in loadConfig comment

* pkg/terminal: add auto-complete for local variables

Fixes #2944

* pkg/terminal: use an empty config to load local vars

* pkg/terminal: cache loaded local vars until next command

* pkg/terminal: lazy loading of local vars trie
2022-05-18 09:18:28 -07:00
Alessandro Arzilli
c31040ba9e
proc: fix fatal throw breakpoint on go1.19 (#3009)
Also set breakpoint on runtime.fatal, which didn't exist before go1.19.

Updates #2993
2022-05-18 09:16:26 -07:00
polinasok
705ab206cd
dap: remote attach must not use terminateDebuggee in single-client launch mode (#2995) 2022-05-18 12:23:47 +02:00
Alessandro Arzilli
32bdd19f8f
proc/gdbserver: fix function call injection on rr (#3007)
Issue https://github.com/rr-debugger/rr/issues/3208 was fixed so finish
fixing call injection on rr and remove the test exception.
2022-05-17 09:19:34 -07:00
Alessandro Arzilli
b53fcbe43a
proc: fix RFLAGS corruption after call injection on amd64 (#3002)
debugCallV2 for amd64 has a bug where it corrupts the flags registers
every time it is called, this commit works around that problem by
restoring flags one extra time to its original value after stepping out
of debugCallV2.

Fixes #2985
2022-05-05 08:41:40 -07:00
Alessandro Arzilli
51090f003b
proc: fixes concerning call injection on freebsd and rr (#3000)
* Upgrade FreeBSD version

* proc: fixes concerning call injection on freebsd and rr

On FreeBSD it seems we have problems restoring and setting floating
point registers, since at least restoring is necessary for call
injection to function properly fully disable call injection on FreeBSD.

On rr the same problem exists, however due to the fact that we are
acting on a recording and ending a diversion will restore register
values anyway simply disable the floatsum test.

See also: https://github.com/rr-debugger/rr/issues/3208

Updates #3001
2022-05-05 08:39:54 -07:00
Alessandro Arzilli
10332d6700
Documentation: document substitute-path more (#2998)
Add FAQ entry about substitute-path since it comes up often and link it
in the issue template.
2022-05-04 11:01:56 -07:00
Alessandro Arzilli
55e37e2fc8
proc/core: return true for calls to Recorded (#2979)
The recent refactoring that introduced ContinueOnceContext broke this old behavior.

Fixes #2978
2022-05-04 10:56:41 -07:00
Alessandro Arzilli
c9d800edb9
proc: support function call injection on arm64 (#2996)
* _scripts/test_linux.sh,_scripts/test_windows.ps1: always return exit code 0 when testing on tip

Same as what we do for test_mac.sh

* proc: support function call injection on arm64

Support function call injection on arm64 with go1.19
2022-05-03 10:46:24 -07:00
polinasok
d513b6da45
Documentation: add DAP launch/attach configuration matrix (#2991)
Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com>
2022-05-03 10:35:56 -07:00
Alessandro Arzilli
2d9a9d439d
_scripts/test_linux.sh,_scripts/test_windows.ps1: always return exit code 0 when testing on tip (#2997)
Same as what we do for test_mac.sh
2022-05-03 10:35:24 -07:00
Alessandro Arzilli
9d269791d5
proc: fix autogenerated helper skip on linux/386 PIE builds (#2975)
The fix in #2959 was incomplete and the skip was still broken on
linux/386 for PIE builds due to calls to the get_pc_thunk helper.

Co-authored-by: a <a@kra>
2022-04-27 09:11:08 -07:00
Alessandro Arzilli
bfb7181e8d
_scripts: always return exit code 0 when testing on tip (#2980)
So that we can mute failing tests in TeamCity.
2022-04-27 09:10:23 -07:00
Joel Sing
5b16ddb7e2
proc: unlock OS thread on exit from handlePtraceFuncs (#2972)
On FreeBSD and OpenBSD, the use of runtime.LockOSThread is resulting in segfaults
within the Go runtime (see https://github.com/golang/go/issues/52394) - while it
should not be necessary, calling runtime.UnlockOSThread upon exit from
handlePtraceFuncs avoids this issue and allows the tests to run correctly.
2022-04-26 14:33:16 -07:00
Alessandro Arzilli
7ab33ac92f
service/debugger: close executable file (#2976)
Close executable file after we open it.
2022-04-26 14:32:22 -07:00
Joel Sing
c120db3467
proc: add support for setting additional registers on freebsd/amd64 (#2981)
These are needed for delve to work on freebsd/amd64 with regabi.
2022-04-26 14:31:48 -07:00
Joel Sing
9319cc34c9
service/debugger: make TestDebugger_LaunchWithTTY pass on FreeBSD (#2982)
FreeBSD does not have lsof, rather it has fstat. Additionally, the TTY name
does not match up with the current code.
2022-04-26 13:23:39 -07:00
Derek Parker
4009153466
v1.8.3 (#2990) 2022-04-26 09:33:28 +02:00
polinasok
4a91946fd9
v1.8.3 Changelog (#2988)
Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com>
2022-04-25 09:04:42 -07:00
polinasok
5d37d8254b
Documentation: expand DAP launch/attach configurations section (#2977)
* Documentation: expand DAP launch/attach configurations section

* Fix link

* Fix link

Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com>
2022-04-21 14:25:32 -07:00
Adrien Barreau
aac4e19c24
Documentation: Fix example block in cli README (#2974) 2022-04-19 11:35:54 -07:00
Alessandro Arzilli
75b4421d70
_scripts/make: do not exit if git SHA ID can not be retrieved (#2973)
Something changed in TeamCity's infrastructure that makes 'git
rev-parse HEAD' fail systematically on most configurations.
Since the SHA ID isn't necessary anyway, print an error and continue.
2022-04-18 10:47:44 -07:00
Alessandro Arzilli
3138157826
proc: skip autogenerated functions correctly (#2959)
Adjust heuristic used to skip autogenerated functions so that it works
correctly with the new naming scheme in go1.18.

Fixes #2948
2022-04-13 15:28:56 -07:00
polinasok
a5532eb985
dlv dap: pass disable-aslr to backend (#2965)
Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com>
2022-04-12 14:20:22 -07:00
Alessandro Arzilli
362522c6e6
gobuild: drop support for building on Go < 1.10 (#2960)
Remove code to build on old versions of Go that didn't support the all=
query for -gcflags.
2022-04-06 12:02:21 -07:00
polinasok
1669711c0e
Documentation/api/dap/README: add dlv dap usage link (#2957)
Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com>
2022-04-04 12:02:43 -07:00
4ricci
3917104f7a
CHANGELOG.md: fix date typos (#2956) 2022-04-04 09:18:25 +02:00
polinasok
0b71eeca40
proc/gdbserial: shut down debuggee when failing to debug (#2953)
Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com>
2022-04-01 10:31:23 -07:00
polinasok
6c368b78a9
debugger: clarify no debug info errors (#2954)
* debugger: clarify no debug info errors

* Fix typo

Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com>
2022-04-01 10:31:03 -07:00
polinasok
65e03d673d
dlv_test: fix TestChildProcessExitWhenNoDebugInfo to actually test strip binary (#2949)
Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com>
2022-03-29 11:01:04 -07:00
Alessandro Arzilli
97405bbdd9
proc: allow low index == len in reslice (#2951)
Fixes #2950
2022-03-29 09:57:11 -07:00
Alessandro Arzilli
2b97231e30
proc,service: pretty print time.Time variables (#2865)
Fixes #999
2022-03-25 13:59:57 -07:00
cui fliter
9a9c1a9f33
*: fix some typos
Signed-off-by: cuishuang <imcusg@gmail.com>
2022-03-23 16:10:00 +01:00
Derek Parker
cdf73b5365
Prefer locspec to linespec (#2941)
Often in the CLI documentation we were to inputs as linespec
when in reality we mean locspec which is a
location specifier, not necessarily a
line specifier.
2022-03-23 15:12:40 +01:00
polinasok
b5f60db954
service/dap: support terminateDebuggee option for attach only (#2940)
* service/dap: support terminateDebuggee option for attach only

* Update dlv_test

Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com>
2022-03-22 07:19:56 -07:00