Adds a '-r' option to the 'restart' command (and to the Restart API)
that re-records the target when using rr.
Also moves the code to delete the trace directory inside the gdbserial
package.
* 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.
* *: 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
* Add --continue to continue process on launch/attach
* Add small test of --continue
* regenerate usage docs
* minor cleanup
* Use similar approach to `trace` and connect and detach using a client instance
* back out previous attempt
* regen usage doc
* fix up continue test
* fix TestContinue to properly test --continue
* back out unnecessary changes
* update faq
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.
* *: 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
The repository is being switched from the personal account
github.com/derekparker/delve to the organization account
github.com/go-delve/delve. This patch updates imports and docs, while
preserving things which should not be changed such as my name in the
CHANGELOG and in TODO comments.
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
This patch allows the `trace` CLI subcommand to display return values of
a function. Additionally, it will also display information on where the
function exited, which could also be helpful in determining the path
taken during function execution.
Fixes#388
Adds an --exec flag for the trace subcommand allowing users to specify a
pre-compiled binary to exec and trace.
Also adds a --test flag as a convienance for compiling and tracing a
test binary.
Fixes#1073
Fix a bug where the regexp would be used as a package string
incorrectly. This would manifest when trying to execute the trace
subcommand as `dlv trace <regexp>` without specifying a package
identifier. The `<regexp>` would be passed to the Go build command
causing an error.
Replace the socket connection with an in-memory connection (created by net.Pipe) for non-headless uses of delve.
This is faster and more secure.
Fixes#1332
This changes make `dlv` support multifile specifically when dlv `debug`,
`trace` and `test`. Just like `dlv debug a.go b.go`. Corresponding to
`go build a.go b.go`.(a.go and b.go are belong to `main` package).
Fix#984.
Use the same connect code path whether we started the server (with
debug/exec/test) or we didn't (i.e. the 'connect' subcommand).
This fixes a bug where the init file was ignored with the 'connect'
subcommand and hopefully prevents future divergence between the
behavior of 'connect' and the other subcommands.
Fixes#1301
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
This pull request makes several changes to delve to allow headless
instancess that are started with the --accept-multiclient flag to
keep running even if there is no connected client. Specifically:
1. Makes a headless instance started with --accept-multiclient quit
after one of the clients sends a Detach request (previously they
would never ever quit, which was a bug).
2. Changes proc/gdbserial and proc/native so that they mark the
Process as exited after they detach, even if they did not kill the
process during detach. This prevents bugs such as #1231 where we
attempt to manipulate a target process after we detached from it.
3. On non --accept-multiclient instances do not kill the target
process unless we started it or the client specifically requests
it (previously if the client did not Detach before closing the
connection we would kill the target process unconditionally)
4. Add a -c option to the quit command that detaches from the
headless server after restarting the target.
5. Change terminal so that, when attached to --accept-multiclient,
pressing ^C will prompt the user to either disconnect from the
server or pause the target process. Also extend the exit prompt to
ask if the user wants to keep the headless server running.
Implements #245, #952, #1159, #1231
Implements structured logging via Logrus. This gives us a logger per
boundry that we care about, allowing for easier parsing of logs if users
have more than one log option enabled. Also, cleans up a lot of
conditionals in the code by simply silencing the logger at creation as
opposed to conditionally logging everywhere.
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.
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'.
Change the linux verison of proc/native and proc/gdbserial (with
debugserver) so that they let the target process use the terminal when
delve is launched in headless mode.
Windows already worked, proc/gdbserial (with rr) already worked.
I couldn't find a way to make proc/gdbserial (with lldb-server) work.
No tests are added because I can't think of a way to test for
foregroundness of a process.
Fixes#65
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
* command/terminal: allow restart to change process args
Add -args flag to "restart" command. For example, "restart -args a b c" will
pass args a b c to the new process.
Add "-c" flag to pass the checkpoint name. This is needed to disambiguate the
checkpoint name and arglist.
Reverted unnecessary changes.
* Applied reviewer comments.
Vendored argv.
Change the syntax of restart. When the target is is in recording mode, it always
interprets the args as a checkpoint. Otherwise, it interprets the args as
commandline args. The flag "-args" is still there, to handle the case in which
the user wants to pass an empty args on restart.
* Add restartargs.go.
Change "restart -args" to "restart -noargs" to clarify that this flag is used to
start a process with an empty arg.
* Support --output for debug, trace, and test commands
With the `--output` parameter you can configure the output binary. For
example:
dlv debug --output /tmp/xxx
Will build the binary to `/tmp/xxx`, instead of always putting it as
`debug` in the current directory.
This ensures that the command always works (even if there is already a
file or directory named `debug`) and doesn't write to the source
directory. Especially for things like Delve/Vim integration this is a
good thing to have, I think.
* Address PR feedback and add a test
- We don't need to use `filepath.IsAbs()` on startup; I added that
because it previously did `"./" + debugname` everywhere, but I don't
think that's needed at all, since `pathname` without a leading `./`
implies the current directory.
- Repurpose the existing `TestIssue398` to also test the `--output`
flag. Also fix an issue where tests wouldn't work if `GOPATH` has
multiple entries (e..g `GOPATH=$HOME/go:$HOME/mygocode`).
- Print an error if we can't remove the debug binary on exit instead of
failing silently. Not strictly related to this PR, but a good change
to add I think.
* Also warn when delve can't remove the binary in test/trace
I only added that to debug, but good to issue this warning consistently.
By specifying the -a flag we insure that all packages are recompiled
with -gcflags='-N -l'. Previously -a could not be specified because the
compiler could not compile runtime without optimizations.
Fixes#738
Mozilla RR will create a trace directory that can be reused with the
replay verb, however if we delete the executable file the trace
directory will become useless, so delete that too before exit.
Users that wish to reuse a recording should build the executable
themselves and then use either dlv exec or rr record to do the
recording.
* Fix various issues detected by megacheck
I've ran honnef.co/go/tools/cmd/megacheck and fixed a few of the
things that came up there.
* Cleanup using Gogland
* proc: Add `wd` to Launch
This change adds the `wd` arg which specify working directory of the
program.
Fixes#295
* service/debugger: Add `Wd` field to debugger.Config
This change adds the `Wd` field which specify working directory of the
program launched by debugger.
Fixes#295
* service: Add `Wd` to service.Config
This change adds the `Wd` field which specify working directory of the
program debugger will launch.
Fixes#295
* cmd/dlv: Add `Wd` flag
This change adds `Wd` flag which specify working directory of the
program which launched by debugger.
Fixes#295
* only set the Linux working directory if it is set,
stub out param in darwin and windows
* set working directory for Windows
https://godoc.org/golang.org/x/sys/windows#CreateProcesshttps://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
* Windows workingDir must be an *uint16
* attempt to chdir on darwin via @yuntan
* proc/exec_darwin.c: fix working directory for darwin
* Add tests to check if working directory works.
* Fix darwin implementation of fork/exec, which paniced if
child fork returned.
* cmd, service: rename Wd to WorkingDir
Allows quoted substrings in build-flags flag. This fixes a build
problem on windows where the default build flags must contain a space.
Fixes#634 and #638