Commit Graph

2491 Commits

Author SHA1 Message Date
Derek Parker
e49c81cc5d
*: Fix ppc64le test runs (#3460)
We must pass the build tag through during the 'vet' check, and
additionally there was some extra commands at the end of test_linux.sh
that were not necessary.
2023-08-11 08:51:28 -07:00
Alessandro Arzilli
caf6df0eb9
Documentation,cmd/dlv: clean up command line usage help (#3395)
Due to some very old mistakes too many of Delve's flags are declared as
persistent on cobra's root command. For example the headless flag is a
global flag but does not apply to connect, dap or trace; the backend
flag does not apply to replay, core and dap; etc.

Almost all global flags should have been declared as local flags on
individual subcommands. Unfortunately we can not change this without
breaking backwards compatibility, for example:

   dlv --headless debug

would not parse if headless was a flag of debug instead of a global
flag.

Instead we alter usage function and the markdown generation script to
strategically hide the flags that don't apply.

Fixes #2361
2023-08-09 10:37:55 -07:00
Alessandro Arzilli
dc5d8de320
proc: add waitfor option to attach (#3445)
Adds a waitfor option to 'dlv attach' that waits for a process with a
name starting with a given prefix to appear before attaching to it.

Debugserver on macOS does not support follow-fork mode, but has this
feature instead which is not the same thing but still helps with
multiprocess debugging somewhat.
2023-08-09 10:30:22 -07:00
Alessandro Arzilli
2b785f293b
logflags: simplify Logger interface (#3274)
Remove methods we never used or used only very sparingly (Print) and we
probably shouldn't be using at all (Fatal).
2023-08-07 13:55:45 -07:00
Andrei Matei
ae67a45a1c
starbind: fix Starlark slice unmarshaling (#3454)
The unmarshaling code for slices wasn't actually setting the
destination. This patch fixes it.
2023-08-07 12:11:05 -07:00
gocurr
b5c9edccff
pkg/terminal: use reflect.Value.IsValid to check a zero Value (#3450)
I searched the source code of Go, and found no usages of
"== (reflect.Value{})" and "!= (reflect.Value{})". I think
it's more idiomatic to use "IsValid" to check a zero Value.
2023-08-01 08:35:59 -07:00
Alessandro Arzilli
7db57df266
proc: replace use of runtime.GOARCH with Arch.Name (#3442) 2023-07-26 08:33:31 -07:00
Alessandro Arzilli
34104fb65d
proc,ebpf: mark as unreadable args with unsupported types with ebpf (#3444)
Only a few types can be read with ebpf, mark everything else as
unreadable so that there are no downstream crashes.

Fixes #3443
2023-07-25 16:27:37 -07:00
Alessandro Arzilli
a53f1bf45d
service/api: in multiline mode print address of pointers (#3448)
When printing a pointer variable first print the address that it points
to before printing its dereferenced value.

Fixes #3446
2023-07-25 16:27:00 -07:00
Alessandro Arzilli
ca611db449
terminal: restore breakpoints set with line offset on restart (#3425)
Change FindLocation so it can return a substitute location expression
and propagate it to pkg/terminal/command.
When breakpoints are set using the syntax :<lineno> or +<lineno>
produce a substitute location expression that doesn't depend on having
a valid scope and can be used to restore the breakpoint.

Fixes #3423
2023-07-20 12:29:59 +02:00
gocurr
8023fa956e
all: use "len == 0" rather than "len <= 0" when checking empty slice/string (#3439) 2023-07-13 11:30:32 -07:00
Oleksandr Redko
0e3cae9dc9
service/dap: fix typos in comments (#3438) 2023-07-11 16:10:41 +02:00
gocurr
cbc45e1670
pkg/proc: simplify code with trivial changes (#3436) 2023-07-09 08:27:05 +02:00
Derek Parker
326c451b44
*: add linux/ppc64le targets (#3435) 2023-07-07 21:06:09 +02:00
Alessandro Arzilli
db0bc26949
terminal,service: better printing of suspended breakpoints (#3415)
Show the location expression that will be used to set a suspended
breakpoint in the breakpoints list.

Also change 'target' called without arguments to print a better error
message and 'target follow-exec' without the last argument to print the
state of follow-exec.
2023-07-07 10:33:40 -07:00
Alessandro Arzilli
c1482ca911
proc: check recursion level when loading pointers (#3431)
Fixes #3429
2023-07-07 10:32:05 -07:00
Á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
Suzy Mueller
9f3e146129
service/dap: fix test for debug in progress (#3407)
The regular expression attempted to match for a network address,
but actually does not match any network addresses. The two
documentation includes "192.0.2.1:25" and "[2001:db8::1]:80" as
examples, neither of which match the current regex. This change
updates the regular expression to ensure that there is some text
at the desired position, but not what the text is.
2023-07-07 08:17:39 +02:00
gocurr
80840dd2bf
all: fix typos (#3434) 2023-07-06 11:16:06 +02:00
Oleksandr Redko
2d3fd35e04
pkg,service: refactor to use %q instead of "%s" (#3430) 2023-07-05 08:49:08 -07:00
gocurr
f016055457
pkg/dwarf/frame: fix FrameDescriptionEntries's Append (#3433)
The current implementation has a bug to remove duplicates.
It can be implemented by using fast-slow pointers.
2023-07-05 08:48:33 -07:00
ttoad
53998cbb18
pkg/proc,service/*: Supports sending output to clients when running programs remotely (#3253)
* wip: Support sending output when remote debug

* wip: Support local output and remote output

* wip: fix stderr and stdout assignment error

* wip: optimize code

* wip: Only if outputMode is "remote" is the redirected console output

* wip: Redirected debugMode output(Not tested on windows)

* wip: support remote debugging output redirection of windows

* wip: real-time write back output

* wip: support for windows

* wip: fix windows remote debug not output

* wip: fix truncated output redirection

* wip: delete printfln

* wip: use debugger.Config to pass redirect(macOS)

* wip: use debugger.Config to pass redirect(linux)

* wip: Change redirect to a concrete type

* wip: s.wg.wait before sending "terminated"

* wip: add proc/redirect test(darwin and linux)

* Merge branch 'master' of github.com:tttoad/delve into feat-console

* wip: Fix test failure on windows

* fix: undefined: proc.Redirects

* fix: compile failure

* wip: Remove useless code

* fix: filename error

* fix: os.file not close

* test: add server_test.redirect

* fix: Remove 'eol' from end of file

* fix: gdbserial: File not closed in file mode.
(in reality, gdbserial will never use file mode)

* feat: Remove "only-remote". Fix spelling mistakes.

* fix: spelling mistakes

* refactor: redirect

* fix: stdout and stderr are not set to default values

* fix: Restore code logic for rr.openRedirects()

* fix: Optimization Code

* fix: utiltest

* fix: execpt out

* fix: Resource release for redirects

* fix: build failure

* fix: clean->clear

* fix: build failure

* fix: test failure

* fix: Optimization Code

* style: remove useless code

* refactor: namedpipe

* refactor: namedpipe, launch ...

* fix: freebsd compile failure

* fix: proc_darwin compile failure

* style:  remove useless code

* feat: add d.config.Stdxx check on debug.Restart

* style: formatting and adding comments

* style: formatting and adding comments

* feat: add d.config.Stdxx check on debug.Restart

* style: namedpipe->redirector

* style: namedPipe->redirector

---------

Co-authored-by: 李翔 <qian.fu2@amh-group.com>
2023-07-05 08:39:01 -07:00
Alessandro Arzilli
d963eb1057
proc: read context from sigtrampgo, fixes TestCgoStacktrace2 on 1.21 (#3401)
* logflags,proc: flag to log stacktrace execution

Add a log flag to write logs about what the stacktracer does.

* proc: read context from sigtrampgo, fixes TestCgoStacktrace2 on 1.21

Changes stacktrace code to read the signal context from the arguments
of sigtrampgo.
Also changes the automatic fatalthrow breakpoint for go 1.21.
In combination these two changes fix TestCgoStacktrace2 on Go 1.21 on
various platforms.
2023-06-27 09:33:07 -07:00
Alessandro Arzilli
1647fa6b5e
all: Bump to v1.21.0 (#3428)
Thank you @alexandear, @chenhengqi, @cuishuang, @alexsaezm, @suzmue,
@spacewander, @ZekeLu, @fche, @andreimatei, @nozzy123nozzy
2023-06-27 09:04:52 -07:00
Alessandro Arzilli
afef1aec60
proc: skip TestDebugStripped on linux/386/pie (#3427)
PIEs do not have a .data.rel.ro.gopclntab section on linux/386. Disable
the test.
2023-06-20 09:55:30 -07:00
Oleksandr Redko
322a138cf2
service/dap: fix typos in comments (#3426) 2023-06-20 14:53:18 +02:00
Derek Parker
656c4f13df
pkg/proc: improve stripped binary support with PIE (#3421)
Take into account static base for PIE binaries.
2023-06-16 09:38:19 +02:00
Alessandro Arzilli
14d9c1881d
proc: only print warning when gopclntab can not be read for first image (#3420)
Only print the warning that gopclntab can not be read for the first
image (i.e. the executable file), also change the returned when neither
DWARF nor gopclntab are found to preserve the DWARF error.
2023-06-15 08:28:35 -07:00
Alessandro Arzilli
95dac8f19b
service,terminal: when libraries don't have debug_info print reason (#3419)
Print the reason why libraries don't have debug info in response to the
'libraries' command.
2023-06-15 08:00:59 -07:00
Derek Parker
d006538bb6
pkg/terminal: regenerate starlark mappings (#3418) 2023-06-15 12:09:20 +02:00
Derek Parker
1d28ceccdc
pkg/proc: fix ebpf probe tracing backen uprobe handling (#3417)
Uprobes get automatically cleaned and removed when the reference to
the Link object is lost. Hold a reference to any active Uprobe Link
for duration of Delve execution and ensure they are cleaned up
at exit.

Fixes ebpf probes don't work after time.Sleep() #3227
2023-06-15 12:07:32 +02:00
Derek Parker
ccf17a6f42
pkg/proc: enable basic debug functionality for stripped ELF binaries (#3408)
We used to parse the .gopclntab section but removed support in favor of
simply using DWARF debug information, due to lack of C symbols among
other reasons. This makes it impossible to debug stripped binaries,
which some distrubutions ship by default.

Add back in basic support for .gopclntab which survives if the binary
is stripped, allowing for rudimentary debugging such as basic
program navigation, tracing, etc...
2023-06-14 13:23:46 +02: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
Suzy Mueller
e549a02f0e
service/dap: update go-dap to latest (#3414)
* service/dap: update go-dap to latest

* update remaining possible nil checks

* move helper functions to the end of the file
2023-06-12 14:29:44 -07:00
Alessandro Arzilli
380920c340
TeamCity: fix linux/arm64 build (second attempt) (#3411)
Second attempt at doing what PR #3403 tried to do.
2023-06-12 14:29:09 -07:00
Alessandro Arzilli
c958128f21
terminal: expand ~ in paths passed to 'source' (#3387) 2023-06-06 20:52:19 -07:00
Alessandro Arzilli
5880f4cec9
proc/test: reenable cgo testing on FreeBSD (#3394) 2023-06-06 20:50:03 -07:00
Alessandro Arzilli
9b17415e83
terminal: ask for confirmation when using 'quit -c' with breakpoints (#3398) 2023-06-06 20:46:56 -07:00
Alessandro Arzilli
ea13a24f38
TeamCity: fix linux/arm64 build (#3403) 2023-06-06 20:46:00 -07:00
Andrei Matei
6d412c65da
rpc2, debugger: Fix comments around goroutine grouping (#3374) 2023-06-06 20:44:51 -07:00
nozzy123nozzy
8b9c3a93f5
cmd/commands: Fix to read debug info file from the correct directory when using trace command with -e option. (#3405) 2023-06-06 16:12:11 -07:00
Andrei Matei
7603e46f75
starbind: fix use of ptr variables in starlark (#3386) 2023-05-31 10:29:36 -07:00
Alessandro Arzilli
407ace96c8
debugger: inline clearBreakpoint, createLogicalBreakpoint (#3389) 2023-05-31 10:21:12 -07:00
Alessandro Arzilli
cc05aa2064
TeamCity: actually run linux/386 tests on linux/386 (#3392) 2023-05-31 10:18:15 -07:00
Alessandro Arzilli
6d7263f6f9
service/rpccommon: correct wrong comments (#3397) 2023-05-31 10:11:47 -07:00
Andrei Matei
5c711f8d09
docgen: fix links with trailing dots (#3399) 2023-05-31 10:00:06 -07:00
Andrei Matei
6a56d0eedc
dwarf: ignore DeclLine for function args (#3400) 2023-05-31 09:58:47 -07:00
Oleksandr Redko
9d6bce467c
_scripts: fix typos (#3402) 2023-05-31 16:33:23 +02:00
Alessandro Arzilli
47989248ed
dwarf/op: use readMemory function (#3391)
dwarf/op gained the ability to execute DW_OP_deref opcodes a while ago
but because we didn't save the readMemory function in the context
structure it never worked.
2023-05-26 10:04:37 -07:00
Andrei Matei
c2bfdfc76b
starbind: Make the time module available to star scripts (#3375)
This patch makes the time library available to Starlark scripts. This
library is one of the very few few that are built into starlark-go (the
others are json, math, proto).
I've played around with Starlark scripting today, and immediately I
wanted to measure how long certain computations take.
2023-05-23 11:23:33 -07:00