Commit Graph

22 Commits

Author SHA1 Message Date
Derek Parker
c119e40c6d pkg/terminal: Fix exit status
During a debug session if the process exited and then the user quit the
debug session, the process exit message would display again and Delve
would exit non-zero (specifically with exit code 1) despite nothing
going wrong.

This patch fixes this so that Delve exits with a clean 0 status and the
process exit message is not printed yet again.
2019-12-03 08:39:07 +01:00
Michail Safronov
89d2167c31 pkg/config: add max-variable-recurse parameter (#1626)
* add max-variable-recurse parameter
2019-07-23 14:40:35 -07:00
Brian de Alwis
f67239f302 terminal: prompt to kill remote if process exited (#1621) 2019-07-17 15:54:15 -07:00
qingyunha
114b76aefc terminal: Add breakpoint autocompletion (#183) (#1612) 2019-07-12 10:43:42 -07:00
Alessandro Arzilli
1758823429 terminal: update return value load configuration when it changes (#1602)
Fixes #1598
2019-07-08 10:27:31 -07:00
Alessandro Arzilli
ed35dce7a3 terminal: adds embedded scripting language (#1466)
If the argument of 'source' ends in '.star' it will be interpreted as a
starlark script.
If the argument of 'source' is '-' an interactive starlark repl will be
started.

For documentation on how the starlark execution environment works see
Documentation/cli/starlark.md.

The starlark API is autogenerated from the JSON-RPC API by
script/gen-starlark-bindings.go.
In general for each JSON-RPC API a single global starlark function is
created.
When one of those functions is called (through a starlark script) the
arguments are converted to go structs using reflection. See
unmarshalStarlarkValue in pkg/terminal/starbind/conv.go.
If there are no type conversion errors the JSON-RPC call is executed.
The return value of the JSON-RPC call is converted back into a starlark
value by interfaceToStarlarkValue (same file):

* primitive types (such as integers, floats or strings) are converted
  by creating the corresponding starlark value.
* compound types (such as structs and slices) are converted by wrapping
  their reflect.Value object into a type that implements the relevant
  starlark interfaces.
* api.Variables are treated specially so that their Value field can be
  of the proper type instead of always being a string.

Implements #1415, #1443
2019-07-02 10:55:27 -07:00
Derek Parker
4c9a72e486 *: Update import name to github.com/go-delve/delve
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.
2019-01-04 19:43:13 +01:00
aarzilli
d7d4c144c8 cmd/dlv,terminal: fix accept-multiclient behavior
1. Check IsMulticlient and send stop request before doing anything
   else.
2. Allow init file to call 'exit'

Fixes #1430
2018-12-03 09:58:29 -08:00
zavla
c7399ac278 terminal: correctly gueses path separator used in source files paths (#1418)
Fixes an error in wrongly appending os.PathSeparator to source file path on Windows in case of path substitution config option.
2018-11-27 13:42:21 -08:00
Russ Magee
4e4ed02948 config,terminal: Add source-list-line-color configuration option
This change adds a config flag to specify the foreground color of
line numbers for the source list command.
2018-10-10 11:24:29 -07:00
Derek Parker
c3f50742b9 *: Misc refactors, and doc additions
Refactors some code, adds a bunch of docstrings and just generally fixes
a bunch of linter complaints.
2018-09-19 20:59:35 +02:00
aarzilli
9a216211d3 proc,terminal,service: let headless instances run without connected clients
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
2018-06-26 10:32:40 -07:00
aarzilli
60c58acb8e proc,service: display return values when stepping out of a function
Displays the return values of the current function when we step out of
it after executing a step, next or stepout command.

Implementation of this feature is tricky: when the function has
returned the return variables are not in scope anymore. Implementing
this feature requires evaluating variables that are out of scope, using
a stack frame that doesn't exist anymore.

We can't calculate the address of these variables when the
next/step/stepout command is initiated either, because between that
point and the time where the stepout breakpoint is actually hit the
goroutine stack could grow and be moved to a different memory address.
2018-06-12 11:35:56 +02:00
aarzilli
8efff6e514 terminal: always initialize conf
So we don't have to worry about having a nil conf field, even if there
is no configuration.
2018-05-07 10:48:26 -07:00
Yuval Kohavi
a0be330319 check that t.conf is not nil in loadConfig 2018-05-04 14:16:49 -07:00
Josh Soref
1d3b41f64e all: Spelling 2018-03-20 11:05:35 +01:00
aarzilli
449b3cedef proc: manual stop requests should clear internal breakpoints
Fixes #1145
2018-03-08 12:02:29 -08:00
aarzilli
03139e8f62 terminal: disable file path case normalization on macOS
Fixes #1088
2018-01-28 01:50:02 -08:00
aarzilli
48288edd18 terminal: add config command
Fixes #927, #644
2017-09-08 10:27:32 -07:00
aarzilli
86a59c52a6 terminal: bugfix: tolerate spurious spaces after command prefixes
Expressions such as:

 frame 0    list
 frame   0   list
 on abreakpoint     print x
 goroutine    1    frame     0     list

should all execute correctly

Fixes #712
2017-04-19 09:58:36 -07:00
Zhou Tao
28a0e5bd63 terminal: trim space in interactive console (#770)
When running interactive command in gdb, it will remove beginning space,
so do the same for dlv, which will be more convient for user
2017-03-21 14:41:02 -07:00
Derek Parker
53f0d24057 Move top-level packages into pkg 2017-02-08 12:17:19 -08:00