Commit Graph

2297 Commits

Author SHA1 Message Date
Derek Parker
8ddb64c808
pkg/proc: handle double inlined calls (#2880)
It's possible that an inlined function call also contains an inlined
sunroutine. In this case we should also parse the children of
inlined calls to ensure we don't lose this information.
2022-01-24 08:56:37 +01:00
Hyang-Ah Hana Kim
0005eb9f58
dap: create temporary binary in the current working directory (#2868)
This is a partial revert of PR #2660.

Some users develop in environments where execution of binaries
in temp directory is prohibited or undesirable. Moreover, the
current implementation creates binaries with random names
and that made it more difficult to set up firewall exclusion
rules. Revert it and always use the default debug output name.
(The debug binary will be created in the delve's working directory
and an editor does not have any promise on working directory
unless user specifies it through dlvCwd. So users still need to
chase them unless they set the exclusion rule purely based on
the file base name).

Fixes golang/vscode-go#1955
2022-01-19 11:02:49 -08:00
Alessandro Arzilli
b3e528e4fb
service/dap: deflake DAP tests (#2872)
1. change ExpectOutputEventProcessExited to accept -1 exit status, this
   is a real problem on linux but we don't know how to fix it and we
   already have a test in proc for it.
2. change TestNoDebug_AcceptNoRequestButDisconnect to be less picky
   about message ordering, all message orderings seem to be fine, there
   is no reason to insist on a particular one, since the DAP server is
   unable to actually produce it deterministically.

Fixes #2860
2022-01-19 10:40:54 -08:00
Alessandro Arzilli
df8c2b37ce
proc: always load eh_frame section from executable (#2875)
Always load eh_frame section from the executable file instead of the
split debug info file. The eh_frame section is meant to be loaded in
memory along with the executable file so it will usually not be present
in a split debug info file (or, if it is present, it will be the wrong
one).
2022-01-19 10:40:23 -08:00
Morten Linderud
3b6099cace
bininfo: Strip whitespace from debuginfod-find output (#2876)
Signed-off-by: Morten Linderud <morten@linderud.pw>
2022-01-19 10:25:48 -08:00
Alessandro Arzilli
5862e40192
go.mod: bump liner version (#2874)
Bump versio of github.com/peterh/liner to 1.2.2 that contains a fix for
a bug on windows.

Fixes #2869
2022-01-18 09:02:30 -08:00
Gareth Rees
c75f7a2658
Documentation: improve wording for "rewind" command (#2870) (#2871) 2022-01-14 09:44:22 -08:00
Alessandro Arzilli
d95f26c4bd
proc: interpret value of DW_AT_inline correctly (#2859)
All values greater than or equal to 1 indicate that the function has
been inlined.
2022-01-06 09:07:53 -08:00
Alessandro Arzilli
466f9b8c93
proc: change UserCurrent to exclude internal and runtime/internal (#2853)
packages

Changes UserCurrent to exclude frames stopped inside the 'internal' and
'runtime/internal' packages of the standard library.

Before this change a goroutine blocked accepting or reading from a
socket would be reported as having a user current frame of:

    internal/poll.runtime_pollWait

After this change accepting goroutines will be reported with a user
current frame of:

    net.(*netFD).accept

and reading goroutines as:

    net.(*netFD).read
2022-01-06 09:07:26 -08:00
Suzy Mueller
a2927f6117
service/dap: set min/max addresses for invalid instructions (#2832) 2022-01-06 09:02:19 -08:00
Suzy Mueller
66478f21e3
pkg/proc: set stop reason for step instruction (#2828)
* service/dap: move presentationHint to frame from source

* pkg/proc: set stop reason for step instruction
2022-01-06 09:01:47 -08:00
Hyang-Ah Hana Kim
21bdb466f1
dap: support 'Env' attribute for launch requests (#2846)
* dap: support 'Env' attribute for launch requests

Env is applied in addition to the delve process environment
variables. The env setting is done by calling os.Setenv
as early as possible when a Launch request is received.

Prior discussion is in https://github.com/go-delve/delve/pull/2582

In Visual Studio Code, setting null for an environment variable
in launch.json or tasks.json indicates users want to unset
the environment variable. Support the behavior by accepting
nil value.

* dap: Env field itself can be omitempty

* edit comment
2022-01-06 09:01:09 -08:00
Fabio Falzoi
79d5db24a5
Automatically disable breakpoints with hitcount conditions that will never be satisfied again (#2833)
* service/debugger: disable breakpoints with hitcond not satisfiable

To avoid slowing down the debugged process unnecessarily, we disable
breakpoints with a hit condition that can no longer be hit again.

* test: add integration tests for hit conditions no more satisfiable

* proc/test: fix typo in breakpoints related tests

* test: use the new API for hitcond integration tests
2022-01-06 09:00:46 -08:00
polinasok
7afe640773
Documentation: add DAP API page (#2856)
* Documentation: add DAP API page

* Respond to review feedback

* Clarify about Ctrl-C

* Add hidden TODO for more things to document

Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com>
2022-01-06 08:58:08 -08:00
polinasok
4c1f8b4b25
commmands: update DAP overview in help (#2850)
Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com>
2022-01-06 08:57:40 -08:00
polinasok
f09896a593
Documentation: add overview usage info for all dlv commands (#2857)
* Documentation: add overview usage info for all dlv commands

* Separate trace, adjust headless wording

* Add headless command note

Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com>
2022-01-06 08:57:12 -08:00
Tim Hockin
0ecdc6e4a9
pkg/terminal: Support b and t without a linespec (#2863)
This could probably be more user-friendly, in that you can't give a name
to such a breakpoint.  To add support for names, we would need to try
a single arg first as a location, and if that fails try it as a name for
current line.  That seems somewht dubious, so I didn't try.
2022-01-06 08:56:21 -08:00
Suzy Mueller
5842c1fe9e
service/dap: fix race in no debug test (#2766)
Check for a possible output event when disconnecting from a
process that has already exited.

Fixes #2763
2022-01-04 12:03:20 +01:00
polinasok
fcc9561cbe
service/dap: update request inventory comments and labels in Server.handleRequest (#2854)
Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com>
2022-01-03 10:58:13 +01:00
Derek Parker
661cb33699
pkg/proc: switch to Dual MIT/GPL license for ebpf (#2849) 2021-12-30 20:14:37 +01:00
Derek Parker
a88c9bde4a
pkg/proc: add build scripts & docker image for ebpf (#2847)
Adds a few build scripts and a container image for reproducible builds
of the ebpf programs.
2021-12-30 09:04:59 +01:00
Derek Parker
38410993c9
v1.8 (#2840)
* v1.8
2021-12-23 10:25:21 -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
Alessandro Arzilli
07bcf0cb13
Documentation: document runtime.curg and runtime.frameoff (#2835) 2021-12-22 09:38:39 -08:00
Alessandro Arzilli
b81f618fb3
proc/native: ignore 'pf' mappings during core dump creation (#2761)
Fixes #2630
2021-12-14 06:26:08 -08:00
Alessandro Arzilli
b192d84670
service: use name w/o parameters for breakpoints on generic funcs (#2774)
When printing breakpoints on generic functions use the function name
without parameters instead of using the name of the first instantiation
that appears on the list.
2021-12-13 11:41:28 -08:00
Alessandro Arzilli
617d934d3e
proc/gdbserial: allow rewind to work after process exit with rr (#2815)
* service/debugger: fix bug internal err with Restart on recorded target

If Restart is called after a Continue and Rewind on a recorded target
that has already terminated it will return an internal error.

* proc/gdbserial: allow rewind to work after process exit with rr

It is sometimes useful to set breakpoints and rewind a terminated
process when using rr, for example if interested in the last execution
of some function.
RR will not allow a backward continue after the process exit packet has
been  sent, however rr will also generate a synthetic SIGKILL right
before process exit.
Treat this packet as a process exit and change some things so both
continuing backwards and setting breakpoints can be done, on recorded
targets, after process exit has been reported.
2021-12-13 11:39:20 -08:00
Zhaoyang
3d334e4a5b
fmt code (#2826) 2021-12-13 10:25:23 -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
polinasok
c0fa4e32d7
Documentation: add more installation instuctions (#2824)
Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com>
2021-12-12 10:30:21 -08:00
kaddy-tom
15bb95ccc3
terminal/command: fix up OoB in deferred command (#2823)
Prior to this, sending a `deferred` command with no arguments would immediately
crash the debug session.
2021-12-10 10:52:05 +01:00
polinasok
2f13672765
service/dap: fix compile error from merge conflict (#2818)
Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com>
2021-12-08 11:37:35 +01:00
Suzy Mueller
a4ac69e87d
service/dap: support goroutine filters in dap (#2759)
* service/dap: filter goroutines

* adjust defaults

* add tests

* remove label change

* fix typos

* send invalidated areas

* respond to review, and allow to clear goroutineFilters
2021-12-07 09:23:55 -08:00
polinasok
d0898e4de1
service/dap: misc remote attach improvements (#2778)
Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com>
2021-12-07 09:23:26 -08:00
Alessandro Arzilli
b8a9ae26f6
proc: fix signal handling during stepping (#2803)
Fix signal handling during thread single stepping so that signals that
are generated by executing the current instruction are immediately
propagated to the inferior, while signals other signals sent to the
thread are delayed until the full resume happens.

Fixes a bug where a breakpoint set on an instruction that causes a
SIGSEGV would make Delve hang and a bug where signals received during
single step would make it look like an instruction is executed twice.

Fixes #2801
Fixes #2792
2021-12-07 09:21:53 -08:00
Alessandro Arzilli
2cd9d268d3
proc: add dummy files to fix vendoring of Delve (#2807)
Add some dummy go files so that 'go mod vendor' works for modules that
require Delve, becuase directories that do not contain any go code will
not be vendored.
2021-12-07 09:20:10 -08:00
hitzhangjie
1a815365d5
godwarf/type: fix typo (#2813) 2021-12-02 12:17:47 +01:00
Suzy Mueller
3833c3d029
service/dap: move presentationHint to frame from source (#2810) 2021-12-01 10:57:03 +01:00
Alessandro Arzilli
75bbbbb60c
proc: support DWARF5 on Windows/macOS (#2791)
* proc: log errors reading debug_info

Because of an incorrect use of debug/dwarf.Reader errors encountered
while reading debug_info were not reported.

Updates #2786

* proc: use debug_line_str section for PE and Macho-O files

Updates #2786
2021-11-26 08:11:29 -08:00
Alessandro Arzilli
01b01423ae
proc/*: minor miscellaneous code cleanups (#2790)
* made Pid a method of Target instead of a method of Process
* changed argument of NewTarget to ProcessInternal, since that's the
  interface that backends have to implement
* removed warnings about ProcessInternal since there is no way for
  users of pkg/proc to access those methods anyway
* made RecordingManipulation an optional interface for backends, Target
  supplies its own dummy implementation when the backend doesn't
* inlined small interfaces that only existed to be inlined in
  proc.Process anyway
* removed unused function findExecutable in the Windows and no-native
  darwin backends
* removed (*EvalScope).EvalVariable, an old synonym for EvalExpression
2021-11-26 08:06:23 -08:00
polinasok
88dca53e5c
service/dap: fix TestNextParked (#2784)
Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com>
2021-11-24 13:46:14 -08:00
Alessandro Arzilli
f34a1e6a5e
version: fix build version using buildInfo (#2789)
In go1.18 buildInfo will include the git revision hash, use that to fix
the Build field of Version so that it is correct even if Delve wasn't
built using make.go.
2021-11-24 13:45:28 -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
Suzy Mueller
935161f8bf
service/dap: expose sources command in evaluate request (#2797)
* service/dap: expose sources command in evaluate request
2021-11-24 13:38:37 -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
Derek Parker
cba1a524a8
v1.7.3 (#2796) 2021-11-17 16:33:11 +01:00
polinasok
a350aafaa7
v1.7.3 Changelog (#2793)
* v1.7.3 Changelog

Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com>
2021-11-17 06:49:09 -08:00
polinasok
9013a121d8
server/dap: stop running command if conn closed - fixes nil dereference bug (#2781)
Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com>
2021-11-09 09:24:26 +01: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
Derek Parker
cd9e6c02a6
*: Replace libbpfgo with cilium/ebpf (#2771) 2021-11-03 16:58:04 +01:00