Commit Graph

2731 Commits

Author SHA1 Message Date
Derek Parker
689c86355b
pkg/terminal: allow postfix if for breakpoint conds (#3693)
Allows for a user to specify the breakpoint condition directly
when creating the breakpoint. The new syntax looks like the
following:

```
break <name> <locspec> [if <expression>]
```

Also updates docs to include more examples and locspec description
instead of directing users to the online / source documentation.
2024-04-09 15:15:38 +02:00
Alessandro Arzilli
bbcea6b9f4
proc: support reading captured variables of closures (#3682)
Supports showing captured variables for function closures on versions
of Go that export informations about the closure struct (Go >= 1.23)

Fixes #3612
2024-04-07 21:36:50 -07:00
Derek Parker
6f1f549c71
pkg/proc: defend better against missing DWARF (#3695)
The `scope.Locals` function did not have any guard checks against missing DWARF information.
This patch adds a check, which likely will need to be added to other functions as well.
2024-04-05 11:46:39 +02:00
Alessandro Arzilli
bae4dfbc4c
proc,go.mod: update x/sys remove KeepAlive calls (#3680)
* Cirrus-CI: update to FreeBSD 13.3

* proc,go.mod: update x/sys remove KeepAlive calls

Update version of golang.org/x/sys to the latest version and remove
calls to runtime.KeepAlive calls that were added to the FreeBSD backend
to work around an issue in the version of x/sys that we were using.
2024-03-04 11:36:46 -08:00
Alessandro Arzilli
40b58f9643
proc: catch panics when reading debug info for stripped executables (#3678)
Adds a recover to the functions reading debug info from the go runtime
data structures for stripped executables.

This function is best-effort and can sometimes fail in weird ways,
instead of crashing recover any panic and turn them into errors.

Fixes #3650
2024-03-04 09:17:12 -08:00
Oleksandr Redko
fdb732b54e
dwarf/loclist: remove impossible condition (#3677) 2024-03-04 09:15:54 -08:00
Alessandro Arzilli
dd6173a90d
Cirrus-CI: update to FreeBSD 13.3 (#3679) 2024-03-04 09:15:21 -08:00
Oleksandr Redko
649e61e415
proc/evalop: remove no longer needed old Go files (#3676) 2024-03-04 09:15:00 -08:00
Derek Parker
d688d4c83b
pkg/terminal: print breakpoint number on stop (#3675) 2024-02-28 15:49:33 +01:00
Derek Parker
29aa2ea8c9
pkg/terminal,pkg/proc: Implement next-instruction (#3671)
The next-instruction (nexti) command behaves like
step-instruction (stepi) however, similar to the
`next` command it will step over function calls.
2024-02-28 09:28:33 +01:00
Suzy Mueller
5a9b835406
*: Upgrade github.com/google/go-dap (#3673) 2024-02-27 09:52:40 -08:00
Alessandro Arzilli
490869e75f
elfwriter: add WriteSectionHeaders (#3666)
Add ability to write out section headers to elfwriter.
2024-02-23 14:14:28 -08:00
Alessandro Arzilli
5bd835a801
*: misc fixes for go1.23 (#3663)
- skip staticcheck on go1.23 for now
- fix reading interface values in go1.23
- sync list of waitreasons from go1.23
2024-02-22 11:35:15 -08:00
Alessandro Arzilli
ff2f69343e
dwarfbuilder: fix makeAbbrevTable (#3665)
It did not terminate the section with the required 0 byte.
2024-02-22 11:33:44 -08:00
Alessandro Arzilli
26799555e5
*: release version 1.22.1 (#3662)
Thank you @ardnew, @muggle-nil, @michaelmerg
2024-02-21 12:29:06 -08:00
Derek Parker
4a72c523be
pkg/proc: remove usage of gore dependency (#3664) 2024-02-21 12:10:41 +01:00
Alessandro Arzilli
f32818c9e3
cmd/dlv: fix --continue with unix domain sockets (#3658)
Fixes #3657
2024-02-13 10:14:38 -08:00
Michael Merg
19004d9f83
Don't use a fixed width for s when parsing /proc/net/tcp lines (#3660)
If /proc/net/tcp contains a large number of entries (>9999), parsing lines with len(sl) > 4 fails with the fixed width pattern. In that case the lines are silently ignored.
2024-02-13 10:14:07 -08:00
Derek Parker
f9b427b6db
*: update gore (#3659) 2024-02-13 08:12:59 +01:00
Alessandro Arzilli
8df2b6bedb
terminal: add prompt color option (#3648)
Add option to configure prompt color.

Fixes #3603
2024-02-07 11:07:11 -08:00
Alessandro Arzilli
9405996b5d
terminal: add color highlighting to stacktraces (#3649)
Adds configurable highlighting for function names and filenames in stack traces.

Fixes #720
2024-02-07 11:06:30 -08:00
Alessandro Arzilli
4f5b74a651
cmd/dlv: support unix domain sockets (#3655)
Add support for listening on a unix domain socket in headless mode and
in the 'connect' command.

Fixes #3654
2024-02-07 11:04:45 -08:00
Alessandro Arzilli
f2b3b18ca7
service/dap: support waitfor option for 'dap attach' only (#3656)
Add a waitfor option for 'dap attach' that waits for a process with a
given name to appear before attaching to it.

This recovers PR #3584, originally by @muggle-nil, which was fine
except for a broken test.
2024-02-07 11:03:36 -08:00
Derek Parker
efaf5523d8
*: update go-delve/gore (#3646) 2024-01-25 08:09:28 +01:00
Derek Parker
1607bdfa4d
*: remove accidentally committed binary (#3645) 2024-01-24 19:15:35 +01:00
Alessandro Arzilli
6cd0b70b30
proc: if a reslice operator is used load the whole slice (#3623)
When the users uses a reslice operation load the whole resliced
variable, ignoring the MaxArrayValues setting.
Only apply this when the 'high' part is specified and a literal and the
'low' part is either unspecified or a literal.

Fixes #3600
2024-01-24 09:21:59 -08:00
Alessandro Arzilli
ef20fbbf12
proc/gdbserver: clean up rr directory on detach (#3570)
We used to autoremove the trace recorded by rr but as a result of
various refactorings done to implement follow exec mode this broke.
Restore the functionality.

Also remove the _fixtures/testfnpos.go file which is autogenerated
during testing.
2024-01-24 09:21:20 -08:00
Alessandro Arzilli
0d35295491
proc: skip TestDebugStripped on development versions of Go (#3642)
The test can never work on development versions of Go.
2024-01-24 09:18:51 -08:00
Alessandro Arzilli
fb4a8fb171
evalop: fix name of executeOp function in test (#3643) 2024-01-24 09:18:18 -08:00
Alessandro Arzilli
4b2612a6b3
service/dap: make TestEvaluateCallFunction independent of line numbers (#3644)
_fixtures/fncall.go was made to support TestCallFunction in pkg/proc
and new things must be added to fncall.go to test new features. Having
a test depend on precise line numbers makes the process tedious.
2024-01-24 09:17:56 -08:00
Alessandro Arzilli
664bd95d24
proc/native: add support sentinel for FreeBSD with cgo disabled (#3636)
Adds a support sentinel file for building on FreeBSD with cgo disabled.
Makes the build error for FreeBSD easier to understand.

Fixes #3630
2024-01-19 12:05:53 -08:00
ardnew
dab870bd96
make.go: do not recodesign when rebuilding (#3639) 2024-01-19 11:51:22 -08:00
Alessandro Arzilli
1b201c3184
proc/native: remove dead code in nonative_darwin.go (#3637)
Removes unnecessary code from nonative_darwin.go
2024-01-17 16:31:27 -08:00
Alessandro Arzilli
4ed69d0280
proc: fix stacktrace frame after runtime.sigpanic (#3638)
The first frame after sigpanic didn't execute a call so we shouldn't
decrement the PC address to look up its location.

Fixes #3634
2024-01-17 16:31:04 -08:00
Alessandro Arzilli
88380654fe
proc: fix dynamic library loading with musl loader (#3621)
With the glibc loader the link map entry for the static executable has
an empty name field and address equal to 0x0. This case was already
handled by the check in bininfo.go AddImage for names to be valid
paths.
With the musl loader however the first entry, corresponding to the
static executable, has a valid path with address equal to 0x0, since we
record a real address for the image corresponding to the static
executable this results in having two entries for the executable when
musl is used to link go programs.

Change the code scanning the debug link map so that the first entry is
skipped if it has address equal to zero.

Fixes #3617
2024-01-10 07:33:35 -08:00
Alessandro Arzilli
bf627d0f7d
proc: fix TestCondBreakpointWithFrame flakes on 1.22rc1 (#3624)
The flake manifests as an error where the variable i can not be found in
frame 1 and happens in go1.22rc1 between 0.1% and 0.5% of the time (it is highly dependent on CPU contention)
This problem is caused by the new code in evalop.PushLocal referencing the
stale value of SelectedGoroutine. This happens because:

-  evalop.PushLocal calls ConvertEvalScope
- ConvertEvalScope calls FindGoroutine
- FindGoroutine checks the value of selectedGoroutine

When breakpoint conditions are evaluated both the value of selectedGoroutine
and currentThread are stale because we can only set their definitive value
*after* all breakpoint conditions have been evaluated.

The fact that it only happens in 1.22rc1 is coincidental, it's probably
caused by the fact that 1.22rc1 migrates goroutines between threads more in
this particular circumstance.

This commit fixes the problem in two ways:

1. selectedGoroutine and currentThread are given temprorary non-stale values
   before breakpoint conditions are evaluated
2. evalop.PushLocal is changed so it takes a stack trace of the current
   thread rather than resolving it through the selected goroutine.

Either one would suffice however I think we should do both, (2) ensures that
the runtime.frame(n).var will work even if the current thread is not running
any goroutine and (1) ensures that we don't accidentally reference a stale
selectedGoroutine in the future.
2024-01-10 06:53:16 -08:00
Alessandro Arzilli
f8de498d77
terminal: add paging to print, vars, args and locals (#3620)
Add automatic paging to the output of print, vars, args and locals.

Fixes #3615
2024-01-09 14:13:37 -08:00
Alessandro Arzilli
1a1e215fac
TeamCity: speed up ppc64le CI (#3622)
The builder is currently spending 15 to 20 minutes installing gcc and
upgrading packages every time we run the tests.
Because of this the build fails sometimes by running out of time.
This change reduces that to 5 minutes by:

* switching from curl to wget (which seems to have fewer dependencies)
* not installing gcc on ppc64le
* skipping tests that depend on gcc or other binutils
2024-01-09 14:13:00 -08:00
Alessandro Arzilli
ae715a2b2d
Documentation: document runtime.frame(n).varname (#3625) 2024-01-06 21:10:19 -08:00
Alessandro Arzilli
3372f5ce5a
go.mod: Update version of go-delve/liner (#3619)
Update version of go-delve/liner to include the Ctrl-Z fix (SIGTSTP
should be sent to our process group instead of just sending it to
ourselves to correctly imitate a terminal).

Fixes #3605
2024-01-02 20:12:30 -08:00
Alessandro Arzilli
e590789bba
Cirrus-CI: update FreeBSD version (#3618)
It looks like FreeBSD 12 is no longer available
2024-01-02 20:12:04 -08:00
Alessandro Arzilli
31a3c0de97
*: release version 1.22.0 (#3606)
Thank you @alexandear, @stefanhaller, @testwill
2023-12-29 14:48:07 -08:00
Derek Parker
050a108c3c
*: Update gore dep for 1.22 (#3611) 2023-12-27 18:28:56 +01:00
Alessandro Arzilli
ba403e365d
proc: fix TestPackageRenames on go1.22 on linux/386 (#3610) 2023-12-26 10:17:25 -08:00
Alessandro Arzilli
e80e401c7e
service/dap: fix close on closed channel (#3609)
This fixes an infrequent close on closed channel panic in service/dap
caused by a race condition with closing a channel.
2023-12-26 10:16:52 -08:00
Alessandro Arzilli
a9c67f1548
goversion: include pre-releases in VersionAfterOrEqual check (#3607)
Change VersionAfterOrEqual(x, A, B) to return true for pre-releases of
version A.B. This is what it did before, it was broken when goversion
was changed to support the new version format.
2023-12-26 10:15:43 -08:00
Alessandro Arzilli
5b52958909
proc: fix ppc64 arch name check (#3608)
The name of the ppc64 architecture is ppc64le not ppc64.
2023-12-26 10:14:27 -08:00
Alessandro Arzilli
66fbe30586
teamcity,version: add 1.22 to supported versions and CI matrix (#3601) 2023-12-20 15:31:30 -08:00
Alessandro Arzilli
57dad9342a
proc: make some type casts less counterintuitive
* proc: make some type casts less counterintuitive

The interaction of type casts with load configuration is sometimes
counterintuitive. This commit changes the way it is performed so that
when converting slices to strings and vice versa the maximum size
corresponding to the target type is used (i.e. MaxStringLen when
converting slices to strings and MaxArrayValues when converting slices
to strings).

This doesn't fully solve the problem (conversions to []rune are
problematic and multiple chained type casts will still be confusing)
but removes the problem for the majority of practical uses.

Fixes #3595, #3539
2023-12-12 11:43:41 -08:00
Derek Parker
dda8f693e6
*: Use forked goretk/gore module (#3597)
This allows us to update this dependency on our schedule which is important because the module relies on manually updating the known list of Go versions to function correctly. Forking allows us to keep this up to date ourselves and possibly create a new system to prevent having to perform this manual step in the future.
2023-12-12 10:13:32 +01:00