Commit Graph

22 Commits

Author SHA1 Message Date
Ruijie Chen
20df19e33b
service/dap: Add support for empty string in substitutePath (#3088)
This changes adds the support to replace relative paths sources with "" as rapresenting current directory.
For example:
Rule like '{from: "", to: "/my/project"}' will map path "src/my/code.go" into "/my/project/src/my/code.go"
Rule like '{from: "/my/project", to: ""}' will map path "/my/project/src/my/code.go" into "src/my/code.go"

Fixes #3082
2022-08-14 16:01:39 +02:00
Alessandro Arzilli
1fe03e728c
terminal: add ability to show disassembly instead of source (#3047)
Adds ability to show current position as disassembly instead of source
listing every time execution stops. Change default to show disassembly
after step-instruction and source listing in every other case.

Fixes #2878
2022-07-14 14:08:47 -07:00
Alessandro Arzilli
c412dcdc4f
*: run go1.19 'go fmt' on everything and fix problems (#3031)
Go 1.19 also formats doc comments according to the new godoc syntax.
Some of our comments, especially unexported symbols did not conform to
the godoc syntax and therefore are mangled by 'go fmt'.

This PR runs 'go fmt' from go1.19 on everything and manually fixes the
problems.

See also:
	https://github.com/golang/proposal/blob/master/design/51082-godocfmt.md
2022-06-17 10:08:11 -07:00
Suzy Mueller
922c4cebd4
service/dap: add config expressions to evaluate requests (#2750)
We want to provide more flexibility for users to make changes to their configurations while the debug session is running. This could be accomplished by creating a custom request, but that were require a new UI as well, and every client of dlv dap to provide its own UI for this. By using the evaluate context, users can use the already existing debug console to change their configurations.

This change includes a refactor of the terminal code in order to share the code with the dap package.

This change provides a very similar to UI as the terminal package, but there are different configuration options that are DAP specific. We plan to use this same mechanism to expose a few other commands including "sources" to help users debug an ineffective substitutePath configuration.
2021-10-29 19:35:13 -07:00
Alessandro Arzilli
6cf7a7149d
cmd/dlv,config: obey logflags config for LoadConfig warnings (#2701)
LoadConfig warnings should obey the logflags configuration and should
also be delayed until after the "listening at" message, which should
always be the first thing output.

Co-authored-by: Suzy Mueller <suzmue@golang.org>
2021-10-13 18:46:20 -07:00
Johannes Altmanninger
45f44bc218
Prefer string variant for source-list-line-color config option (#2676)
The string variant is more powerful and can be passed
directly to "echo -e" / "printf" and friends.

Remove the mention of the integer variant from the default config. This
makes the option appear more consistent with other color options.
The user shouldn't care about the historic differences.
2021-09-01 10:03:58 -07:00
Alessandro Arzilli
8e91d3b0bf
terminal: Go syntax highlighting for listings (#2294)
Fixes #1273
2021-01-28 07:08:14 -08:00
Anders Kaare
71a460fc0f
config: add option for printfile() line count (#2043)
The option is "source-list-line-count". It defaults to 5, which was previously
hardcoded in printfile(), but now you can change it dynamically, for instance:

 $ config source-list-line-count 20
 $ list
2020-05-11 09:50:25 -07:00
chainhelen
37bee98a88 pkg/config: add disassemble-flavor option for config
Allow user to specify output syntax flavor of assembly in the
disassemble command.

Close #415
2020-04-23 12:10:05 -07: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
Gregorio Martinez
c1a39c6fe0 pkg/config: try to use XDG_CONFIG_HOME when present
* config/config.go

This change checks for the environmental variable XDG_CONFIG_HOME
before storing the configuration file in the home directory.

Closes #1454

* config/config.go

This change attempts to move the previous config file location to the
new XDG_CONFIG_HOME compliant location on linux systems or when
XDG_CONFIG_HOME is set.

This change removes the old config file location if the file is
successfully moved.

* config/config.go

Consolidate messages about config moving and clean up into one.
Remove extraneous newlines.

* pkg/config: config path error messages print to stderr

This change updates the output location of error messages related to
the config path. This will prevent clients from getting unexpected output
when an error occurs.

* pkg/config: Update path used when returning unable to move config error

This change fixes the error message when Delve was unable to move the config. Previously returned a FileInfo object not the file path.

* pkg/config: Remove check for stderr when printing error messages

* pkg/config: Move success message for moving config to stderr

This prevents the success message from being printed to stdout and
breaking frontends.

* pkg/config: Rename variable to be more descriptive
2019-02-11 14:22:44 -08:00
Chandrashekhara A
6611fbe919 pkg/config: Using current directory for config as fallback (#1425)
*  pkg/config: Using current directory to store config if getting user details fails.

    This patch is to use current directory to store config file.
    user.Current() call fails when dlv is run inside a container. (Alpine)

* Addressing comments

* Removed whitespace
2018-11-28 13:21:21 -08:00
Sergio Lopez
dc208bc0c3 pkg/config: Use a default value for DebugInfoDirectories
If DebugInfoDirectories is empty, set it to same value as we have in the
default configuration.

This is useful for users which already have an older config file.
2018-11-26 09:54:31 -08:00
Sergio Lopez
46923142cb pkg/config: Rewind *File after writeDefaultConfig
Otherwise the later call to ioutil.ReadAll will return an empty array.

This issue is visible from the user's perspective due to the new
debug-info-directories parameter, which does have a value in the default
config.

As a consequence, the first 'dlv' invocation fails to find the separate
debug info files, while the second one works as expected:

$ ./dlv core /usr/bin/dockerd-current /case/dockerd.1234
could not find external debug info file
$ ./dlv core /usr/bin/dockerd-current /case/dockerd.1234
Type 'help' for list of commands.
(dlv) exit
2018-11-26 09:54:31 -08:00
Derek Parker
51c342c6b7 pkg/prog: Improve support for external debug info
Adds a config file option to allow specifying a list of directories to
search in when looking for seperate external debug info files.

Fixes #1353
2018-11-08 10:16:42 -08:00
Derek Parker
2f746e1d3c pkg/config: Clean up godoc lint issues 2018-11-08 10:16:42 -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
678576d2ce config: Return handle for created default config (#1130)
Previously the file handle for the newly created default config was
being closed and thrown away as opposed to returned to the caller to
finish setting up config for the rest of the process. This patch changes
to return a handle to the newly created config so setup can happen as
normal. This fixes a bug where Delve can crash on first run when a
config is not present on the system.

Fixes #1129
2018-02-20 20:24:05 +01:00
aarzilli
1758f8523a pkg/terminal: print DWARF location expression with whatis
Adds a configuration option (show-location-expr) that when activated
will cause the whatis command to also print the DWARF location
expression for a variable.
2017-12-20 16:34:47 -08:00
aarzilli
48288edd18 terminal: add config command
Fixes #927, #644
2017-09-08 10:27:32 -07:00
Florin Pățan
32a005de2b Fix various issues detected by megacheck (#880)
* 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
2017-06-29 11:15:59 -07:00
Derek Parker
53f0d24057 Move top-level packages into pkg 2017-02-08 12:17:19 -08:00