Commit Graph

793 Commits

Author SHA1 Message Date
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
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
Alessandro Arzilli
e1e4b09a5e
proc: move resume notify and manual stop handling to Target (#2921)
Moves handling of ResumeNotify and manualStopRequested to Target instead of the backends

Updates #2551
2022-03-21 12:42:37 -07:00
Alessandro Arzilli
a19931c9d3
proc/native/linux: replace uses of unix.Iovec for target addresses (#2922)
Replaces sys.Iovec with a similar struct that uses uintptr instead of
*byte for the base field when referring to addresses of the target
process, so that we do not generate invalid pointers.

Fixes #2919
2022-03-15 14:33:12 -07:00
Derek Parker
22fd222c0a
*: Bump version to 1.8.2 (#2920) 2022-03-08 10:20:49 -08:00
Alessandro Arzilli
4c5b111abb
proc,debugger: move breakpoint ID counter to service/debugger (#2913)
Moves breakpoindIDCounter out of BreakpointsMap and into
service/debugger.Debuggger to simplify proc.Target's API and aid with
implementing fork follow mode, where we'll have to debug multiple
processes simultaneously.
2022-02-25 10:09:53 +01:00
Alessandro Arzilli
1418cfd385
proc: better handling of hardcoded breakpoints (#2852)
This commit improves the handling of hardcoded breakpoints in Delve.
A hardcoded breakpoint is a breakpoint instruction hardcoded in the
text of the program, for example through runtime.Breakpoint.

1. hardcoded breakpoints are now indicated by setting the breakpoint
   field on any thread stopped by a hardcoded breakpoint
2. if multiple hardcoded breakpoints are hit during a single stop all
   will be notified to the user.
3. a debugger breakpoint with an unmet condition can't hide a hardcoded
   breakpoint anymore.
2022-02-22 09:57:37 -08:00
Alessandro Arzilli
6ea826c363
proc: better error messages for ambiguous function calls/type casts (#2903)
Try to produce better error messages when we can't distinguish between
a function call and a type cast.

Fixes #2902
2022-02-22 09:55:59 -08:00
chainhelen
bb88e8b52e
pkg/terminal: add '-clear' option to 'condition' command (#2882)
This change adds the '-clear' to 'condition' which will clear
condtion on the breakpoint.

Co-authored-by: qianhailong <qianhailong@bytedance.com>
2022-02-15 18:41:23 +01:00
Hyang-Ah Hana Kim
cec23c0aa1
go.mod: require go-delve/liner instead of peterh/liner (#2905)
Use of `replace` in go.mod breaks delve installation using
`go install`. (see https://github.com/golang/go/issues/40276)
Workaround this limitation by explicitly require the fork
github.com/go-delve/liner.

go-delve/liner@v1.2.2-1 already has go.mod module name fixed
to be github.com/go-delve/liner.

Fixes go-delve/delve#2904
2022-02-14 18:42:43 +01:00
Derek Parker
dee4437bd0
pkg/terminal: support ctrlz for shell job control (#2806)
* pkg/terminal: support ctrlz for shell job control

This required forking peterh/liner under the go-delve org and using that
instead since upstream is not open to supporting this feature.

Fixes #2157

* Update liner

* Update liner but correctly this time

* upgrade golang.org/x/tools to 0.1.9
2022-02-10 09:50:55 -08:00
hitzhangjie
9c18bb46dd
terminal/colorize: avoid print multiple package by accidently ast.Node startPos==token.NoPos (#2898)
fix #2896
2022-02-10 09:50:31 -08:00
Alessandro Arzilli
a646d06544
proc: downgrade loadBuildID errors to warnings (#2893)
Most binaries do not have build-ids and it's fine, there's no reason to
report it as an error.
2022-02-08 10:54:05 -08:00
Alessandro Arzilli
1f0b39eab5
proc: fix crash trying to open separate debug info (#2901)
If debugInfoDirectories is set, the executable does not have debug info
and build-id is not set we should not crash.
2022-02-08 10:53:45 -08:00
Alessandro Arzilli
3829f4e06d
Version 1.8.1 (#2892)
Update CHANGELOG.md and version.
2022-02-07 09:53:07 -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
5b925d4f5d
terminal: add transcript command (#2814)
Adds a transcript command that appends all command output to a file.
This command is equivalent to gdb's 'set logging'.

As part of this refactor the pkg/terminal commands to always write to a
io.Writer instead of using os.Stdout directly (through
fmt.Printf/fmt.Println).

Fixes #2237
2022-01-27 13:18:25 -08:00
Alessandro Arzilli
c3eb1cf828
proc: enable core dumping on windows (#2834)
Core dumping for Windows was implemented a while ago but never enabled.
2022-01-27 13:17:15 -08:00
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
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
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
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
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
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
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
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
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
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
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
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
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
Derek Parker
cba1a524a8
v1.7.3 (#2796) 2021-11-17 16:33:11 +01:00
Derek Parker
cd9e6c02a6
*: Replace libbpfgo with cilium/ebpf (#2771) 2021-11-03 16:58:04 +01:00
Alessandro Arzilli
c207db792a
proc,locspec: support setting breakpoints by func name on generic funcs (#2745)
* proc,locspec: support setting breakpoints by func name on generic funcs

Changes proc.Function to parse function names correctly when they
contain instantiation lists and locspec to match generic functions.

* vendor: update golang.org/x/tools

The old version of golang.org/x/tools is incompatible with the new
iexport format.
2021-10-30 11:52:26 -07:00
Alessandro Arzilli
884ef4f338
proc/gdbserial: workaround for debugserver register set bug (#2770)
Debugserver has a bug where writing to a AVX-2 or AVX-512 register does
not work unless it is followed by at least a write to a AVX (not 2 or
512) register.

See also: https://bugs.llvm.org/show_bug.cgi?id=52362

Fixes #2767
2021-10-30 11:51:02 -07:00