Commit Graph

66 Commits

Author SHA1 Message Date
Álex Sáez
71f1220717
*: add ppc64le support (#2963)
* Add vendor/golang.org/x/arch/ppc64

* Add ppc64le support
2023-07-07 09:30:38 -07:00
Alessandro Arzilli
7d8f47674b
terminal/starbind: add online help for starlark (#3388)
Adds a new starlark builtin 'help' that prints the list of available
builtins when called without arguments and help for the specified
builtin when passed an argument.

The help is autogenerated from godoc comments so it isn't always
exactly accurate for starlark (in particular we sometimes refer to the
In structs), but it's better than nothing.
2023-06-12 14:31:31 -07:00
Oleksandr Redko
9d6bce467c
_scripts: fix typos (#3402) 2023-05-31 16:33:23 +02:00
Alessandro Arzilli
674bd63996
proc: fix runtime type handling for Go 1.21 (#3370)
Go 1.21 renamed runtime._type to internal/abi.Type and changed the name
of its fields. Update Delve so that it uses the new names for loading
interfaces and generic type parameters.
2023-05-15 10:21:52 -07:00
Oleksandr Redko
d71b3aa6a7
dwarf/op: change generated comment header (#3288)
Change generated comment header for opcodes.go to match Go regexp:
```
^// Code generated .* DO NOT EDIT\.$
```

Fix panic in gen-opcodes.go if no args provided.
2023-02-25 14:12:12 +01:00
Quim Muntal
3d6730d12e
Default to stop test_windows.ps1 when there is an error (#3285)
* default to stop test_windows.ps1 when there is an error

* fix script
2023-02-22 09:25:29 -08:00
Alessandro Arzilli
bc5c0d4a9b
_scripts: Update staticcheck (#3270) 2023-02-14 09:36:00 -08:00
Oleksandr Redko
011fe673fe
_scripts: fix log.Printf format specifier (#3260) 2023-01-31 14:30:04 +01:00
Alessandro Arzilli
709da9a217
Documentation: document how to debug runtime with Delve (#3234)
Add FAQ entry to document how to debug the Go runtime using Delve.
Also add table of contents to FAQ.
2023-01-03 09:23:26 -08:00
Alessandro Arzilli
32df4071d2
TeamCity: fix windows/amd64 builds (#3223)
Windows/amd64 builds are not runnning because the current settings.kts
has an implicity requirement to property teamcity.build.systemDir which
does not exist on windows/amd64 agents.
2022-12-19 08:15:00 -08:00
Alessandro Arzilli
a35b902ecf
gdbserial: continue if tcsetpgrp fails (#3211)
Do not stop if tcsetpgrp errors, also only do it if the target process
got its own process group.

Fixes #3210
2022-12-12 08:36:48 -08:00
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
Quim Muntal
a185d0eac1
Run CI tests on windows/arm64 agents (#3198) 2022-11-17 13:52:38 +01: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
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
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
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
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
Derek Parker
db9770fe9d
_scripts: fix command to download Go version (#3099)
We should exclude rc/beta versions as we already run tests
against tip, we don't explicitly test RC versions.
2022-08-09 20:06:42 +02:00
Alessandro Arzilli
5452c30fac
proc/internal/ebpf: drop dependency on cgo (#3072)
The ebpf implementations uses cgo, but only to access some C struct
definitions. Instead of using cgo simply duplicate the defintion of
those two structs in Go and add a test to check that the duplicate
definitions remain synchronized.

Fixes #2827
2022-07-22 19:39:18 +02:00
Alessandro Arzilli
6aa54c5c9f
_scripts: un-pin mingw version (#3046)
The version of mingw was pinned to 10.2.0 because mingw 11 started
using DWARFv5, which wasn't supported by Go 1.17. We are now testing
only 1.18 and 1.19 and both support DWARFv5 correctly.
2022-07-11 14:48:51 -07: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
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
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
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
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
Koichi Shiraishi
23612165e7
_scripts: handle not installed CommandLineTools (#2914)
Signed-off-by: Koichi Shiraishi <zchee.io@gmail.com>
2022-02-28 09:32:39 -08:00
Alessandro Arzilli
e3f4c40bad
_scripts: fix camelToDash in gen-starlark-bindings.go (#2888)
Fix camelToDash so that it handles BuildID and CreateEBPFTracepoint
correctly.
2022-02-02 10:02:27 -08:00
Morten Linderud
8c392d2fdf
Implement source listing from debuginfo (#2885)
* service: Implement BuildID

Parse the BuildID of executables and provides it over the RPC
service.

Signed-off-by: Morten Linderud <morten@linderud.pw>

* command: Support debuinfod for file listing

Signed-off-by: Morten Linderud <morten@linderud.pw>

* debuginfod: create debuginfod package for common code

We remove the duplicated code and provide our a new debuginfod package.

Signed-off-by: Morten Linderud <morten@linderud.pw>

* starlark: Workaround for 'build_i_d'

Signed-off-by: Morten Linderud <morten@linderud.pw>

* command: Ensure we only overwrite path when one has been found

Signed-off-by: Morten Linderud <morten@linderud.pw>

* bininfo: Inline parseBuildID

Signed-off-by: Morten Linderud <morten@linderud.pw>
2022-01-30 13:39:30 -08:00
Alessandro Arzilli
4a94b3eff2
Updates for go1.18beta1 (#2831)
* go.mod: update golang.org/x/tools to v0.1.8

Fixes TestGeneratedDoc on go1.18

* TeamCity: bump test matrix

Add 1.18 to test matrix. Remove 1.15 from test matrix and from support range.

* proc,tests: update for regabi on arm64 and 386

Make sure that stacktrace registers always contain the PC register of
the current frame, even though the debug_frame rules might not specify
it on architectures that use a link register.
The PC register is needed to look up loclist entries for variable
evaluation.

* goversion: bump maximum supported Go version to 1.18

* proc: disable asyncpreempt on linux/arm64

Asyncpreempt on linux/arm64 can sometimes restart a sequence of
instructions which will make breakpoint appear to be hit twice in some
cases.
2021-12-22 10:26:21 -08:00
Herby Gillot
d514b4c6e9
_scripts: add option to disable invoking git during build (#2798)
This is useful to be able to build using Delve's build scripts when
working from within a directory that has been extracted from a source tarball,
or wherever we wouldn't have git history.

This can be invoked as:

```
  go run _scripts/make.go build --no-git
```
2021-12-13 10:24:41 -08:00
Alessandro Arzilli
b69bcf53d6
_scripts: fix test_linux.sh version check (#2785)
The version check to disable the buildvcs option is wrong, it doesn't
matter now but it will start failing when 1.18.1 is released.
2021-11-24 13:44:49 -08:00
Alessandro Arzilli
389cccf08b
TeamCity: fix scripts selecting Go version (#2804)
s/golang.org/go.dev/
2021-11-24 13:09:43 -08:00
Alessandro Arzilli
183bb8dffd
TeamCity: disable Windows Defender (#2775)
Shaves off 3 minutes out of every windows build.
2021-11-03 09:49:26 -07:00
Alessandro Arzilli
fe100bcb11
_scripts: fix latestver.py (#2756)
Fix latestver to sort rc and beta versions before normal releases.
2021-10-25 12:38:58 -07:00
Alessandro Arzilli
8ebd2d83ae
Misc fixes for test problems (#2751)
* service/dap: remove deadlock in TestLaunchDebugRequest

Fixes #2746

* terminal: fix TestScopePrefix flakiness

When there are more than 10 frames api.PrintStack will prefix the
output with spaces to right justify the frame number, which confuses
TestScopePrefix.

* _scripts: pass -buildvcs for Go 1.18 and later on TeamCity

Go 1.18 will try to stamp builds with the VCS version, this doesn't
work on TeamCity because the checkout isn't a valid repository (but
looks like it).
Pass -buildvcs=false to disable this feature.

* proc: switch to goroutine stack if first frame's func can not be found

If the first frame on the system stack can not be resolved to a
function switch directly to the goroutine stack.
2021-10-18 13:17:47 -07:00
aarzilli
6a282112cc TeamCity: enable tests on go-tip 2021-10-02 15:44:30 +02:00
Alessandro Arzilli
29eae8f617
*: clean up staticcheck problems (#2723)
Fix problems that can be fixed, ignore the ones that don't make sense
2021-09-28 12:07:42 -07:00
Alessandro Arzilli
038cd99b73
tests: run staticcheck during tests (#2705) 2021-09-24 15:31:54 -07:00
Claus Lensbøl
4bcb8fb144
terminal/make: Add GOARCH and GOOS arguments (#2696)
This change adds '--GOARCH=[arch]' and '--GOOS=[os]' as arguments for
the make script to simplify the process of cross compilling.
2021-09-13 09:11:45 -07:00
Derek Parker
1b2f7f0051
pkg/proc: Parse Goroutine ID in eBPF tracer (#2654)
This patch enables the eBPF tracer backend to parse the ID of the
Goroutine which hit the uprobe. This implementation is specific to AMD64
and will have to be generalized further in order to be used on other
architectures.
2021-08-24 14:53:27 +02:00
Alessandro Arzilli
c379296cc8
_scripts: auto check that pkg/proc and runtime are synchronized (#2557)
Adds a script that check automatically that the the assumptions that
pkg/proc makes about runtime are met by the actual runtime, using a
combination of parsing and magic comments.

Also emits a file describing all the struct fields, constants and
variables of the runtime that we use in pkg/proc.
2021-08-23 11:32:02 -07:00
Alessandro Arzilli
f3e76238e3
proc: move breakpoint condition evaluation out of backends (#2628)
* proc: move breakpoint condition evaluation out of backends

Moves breakpoint condition evaluation from the point where breakpoints
are set, inside ContinueOnce, to (*Target).Continue.

This accomplishes three things:

1. the breakpoint evaluation method needs not be exported anymore
2. breakpoint condition evaluation can be done with a full scope,
   containing a Target object, something that wasn't possible before
   because ContinueOnce doesn't have access to the Target object.
3. moves breakpoint condition evaluation out of the critical section
   where some of the threads of the target process might be still
   running.

* proc/native: handle process death during stop() on Windows

It is possible that the thread dies while we are inside the stop()
function. This results in an Access is denied error being returned by
SuspendThread being called on threads that no longer exist.

Delay the reporting the error from SuspendThread until the end of
stop() and only report it if the thread still exists at that point.

Fixes flakyness with TestIssue1101 that was exacerbated by moving
breakpoint condition evaluation outside of the backends.
2021-08-09 10:16:24 -07:00
nd
7462767355
teamcity: report go test exit code on windows (#2638) 2021-08-03 10:42:53 -07:00
Derek Parker
10406f96d5
*: Initial eBPF tracing support (#2625) 2021-07-31 17:16:26 +02:00
nd
150ef04177
TeamCity: prefer go rc builds over beta (#2619)
Works around https://github.com/golang/go/issues/47367.
2021-07-24 11:14:45 -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
Alessandro Arzilli
854552fa00
_scripts: change gen-backend_test_health.go to be more stable (#2505)
Change gen-backend_test_health.go so that it only prints the number of
tests skipped and not the total or the percentage.
As it is it causes too many merge conflicts.
2021-05-25 10:49:46 -07:00
Alessandro Arzilli
1962c3a627
TeamCity: fix Windows builds (#2467)
Bintray is shutting down and the URL we used to install mingw is no
longer available. Use chocolatey instead.
2021-05-06 10:05:17 -07:00