Commit Graph

17 Commits

Author SHA1 Message Date
Hyang-Ah Hana Kim
30b70bc606
service/dap: accept a string list as launch request's buildFlags (#3496)
This change accepts both string type and []string. dap.BuildFlags
is a union of string and []string.

Fixes #2718
For golang/vscode-go#1831, golang/vscode-go#1027
2023-09-19 09:32:15 -07:00
Oleksandr Redko
0e3cae9dc9
service/dap: fix typos in comments (#3438) 2023-07-11 16:10:41 +02: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
13ad7dc1d5
*: misc improvements to config command and substitute-path rules (#3335)
A series of interconnected changes to both the terminal command
'config', DAP command 'dlv config', quality of life improvements to how
substitute-path works, and better documentation.

- Let 'config substitute-path' show the current substitute path rules
- Add a -clear command to 'config substitute-path'
- Support 'config-debug-info-directories'
- rewrite SubstitutePath to be platform independent (see below)
- document path substitution more

Regarding the rewrite of SubstitutePath: the previous version used
runtime.GOOS and filepath.IsAbs to determine which filepath separator to use
and if matching should be case insensitive. This is wrong in all situations
where the client and server run on different OSes, when examining core files
and when cross-compilation is involved.

The new version of SubstitutePath checks the rules and the input path to
determine if Windows is involved in the process, if it looks like it is it
switches to case-insensitive matching. It uses a lax version of
filepath.IsAbs to determine if a path is absolute and tries to avoid having
to select a path separator as much as possible

Fixes #2891, #2890, #2889, #3179, #3332, #3343
2023-05-02 12:23:59 -07:00
Oleksandr Redko
cc71863594
service: fix typos in comments (#3344) 2023-04-27 13:39:33 -07:00
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
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
Hyang-Ah Hana Kim
21bdb466f1
dap: support 'Env' attribute for launch requests (#2846)
* dap: support 'Env' attribute for launch requests

Env is applied in addition to the delve process environment
variables. The env setting is done by calling os.Setenv
as early as possible when a Launch request is received.

Prior discussion is in https://github.com/go-delve/delve/pull/2582

In Visual Studio Code, setting null for an environment variable
in launch.json or tasks.json indicates users want to unset
the environment variable. Support the behavior by accepting
nil value.

* dap: Env field itself can be omitempty

* edit comment
2022-01-06 09:01:09 -08:00
Suzy Mueller
a4ac69e87d
service/dap: support goroutine filters in dap (#2759)
* service/dap: filter goroutines

* adjust defaults

* add tests

* remove label change

* fix typos

* send invalidated areas

* respond to review, and allow to clear goroutineFilters
2021-12-07 09:23:55 -08:00
polinasok
d0898e4de1
service/dap: misc remote attach improvements (#2778)
Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com>
2021-12-07 09:23:26 -08:00
Suzy Mueller
b99d5f5971
service/dap: add option to hide system goroutines (#2743) 2021-10-18 13:13:12 -07:00
Suzy Mueller
99f03597c3
service/dap: add registers configuration for variables response (#2742) 2021-10-15 13:57:50 +02:00
polinasok
8a9f141d51
service/dap: log parsed and applied launch configs (#2732)
* service/dap: log parsed and applied launch configs

Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com>
2021-10-13 12:05:47 -07:00
polinasok
b3b177dc40
service/dap: rename delveCwd to dlvCwd and clarify comments (#2734)
Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com>
2021-10-07 11:28:15 +02:00
Hyang-Ah Hana Kim
fa10cec9fa
dap: support delveCwd and use a temporary file as default debug binary (#2660) 2021-10-05 13:40:17 +02:00
polinasok
2b306e32a6
service/dap: initial remote attach (handler support only) (#2709) 2021-09-24 13:43:46 +02:00
Hyang-Ah Hana Kim
1433c07957
dap: define LaunchConfig/AttachConfig types (#2571)
Formally define these types and document their meaning.
We will auto-generate the dlv-dap documentation from these Go type doc.

mapToStruct is a helper that sets the given struct's fields with the
info in map[string]interface{} (launch/attach's Arguments). We achieve
this by reencoding map[string]interface{} to json and decoding back to
the target struct. If go-dap left the implementation-specific arguments
as json.RawMessage and let the implementation decode as needed, this
reencoding could've been avoided.

encoding/json itself does not have mean to enforce required fields.
There was a test case that checks substitutePath elements must set
both from/to fields. Path.UnmarshalJSON implements the check.
I am not yet sure about the need for distinction between missing
'from/to' and empty strings yet. (empty value is useful when dealing with
a binary built with trimpath, right?)

A minor behavior change - previously, if noDebug is not a boolean type,
we ignored the attribute silently. Since we use json decoding, any
mismatched types will cause an error and this non-boolean type noDebug
attribute will result in launch failure.
2021-08-26 14:42:58 +02:00