Commit Graph

878 Commits

Author SHA1 Message Date
Quim Muntal
e5006c105c
Test windows/arm64 pipeline (#3200)
* Test windows/arm64 pipeline

* update build script to support windows/arm64

* skip TestLaunchRequestWithRelativeExecPath is symblink can't be created

* partially fix and skip TestCgoStacktrace

* update backend health docs

* update

* log test output

* skip starbind test on windows arm64

* skip starbind test on windows arm64

* skip rtype test on windows arm64

* skip pie backend tests on windows/arm64

* fix tests

* skip function calls test on windows/arm64

* fix tests

* revert hardware breakpoint test relax

* add pie test clarification

* skip symlink test only on windows

* skip TestStepConcurrentDirect

* readd exp.winarm64

* fix param

* add exp.winarm64 tags

* skip TestGeneratedDoc on winarm64
2022-12-05 15:21:52 -08:00
Alessandro Arzilli
5ca60a81e8
proc: extend macOS workaround to amd64 (#3204)
Go change 064f34f (which exists in Go 1.19.2 and following) removed the
pagezero_size option from linker calls (because it is deprecated). This
expanded the problem that exists on darwin/arm64 as well as PIE builds
on darwin/amd64 to all darwin/amd64 builds.

This problem is described on: https://github.com/golang/go/issues/25841.

This commit extends the darwin/arm64 workaround to darwin/amd64.

Fixes #3194
2022-12-05 09:46:24 -08:00
Alessandro Arzilli
56eed898ec
proc/gdbserver: set child process pgrp as foreground group (#3205)
Newer versions of debugserver (which contain [1]) will spawn the target
process on a new process group, when we detect that this happen, and we
are a headless instance and stdin is a tty, make the child process'
process group the controlling group for the terminal.

 [1] https://reviews.llvm.org/rG33ac4fddc7906ba712c50cd3a9b02ae041d751ab
2022-12-05 09:38:00 -08:00
Alessandro Arzilli
b9a8bd7f41
*: early fixes for go1.20 (#3180)
- updated go/packages to support new export format
- rewrite testinline.go fixture because the compiler got too smart with
  constant folding
- temporarily disable staticcheck on go1.20 because it doesn't support
  the new export format.
- workaround for go.dev/cl/429601
2022-12-05 09:02:22 -08:00
Quim Muntal
f439987f14
G struct offset is a pointer to an offset since go1.20 (#3196) 2022-11-16 09:44:27 -08:00
Alessandro Arzilli
d15c86e0cf
proc: prefer addresses when setting a breakpoint (#3193)
If a breakpoint has both a list of addresses and an expression prefer
the list of addresses, otherwise it is impossible to set breakpoint
with expressions that depend on the current scope, like 'break +0'
which sets a breakpoint on the current line.
2022-11-16 09:31:33 -08:00
Derek Parker
18ebd9195a
pkg/proc: fix arm64 linux cgo stacktrace (#3192)
This patch introduces some changes, particularly to arm64SwitchStack
which fixes the test when running on linux/arm64. The changes causes the
same test to fail on darwin/m1 so temporarily keeping both versions.
Next step should be to refactor and unify the two so they both work with
the same function.

Fixes #2340
2022-11-15 09:05:43 +01:00
Alessandro Arzilli
824e0a81e8
Two fixes to type cast evaluation (#3186)
* proc: allow casts form unsafe.Pointer to any pointer and vice versa

We've allowed doing this with uintptr but we should allow
unsafe.Pointer to be used like Go uses it.

* proc: fix type casts to ptr-to-ptr types

Fix type casts to **type.
2022-11-10 09:53:28 -08:00
Daniel Lipovetsky
c7fa713c34
bininfo: Log when the file listed in .gnu_debuglink is not found (#3188) 2022-11-10 09:41:42 -08:00
Aviram Hassan
350dd6afe3
proc/gdbserial/gdbserver: Don't pass DYLD_INSERT_LIBRARIES to debugserver (#3181)
Filter out DYLD_INSERT_LIBRARIES on Darwin when launching debugserver.
This is needed since macOS Ventura, loading custom dylib into debugserver
using DYLD_INSERT_LIBRARIES leads to a crash.
This is unlike other protected processes, where they just strip it out.
2022-11-07 15:26:10 -08:00
Alessandro Arzilli
cba16f92e8
proc: fix index access to already-loaded string values (#3184)
Fixes #3176
2022-11-07 15:22:12 -08:00
Derek Parker
b072f61bf8
service/debugger: Assume current dir for exec (#3167)
This patch modifies the behavior of the exec subcommand such that
you don't necessarily have to write the "./" prefix when trying
to debug a precompiled binary in your working directory.

For example (given foo.test in working dir), before this change:

dlv exec foo.test

Would result in an error, forcing the user to type:

dlv exec ./foo.test

This just makes things a bit more convenient.
2022-10-28 14:59:09 +02:00
Derek Parker
63ef73a0dd
pkg/terminal: Improve error when unable to read history file (#3169)
This patch includes the path to the history file itself so that
users can better fix the issue when an error arises.

Fixes #3168
2022-10-28 14:42:06 +02:00
Alessandro Arzilli
beaa04604a
proc/native: acquire debug programs privilege on Windows (#3162)
On Windows we need to acquire the SeDebugPrivilege privilege to be able
to debug programs owned by different users.
See:

https://learn.microsoft.com/en-us/windows-hardware/drivers/debugger/debug-privilege

This procedure will fail if the current user does not have this
privilege so do not complain too much about it.

Fixes #3136
2022-10-10 11:01:25 -07:00
cui fliter
7d2cf11550 pkg: fix a few function names on comments
Signed-off-by: cui fliter <imcusg@gmail.com>
2022-10-05 17:40:35 +02:00
Alessandro Arzilli
cd8cf3b1b7
proc: disable TestCGONext on darwin/amd64 (#3160)
Until it is investigated.
2022-10-05 07:07:43 -07:00
Alessandro Arzilli
b5d05bbac5
proc: remove import "C" for linux/386 backend (#3159)
It is actually unused.
2022-10-05 07:06:02 -07:00
Alessandro Arzilli
6e7e1d8830
proc,terminal: allow setting suspended breakpoints (#3154)
Allows setting suspended breakpoints and try to enable them
automatically after every time a plugin is loaded.

Fixes #1653
Updates #2551
2022-10-04 08:07:05 -07:00
Alessandro Arzilli
6bda7085c7
proc: allow type casts between compatible types (#3149)
Go allows some type casts when the underlying types are the same.
Conform to that behavior.

Fixes #3130
2022-09-29 10:08:19 -07:00
Alessandro Arzilli
02d46b059e
proc: remove old method to resolve the type of an interface to a DIE (#3150)
Before 1.11 we used to read a bunch of runtime structures to determine
the runtime type of an interface variable. This had significant
dependencies on private structs of the Go runtime and the code is
broken for versions of Go after 1.17.
Remove all this code, since it is no longer used and doesn't work with
newer versions of Go anyway.
2022-09-29 10:06:15 -07:00
Alessandro Arzilli
ec5fcc07fe
proc,service/debugger: track how breakpoints were originally set (#3148)
Adds field to breakpoint struct to track how a breakpoint was
originally set, moves the logic for disabling and enabling a breakpoint
to proc.
This will allow creating suspended breakpoints that are automatically
enabled when a plugin is loaded. When follow exec mode is implemented
it will also be possible to automatically enable breakpoints (whether
or not they were suspended) on new child processes, as they are
spawned.

It also improves breakpoint restore after a restart, before this after
a restart breakpoints would be re-enabled using their file:line
position, for breakpoints set using a function name or a location
expression this could be the wrong location after a recompile.

Updates #1653
Updates #2551
2022-09-28 11:35:07 -07:00
Alessandro Arzilli
a73eaeffd2
proc,service: change FindLocation to work with multiple targets (#3103)
Changes FindLocation to support multiple targets and adds an AddrPid
member to api.Breakpoint so that clients can set breakpoints by address
when multiple targets are connected (but at them moment this field is
ignored).

Updates #1653
Updates #2551
2022-09-26 10:12:34 -07:00
Alessandro Arzilli
4372ce0d27
proc,_scripts/rtype.go: add rtype annotations for g.atomicstatus (#3143)
Adds some rtype annotations for g.atomicstatus and update
_scripts/rtype.go to handle types outside of the runtime package.
2022-09-26 10:10:51 -07:00
Alessandro Arzilli
1effee3576
proc: fix openSeparateDebugInfo backwards compatibility path (#3145)
Fix openSeparateDebugInfo backwards compatibility path to actually be
backwards compatible.
2022-09-26 10:09:06 -07:00
Alessandro Arzilli
b0ac6db339
proc: fix cast to empty interface type (#3146)
Fix cast to empty interface type. This is a workaround for a
discrepancy between how type names are serialized by the compiler vs
how type expressions are formatted by go/printer.
2022-09-26 10:08:01 -07:00
Alessandro Arzilli
c6447e1cee
proc/native: fix support_sentinel_darwin.go name (#3147)
The file incorrectly contains a space, which means it does nothing
besides breaking 'make build'.
2022-09-26 10:05:04 -07:00
Quim Muntal
4455d6a9ef
Add support for windows/arm64 (#3063)
* Add support for windows/arm64

* split sentinel files and add winarm64 experiment

* update loadBinaryInfoPE to support PIE binaries

* skip TestDump on windows/arm64

* run windows/arm64 compilation on windows/amd64

* add entry point check for pie binaries

* delete unusded code

* document windows/arm64 breakpoint

* implement changing windows/arm64 fp registers

* update crosscall offset names

* fix G load when using CGO

* fix testvariablescgo

* remove DerefGStructOffset

* derefrence gstructoffset in GStructOffset() if necessary
2022-09-21 13:39:44 -07:00
Alessandro Arzilli
1add32b4d9
terminal: do not use WaitSince as unix time (#3139)
g.waitsince is the output of runtime.nanotime and represents a
monotonic clock which can not be converted directly into unix time. A
better fix would be to convert it to a time.Duration by reading the
current value of runtime.nanotime. This is complicated, however,
because on some systems (for example macOS) the current value of
runtime.nanotime can only be read by making a system call.

Updates #3137
2022-09-20 13:05:57 -07:00
cui
5ebf020be9
proc: fix hang caused by g.atomicstatus has change to atomic.Uint32 (#3129)
Co-authored-by: weixiecui <weixiecui@futunn.com>
2022-09-20 11:54:56 -07:00
cui
9bcccf81ed
proc: reduntant type conversion (#3131)
Co-authored-by: weixiecui <weixiecui@futunn.com>
2022-09-09 16:16:07 +02:00
Alessandro Arzilli
b19d67ccf2
terminal: remove leftover GOPATH references (#3117)
Remove leftover references to $GOPATH in documentation, change script
that generates markdown documentation to look for substrings that start
with "Documentation/" instead.
2022-08-30 10:12:19 -07:00
Frederick Zhang
e2ec3eb633
Documentation: reverse step, next and stepout (#3119)
These were implemented in [1].

[1] https://github.com/go-delve/delve/pull/1785
2022-08-24 16:27:07 +02:00
Derek Parker
d9d8f4ad8c
v1.9.1 (#3116) 2022-08-23 08:35:35 +02:00
Alessandro Arzilli
81781522c3
proc: make sure logical breakpoints map exists (#3115)
The logical breakpoints map was created as a side effect of
createUnrecoveredPanicBreakpoint or createFatalThrowBreakpoint, however
with an executable with incomplete debug info (that must be incomplete
in just the right way) both will fail and the logical breakpoint map
will never be created.

It's unknown how such an executable could be created, one easy way is
to debug a non-go executable.

Fixes #3114
2022-08-22 12:48:34 -07:00
Alessandro Arzilli
dc76cc250d
go.mod: update starlark dependency (#3112)
Fixes issue where Delve fails to start if starlark can not allocate a
large amount of memory at startup.

Fixes #2907
2022-08-22 12:46:26 -07:00
Alessandro Arzilli
cb91509630
terminal: send large output to pager (#3060)
For commands that could produce large amounts of output switch to a
pager command ($DELVE_PAGER, $PAGER or more) after a certain amount of
output is produced.

Fixes #919
2022-08-17 09:02:53 +02:00
Alessandro Arzilli
5b9f65dac2
*: switch to int64 for goroutine IDs (#3110)
Go 1.20 switched to uint64 to represent goroutine IDs, we can't
actually follow suit because we have allowed clients to use -1 to refer
to the currently selected goroutine, however we should at least switch
to int64 and also update the rtype check to accept the 1.20 type.
2022-08-16 09:31:11 -07:00
Alessandro Arzilli
0c09fc9bdd
proc: use stdlib to compute CRC for gnu_debuglink section (#3105)
The standard library package has a the CRC algorithm used for
gnu_debuglink, use that instead of our own implementation.
2022-08-16 11:08:53 +02:00
Alessandro Arzilli
97a7455192
_scripts: fix CI on go1.19/linux/386 (#3100)
Go 1.19 is broken on linux/386 with some C compilers, this is a
workaround for our build script. See:

https://github.com/golang/go/issues/52919

Also fix TestBuild if the first message reported by delve is not the
message that indicates the server is listening.
2022-08-15 09:40:25 -07:00
Ruijie Chen
20df19e33b
service/dap: Add support for empty string in substitutePath (#3088)
This changes adds the support to replace relative paths sources with "" as rapresenting current directory.
For example:
Rule like '{from: "", to: "/my/project"}' will map path "src/my/code.go" into "/my/project/src/my/code.go"
Rule like '{from: "/my/project", to: ""}' will map path "/my/project/src/my/code.go" into "src/my/code.go"

Fixes #3082
2022-08-14 16:01:39 +02:00
Alessandro Arzilli
f82d225bdb
proc: fuse evalToplevelTypeCast and evalTypeCast (#3057)
We allowed integer and pointer type casts everywhere but type casts to
string, []byte and []rune only at toplevel.
Fuse evalToplevelTypeCast and evalTypeCast and allow both kinds
everywhere. There are multiple other ways to create variables than
don't reference user memory anyway (which wasn't the case back when
evalToplevelTypeCast was implemented).

Fixes #1423
2022-08-11 13:13:55 +02:00
Alessandro Arzilli
3de29a88f8
proc: do not panic reading bad G struct (#3098)
Fixes #3095
2022-08-09 10:02:55 -07:00
Alessandro Arzilli
65d5eb7380
TeamCity,goversion: bump test matrix (#3092)
Add Go 1.19 to test matrix, drop 1.16.
2022-08-05 12:04:26 -07:00
Derek Parker
b83ea0c2fa
pkg/dwarf/line: Fix parsing file table for DWARFv5 (#3090)
As we parse this informatin in the loop we must take care to assemble
things correctly. In this situation when we encounter a file name,
the dir index is -1, then subsequently we get the correct dir index
for that file and can put them together. Previously we were adding the
file and then the directory location to the file list instead of
correctly concatenating them, resulting in an incorrect file list making
indexing into the list return incorrect results later on.
2022-08-05 19:16:38 +02:00
Derek Parker
be08778975
:* Improve trace subcommand output (#3091)
This patch improves the output of the trace subcommand by
adding better line breaks, adding goroutine info to the
return statement, and removing unnecessary output.
2022-08-04 10:10:54 +02:00
Alessandro Arzilli
d17c5e155a
Documentation: fix documentation of examinemem (#3087)
The 'addr' option was removed during review and doesn't exist.

Fixes #3086
2022-08-01 09:03:48 -07:00
Quim Muntal
ae55d84279
fix StepInstruction on 1 byte instruction with a software breackpoint (#3084) 2022-08-01 09:03:19 -07:00
Derek Parker
5c5fca4849
pkg/proc/internal/ebpf: Fix handling of entry / return (#3081)
This patch removes the old error-prone way of tracking
whether the tracepoint is for a function entry or
return. Instead of trying to guess, let the data structure
simply tell us directly.
2022-07-29 12:00:32 +02:00
Derek Parker
36b35aad00
pkg/proc/internal/ebpf: Fix size of ebpf type for fn_addr (#3080)
Must have been an issue overlooked in the initial implementation but
we should be using a 64-bit wide type to store the function address.
2022-07-28 11:30:08 +02:00
Quim Muntal
6ad3169719
proc/native: refactor windows framework (#3079) 2022-07-27 18:36:34 +02:00