Commit Graph

31 Commits

Author SHA1 Message Date
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
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
efc4483175
pkg/goversion: visibly warn the user with --check-go-version=false (#2684)
Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com>
2021-09-25 17:41:00 +02:00
Hyang-Ah Hana Kim
f74b7a6e39
all: update github.com/spf13/cobra to v1.1.3 (#2572)
This removes indirect dependencies from go.mod, and
includes the fix for the missing -help flag info.

The latest cobra release is v1.2.1. Given that there were
minor security-related dependency cleanup during v1.2 release,
I was tempted to pick up the latest version, but that caused
dependency updates in golang.org/x/sys and golang.org/x/tools
which may be too recent (golang.org/x/* follow the go's release
support policy, so recent versions may not be compatible with
go versions beyond go's official version support policy).

Verified that dlv still builds with go1.12.x.
(go1.12 is the oldest version of go that can build the latest delve already).

$ go get -d github.com/spf13/cobra@v1.1.3
$ go mod tidy
$ go mod vendor
$ go run _scripts/gen-usage-docs.go
2021-07-22 11:05:37 -07:00
polinasok
5459034a98
cmd/dap: server - always headless, target - always foregrounded (#2589)
Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com>
2021-07-16 09:49:16 -07:00
Alex Zamai
433eafb280
*: Expand --build-flags= description in the document (#2273)
add example for multiple  --build-flags

add example description to --build-flags
2021-01-05 10:57:30 -08:00
Alessandro Arzilli
9a3c9ebad1
proc/*: add launch option to disable ASLR (#2202)
Fixes #1847
2020-10-21 12:50:52 -07:00
aarzilli
7555d1c063 cmd,proc,terminal,debugger: Support default file descriptor redirects
Adds features to support default file descriptor redirects for the
target process:

1. A new command line flag '--redirect' and '-r' are added to specify
   file redirects for the target process
2. New syntax is added to the 'restart' command to specify file
   redirects.
3. Interactive instances will check if stdin/stdout and stderr are
   terminals and print a helpful error message if they aren't.
2020-09-01 21:50:27 +02:00
Alessandro Arzilli
1ef8c40ccf
cmd/dlv: subcommand 'dlv test' should switch to package directory (#2128)
Match 'go test' behaviour and switch to package directory, unless one
is specified with the '--wd' option.

Fixes #2125
2020-08-31 10:51:10 -07:00
Alessandro Arzilli
ab5713d3ec
Documentation: clarify API version status (#2068)
Clarify that the currently supported version of the API is 2 and that
the preferred method for selecting it is sending a SetApiVersion
command after connection.

Fixes #2066
2020-06-11 14:32:36 -07:00
polinasok
fbc4623c08
service/dap: Initial implementation for 'dlv dap' (#1858)
* Initial implementation for 'dlv dap'

* Fix Travis and AppVeyor failures

* Address review comments

* Address review comments

* Regenrate documentation

* Replace dap server printfs with log.Error

* Update 'dap log'

* Fix typos

* Revert logflags changes that got mixed in by accident
2020-02-15 11:52:53 -08:00
Alessandro Arzilli
81a86086dd
cmd/dlv: Fix same-user check and add flag to disable it (#1839)
* service: also search IPv6 connections when checking user

When checking if the user is allowed to connect to this Delve instance
also search IPv6 connections even though the local address is IPv4.

Fixes #1835

* cmd: add flag to disable same-user check

Fixes #1835
2020-02-11 09:06:29 -08:00
Alessandro Arzilli
2bd1cd3fa7 Documentation,cmd/dlv: tidy up --help output (#1649)
* scripts: use relative path in gen-cli-docs.go

Makes gen-cli-docs.go work outside GOPATH.

* Documentation,cmd/dlv: tidy up --help output

The description of --log-dest, --log-output and --backend is very
verbose and messes up the output of --help, move it to two "additional
help" subcommands.
2019-08-01 16:28:37 -07:00
Derek Parker
f4eaad69d9
*: Add .cirrus.yml for FreeBSD testing (#1639)
* *: Add .cirrus.yml for FreeBSD testing

* *: run go mod tidy

* service/test: prefer 127.0.0.1 over localhost

* dwarf/line: fix TestDebugLinePrologueParser

* vendor: rerun go mod vendor
2019-07-30 08:38:25 -07:00
Alessandro Arzilli
79e0f543c0 cmd/dlv: add Go version check (#1533)
Before doing anything check that the version of Go is compatible with
the current version of Delve.
This will improve the error message in the case that  another change as
disruptive as Go1.11 dwarf compression, happens.
2019-04-26 10:24:21 -07:00
Alessandro Arzilli
48f1f51ef9 Miscellaneous logging improvements (#1525)
* *: use loglevel to control what gets logged instead of output redirection

This stops logrus from doing all the formatting just to discard it
immediately afterwards.

* logflags: replace default formatter of logrus

The default formatter of logrus emits logs in two different formats
depending on whether or not the output is going to a terminal. The
output format for non-terminals is indented to be machine readable, but
we mostly read logs ourselves and the excessive quoting makes that
format unreadable.
When outputting to terminals it uses ANSI escape codes unconditionally,
without checking whether the terminal it is connected to actually
supports colors.

This commit replaces the default formatter with a much simpler
formatter that always uses a more readable format, doesn't use colors
and places the key-value pairs at the beginning of the line (which is a
better match for how we use them).

* cmd/dlv: add command line options to redirect logs

Adds two options, --log-to-file and --log-to-fd, to redirect logs to a
file or to a file descriptor.

When one of those two options is specified the "API server listening
at:" message will also be redirected to the specified file/file
descriptor.
This allows clients that want to use the "API server listening at:"
message to do so even if they want to redirect the target's stdout to
another file or device.

Implements #1179, #1523
2019-03-27 14:58:36 -07:00
aarzilli
85e4ba439c proc/core: add support for windows minidumps
Minidumps are the windows equivalent of unix core files.
This commit updates pkg/proc/core so that it can open and read windows
minidumps.

Updates #794
2018-11-21 12:17:16 -08:00
aarzilli
2925c0310a *: function call injection for go 1.11
Implements the function call injection protocol introduced in go 1.11
by https://go-review.googlesource.com/c/go/+/109699.

This is only the basic support, see TODO comments in pkg/proc/fncall.go
for a list of missing features.

Updates #119
2018-07-13 13:37:54 -07:00
aarzilli
454491ce86 service,logflags: log all RPC messages
We occasionally receive bug reports from users of VSCode-go and GoLand.
GoLand has its own way of capturing the packet exchange between itself
and delve but VSCode-go (supposedly) doesn't.
So far this hasn't been a problem since all bug reports were obvious
bugs on the plugin or easy to reproduce without VSCode-go, but it might
be helpful in the future to have a way to log the packet exchange
between dlv and a frontend.

This commit adds a --log-output option to enable logging of all rpc
messages and changes service/rpccommon accordingly.
2018-06-14 09:27:38 -07:00
aarzilli
5155ef047f proc,dwarf/line: support is_stmt and prologue_end flags
Go1.11 uses the is_stmt flag of .debug_line to communicate which
assembly instructions are good places for breakpoints, we should
respect this flag.

These changes were introduced by:
* https://go-review.googlesource.com/c/go/+/102435/

Additionally when setting next breakpoints ignore all PC addresses that
belong to the same line as the one currently under at the cursor. This
matches the behavior of gdb and avoids stopping multiple times at the
heading line of a for statement with go1.11.

Change: https://go-review.googlesource.com/c/go/+/110416 adds the
prologue_end flag to the .debug_line section to communicate the end of
the stack-split prologue. We should use it instead of pattern matching
the disassembly when available.

Fixes #550

type of interfaces
'c7cde8b'.
2018-06-11 11:09:02 -07:00
aarzilli
8ce88095c6 cmd/dlv: Revert 4e177b, use new flag name for debug logging options
Previously to 4e177bb99acc511897f9cdbfc6cbc50d92ae4725 it was possible
to use --log without arguments to enable logging, this commit reenables
that use case.

The new functionality of the --log flag moved to a new flag name
--logx.

Fixes #1188
2018-04-26 09:45:52 -07:00
aarzilli
f27c91ba3c Documentation: automatically check that documentation is up to date
Since we always forget to update the documentation lets check this
automatically.
2018-04-18 10:48:55 -07:00
Derek Parker
38ddb22b68 Documentation: generate new docs (#1185) 2018-04-18 08:46:55 +02:00
Lucas Molas
c38d6755f0 Documentation: update usage docs (#1095) 2018-01-25 11:54:00 -08:00
Alessandro Arzilli
a90893f532 path/to/binary is the required argument (#847 fixed) (#884)
* cmd: include replay command in docs even if rr is not installed.

* path/to/binary is the required argument

Replaces #847
2017-06-20 10:36:07 -07:00
Alessandro Arzilli
a843f7944e proc/gdbserial: mozilla rr support (#804)
Implements #727
2017-05-05 15:17:52 -07:00
Jason Biegel
cd2a875459 Add flag support documentation (#740) 2017-02-16 11:05:48 -08:00
Derek Parker
93d82ca8d2 dlv/cmds: Improve subcommand help output 2016-05-20 20:32:16 +02:00
Alessandro Arzilli
af4798e2a9 service,terminal: APIv2 plus method to select API version (#460)
New API version with better backwards compatibility plus mechanism to
select the API version that a headless instance should use.

Adds service/test/cmd/typecheckrpc.go to type check the RPC interface.
2016-04-18 12:20:20 -07:00
Sam Zaydel
26ce16f1db docs: Changed word from singular to plural form to better fit context. (#491) 2016-04-08 14:12:38 -07:00
Derek Parker
63a660820e docs: Move wiki docs into Documentation dir
Going forward, all documentation should be placed in the Documentation
directory in the root of the project. This switch allows maintainers to
approve updates to documentation before they are committed, as opposed
to the pre-existing wiki which anybody could modify.

Currently the Documentation directory includes docs on building, usage,
and minimal docs around the API. This is just the initial commit, and
documentation will continue to improve over time.

Some changes have been made (and will continue to be made) to `cmd/dlv` to
ensure we can auto-generate documentation for all commands from the
newly provided script `scripts/gen-usage-docs.go`, which can be invoked
via `go run scripts/gen-usage-docs.go`.

Additionally, version has been split into its own package. This was a
bit of housekeeping related to the changes made the `cmd/dlv`.
2016-02-19 10:47:46 -08:00