-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dlv dap: remote connect (aka remote attach) #2328
Comments
@hyangah has expressed a concern that currently remote users are able to use a dlv-connect or a GoLand client alongside VS Code with the same headless remote server. But if the remote server can only serve DAP, that would not be possible even if we support |
@polinasok thanks for the detailed documentation. My concern is that the remote debugging workflow using DAP will be significantly different from the workflow well-established in the go community. Users have to define a different debug container. Depending on the editors and cli, they have to use different dlv commands. IMO, this is harmful for both VS Code users and the users of other editors and programs that depend on json-rpc. Instead of introducing a new set of commands, what do you think about the following approaches?
I am personally in favor of 2) because it allows users to keep using their current dev/debug container definition, and affects users least. But I am afraid this additional capability will add complexity to dlv dap implementation. -- Sometimes VS Code users rely on |
This high-level goal is to push more shutdown logic into Session and not rely Server.Stop() because dap's version of Stop() is different from rpccommon. That means triggering the same shutdown steps in multiple places, so additional safeguards are added to make some of the duplicate steps no-ops to avoid errors, extra logging, etc. This includes the following changes: close client conn when request loop in serveDAPCodec exits (to match rpccommon) exit request loop after processing a disconnect request (instead of relying on next read to fail because conn got closed by triggered Stop(), which is skipped in case of accept-multiclient and is not closed in Stop() in rpccommon) reset debugger to nil to avoid shutting it down more than once and causing duplicate logging (in case stopDebugSession is called from onDisconnectRequest and Server.Stop or Session.Close as things shut down) reset binaryToRemove to "" upon removal to avoid duplicate error (in case Close() is called more than once outside of Stop(), which technically is not the case right now) expand testing for all possible server shutdown triggers testing for Session-only shutdown as it will be integrated into rpccommon without dap.Server wrapper updates golang/vscode-go#1830 updates #2328 Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com>
I might be reading this wrong, but is there a way to attach to a remote PID via go-delve right now? E.g. some go binary is running in a container, and I want to attach to the PID of that from outside the container. |
@aaomidi Here is the vscode-go debugging documentation:https://github.com/golang/vscode-go/blob/master/docs/debugging.md#remote-debugging |
commit d95f26c4bd2ad9f7a92de54bc4525219104b7ed3 Author: Alessandro Arzilli <alessandro.arzilli@gmail.com> Date: Thu Jan 6 18:07:53 2022 +0100 proc: interpret value of DW_AT_inline correctly (#2859) All values greater than or equal to 1 indicate that the function has been inlined. commit 466f9b8c938727c36a226eafd3333a97c5d51cae Author: Alessandro Arzilli <alessandro.arzilli@gmail.com> Date: Thu Jan 6 18:07:26 2022 +0100 proc: change UserCurrent to exclude internal and runtime/internal (#2853) packages Changes UserCurrent to exclude frames stopped inside the 'internal' and 'runtime/internal' packages of the standard library. Before this change a goroutine blocked accepting or reading from a socket would be reported as having a user current frame of: internal/poll.runtime_pollWait After this change accepting goroutines will be reported with a user current frame of: net.(*netFD).accept and reading goroutines as: net.(*netFD).read commit a2927f6117e9bc630d0766e8b8eabb253fe54cd1 Author: Suzy Mueller <suzmue@golang.org> Date: Thu Jan 6 10:02:19 2022 -0700 service/dap: set min/max addresses for invalid instructions (#2832) commit 66478f21e35f3e8da7bad8cd1ad733699fb479c1 Author: Suzy Mueller <suzmue@golang.org> Date: Thu Jan 6 10:01:47 2022 -0700 pkg/proc: set stop reason for step instruction (#2828) * service/dap: move presentationHint to frame from source * pkg/proc: set stop reason for step instruction commit 21bdb466f181970e4881bc05f4784c736c693657 Author: Hyang-Ah Hana Kim <hyangah@gmail.com> Date: Thu Jan 6 12:01:09 2022 -0500 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 commit 79d5db24a57f6b512488ea8150c1bb21e913ce3f Author: Fabio Falzoi <fabio.falzoi84@gmail.com> Date: Thu Jan 6 18:00:46 2022 +0100 Automatically disable breakpoints with hitcount conditions that will never be satisfied again (#2833) * service/debugger: disable breakpoints with hitcond not satisfiable To avoid slowing down the debugged process unnecessarily, we disable breakpoints with a hit condition that can no longer be hit again. * test: add integration tests for hit conditions no more satisfiable * proc/test: fix typo in breakpoints related tests * test: use the new API for hitcond integration tests commit 7afe6407730b777de89a371c5bf0dae19d345d1a Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Thu Jan 6 08:58:08 2022 -0800 Documentation: add DAP API page (#2856) * Documentation: add DAP API page * Respond to review feedback * Clarify about Ctrl-C * Add hidden TODO for more things to document Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com> commit 4c1f8b4b2536beb8b06c6a6ef0b0383a7928e188 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Thu Jan 6 08:57:40 2022 -0800 commmands: update DAP overview in help (#2850) Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com> commit f09896a593c044b4c23acb2eeceb6a4661d862ef Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Thu Jan 6 08:57:12 2022 -0800 Documentation: add overview usage info for all dlv commands (#2857) * Documentation: add overview usage info for all dlv commands * Separate trace, adjust headless wording * Add headless command note Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com> commit 0ecdc6e4a9da693e52f0aa7fb38606cb08f24095 Author: Tim Hockin <thockin@google.com> Date: Thu Jan 6 08:56:21 2022 -0800 pkg/terminal: Support `b` and `t` without a linespec (#2863) This could probably be more user-friendly, in that you can't give a name to such a breakpoint. To add support for names, we would need to try a single arg first as a location, and if that fails try it as a name for current line. That seems somewht dubious, so I didn't try. commit 5842c1fe9e4009ebf020839fe4901a24c930ecb3 Author: Suzy Mueller <suzmue@golang.org> Date: Tue Jan 4 04:03:20 2022 -0700 service/dap: fix race in no debug test (#2766) Check for a possible output event when disconnecting from a process that has already exited. Fixes #2763 commit fcc9561cbeb4ed333a7ecac9d1aeea42fb695ed9 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Mon Jan 3 01:58:13 2022 -0800 service/dap: update request inventory comments and labels in Server.handleRequest (#2854) Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com> commit 661cb3369949ca0c55c262978fa200c4131af729 Author: Derek Parker <parkerderek86@gmail.com> Date: Thu Dec 30 11:14:37 2021 -0800 pkg/proc: switch to Dual MIT/GPL license for ebpf (#2849) commit a88c9bde4ac6d58543748ef0482e78883fd90e61 Author: Derek Parker <parkerderek86@gmail.com> Date: Thu Dec 30 00:04:59 2021 -0800 pkg/proc: add build scripts & docker image for ebpf (#2847) Adds a few build scripts and a container image for reproducible builds of the ebpf programs. commit 38410993c9b2f4774b16ec1f1b56d0762a5ceef9 Author: Derek Parker <parkerderek86@gmail.com> Date: Thu Dec 23 10:25:21 2021 -0800 v1.8 (#2840) * v1.8 commit 4a94b3eff2a822e57ee60d7946d4bf29d1a8d2a6 Author: Alessandro Arzilli <alessandro.arzilli@gmail.com> Date: Wed Dec 22 19:26:21 2021 +0100 Updates for go1.18beta1 (#2831) * go.mod: update golang.org/x/tools to v0.1.8 Fixes TestGeneratedDoc on go1.18 * TeamCity: bump test matrix Add 1.18 to test matrix. Remove 1.15 from test matrix and from support range. * proc,tests: update for regabi on arm64 and 386 Make sure that stacktrace registers always contain the PC register of the current frame, even though the debug_frame rules might not specify it on architectures that use a link register. The PC register is needed to look up loclist entries for variable evaluation. * goversion: bump maximum supported Go version to 1.18 * proc: disable asyncpreempt on linux/arm64 Asyncpreempt on linux/arm64 can sometimes restart a sequence of instructions which will make breakpoint appear to be hit twice in some cases. commit 07bcf0cb130d348320078dc7e6bb2b7c8b9e8392 Author: Alessandro Arzilli <alessandro.arzilli@gmail.com> Date: Wed Dec 22 18:38:39 2021 +0100 Documentation: document runtime.curg and runtime.frameoff (#2835) commit b81f618fb3aacbc0245db655be8230abccb8f8c8 Author: Alessandro Arzilli <alessandro.arzilli@gmail.com> Date: Tue Dec 14 15:26:08 2021 +0100 proc/native: ignore 'pf' mappings during core dump creation (#2761) Fixes #2630 commit b192d8467018b922864e0e51f1df8d0b8c4fe84a Author: Alessandro Arzilli <alessandro.arzilli@gmail.com> Date: Mon Dec 13 20:41:28 2021 +0100 service: use name w/o parameters for breakpoints on generic funcs (#2774) When printing breakpoints on generic functions use the function name without parameters instead of using the name of the first instantiation that appears on the list. commit 617d934d3e722c2f61d25af2b4c5e5a788a9a668 Author: Alessandro Arzilli <alessandro.arzilli@gmail.com> Date: Mon Dec 13 20:39:20 2021 +0100 proc/gdbserial: allow rewind to work after process exit with rr (#2815) * service/debugger: fix bug internal err with Restart on recorded target If Restart is called after a Continue and Rewind on a recorded target that has already terminated it will return an internal error. * proc/gdbserial: allow rewind to work after process exit with rr It is sometimes useful to set breakpoints and rewind a terminated process when using rr, for example if interested in the last execution of some function. RR will not allow a backward continue after the process exit packet has been sent, however rr will also generate a synthetic SIGKILL right before process exit. Treat this packet as a process exit and change some things so both continuing backwards and setting breakpoints can be done, on recorded targets, after process exit has been reported. commit 3d334e4a5bb51e85569117ff4a48a8d89cf85534 Author: Zhaoyang <zywangzhaoyang@163.com> Date: Tue Dec 14 02:25:23 2021 +0800 fmt code (#2826) commit d514b4c6e9e7fa108630e9968b286a425e58565b Author: Herby Gillot <herby.gillot@gmail.com> Date: Mon Dec 13 13:24:41 2021 -0500 _scripts: add option to disable invoking git during build (#2798) This is useful to be able to build using Delve's build scripts when working from within a directory that has been extracted from a source tarball, or wherever we wouldn't have git history. This can be invoked as: ``` go run _scripts/make.go build --no-git ``` commit c0fa4e32d7ccaf135364d0a7fd7af7effeed8e64 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Sun Dec 12 10:30:21 2021 -0800 Documentation: add more installation instuctions (#2824) Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com> commit 15bb95ccc328d9b7ee59b3f2c7e1cd9f02c2435c Author: kaddy-tom <71744781+kaddy-tom@users.noreply.github.com> Date: Fri Dec 10 20:52:05 2021 +1100 terminal/command: fix up OoB in `deferred` command (#2823) Prior to this, sending a `deferred` command with no arguments would immediately crash the debug session. commit 2f13672765fead22e5376fb4754c48a96c33cc0b Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Wed Dec 8 02:37:35 2021 -0800 service/dap: fix compile error from merge conflict (#2818) Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com> commit a4ac69e87df34bc7619fb6119db25816f5cf1ae1 Author: Suzy Mueller <suzmue@golang.org> Date: Tue Dec 7 12:23:55 2021 -0500 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 commit d0898e4de13e4ac3dcade0f10b774cb7d4fe3a9c Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Tue Dec 7 09:23:26 2021 -0800 service/dap: misc remote attach improvements (#2778) Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com> commit b8a9ae26f6bec3b43f0db978a4bf6502260878de Author: Alessandro Arzilli <alessandro.arzilli@gmail.com> Date: Tue Dec 7 18:21:53 2021 +0100 proc: fix signal handling during stepping (#2803) Fix signal handling during thread single stepping so that signals that are generated by executing the current instruction are immediately propagated to the inferior, while signals other signals sent to the thread are delayed until the full resume happens. Fixes a bug where a breakpoint set on an instruction that causes a SIGSEGV would make Delve hang and a bug where signals received during single step would make it look like an instruction is executed twice. Fixes #2801 Fixes #2792 commit 2cd9d268d35d9df702ee853064aac2fd51dcc16d Author: Alessandro Arzilli <alessandro.arzilli@gmail.com> Date: Tue Dec 7 18:20:10 2021 +0100 proc: add dummy files to fix vendoring of Delve (#2807) Add some dummy go files so that 'go mod vendor' works for modules that require Delve, becuase directories that do not contain any go code will not be vendored. commit 1a815365d552baab5730f23b17193d447cb190c2 Author: hitzhangjie <hit.zhangjie@gmail.com> Date: Thu Dec 2 19:17:47 2021 +0800 godwarf/type: fix typo (#2813) commit 3833c3d029645915254739ca222b6a4ac3f9dc3c Author: Suzy Mueller <suzmue@golang.org> Date: Wed Dec 1 04:57:03 2021 -0500 service/dap: move presentationHint to frame from source (#2810) commit 75bbbbb60cecda0d65c63de7ae8cb8b8412d6fc3 Author: Alessandro Arzilli <alessandro.arzilli@gmail.com> Date: Fri Nov 26 17:11:29 2021 +0100 proc: support DWARF5 on Windows/macOS (#2791) * proc: log errors reading debug_info Because of an incorrect use of debug/dwarf.Reader errors encountered while reading debug_info were not reported. Updates #2786 * proc: use debug_line_str section for PE and Macho-O files Updates #2786 commit 01b01423aecbcc00110d680dd6ee20ff905d90e7 Author: Alessandro Arzilli <alessandro.arzilli@gmail.com> Date: Fri Nov 26 17:06:23 2021 +0100 proc/*: minor miscellaneous code cleanups (#2790) * made Pid a method of Target instead of a method of Process * changed argument of NewTarget to ProcessInternal, since that's the interface that backends have to implement * removed warnings about ProcessInternal since there is no way for users of pkg/proc to access those methods anyway * made RecordingManipulation an optional interface for backends, Target supplies its own dummy implementation when the backend doesn't * inlined small interfaces that only existed to be inlined in proc.Process anyway * removed unused function findExecutable in the Windows and no-native darwin backends * removed (*EvalScope).EvalVariable, an old synonym for EvalExpression commit 88dca53e5c6ecc705139700375cdb16ad3a3675b Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Wed Nov 24 13:46:14 2021 -0800 service/dap: fix TestNextParked (#2784) Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com> commit f34a1e6a5ef74be01afc7c4a283a796a93fe09c1 Author: Alessandro Arzilli <alessandro.arzilli@gmail.com> Date: Wed Nov 24 22:45:28 2021 +0100 version: fix build version using buildInfo (#2789) In go1.18 buildInfo will include the git revision hash, use that to fix the Build field of Version so that it is correct even if Delve wasn't built using make.go. commit b69bcf53d692c9168d622c1fbc9c0cf39fdad572 Author: Alessandro Arzilli <alessandro.arzilli@gmail.com> Date: Wed Nov 24 22:44:49 2021 +0100 _scripts: fix test_linux.sh version check (#2785) The version check to disable the buildvcs option is wrong, it doesn't matter now but it will start failing when 1.18.1 is released. commit 935161f8bf30917d9a18b455a46438de6b8c6856 Author: Suzy Mueller <suzmue@golang.org> Date: Wed Nov 24 16:38:37 2021 -0500 service/dap: expose sources command in evaluate request (#2797) * service/dap: expose sources command in evaluate request commit 389cccf08b05a4030cc9d28fc0f17eab9f04f73d Author: Alessandro Arzilli <alessandro.arzilli@gmail.com> Date: Wed Nov 24 22:09:43 2021 +0100 TeamCity: fix scripts selecting Go version (#2804) s/golang.org/go.dev/ commit cba1a524a8015c7caecfe11b694eeb381ed346ac Author: Derek Parker <parkerderek86@gmail.com> Date: Wed Nov 17 07:33:11 2021 -0800 v1.7.3 (#2796) commit a350aafaa730c7559480b8c43e6bfcdf23219f6a Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Wed Nov 17 06:49:09 2021 -0800 v1.7.3 Changelog (#2793) * v1.7.3 Changelog Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com> commit 9013a121d8bc6359018bccfaa1f256a8870d01c7 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Tue Nov 9 00:24:26 2021 -0800 server/dap: stop running command if conn closed - fixes nil dereference bug (#2781) Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com> commit 183bb8dffd9fe164f27f06c1f435100c5daadf54 Author: Alessandro Arzilli <alessandro.arzilli@gmail.com> Date: Wed Nov 3 17:49:26 2021 +0100 TeamCity: disable Windows Defender (#2775) Shaves off 3 minutes out of every windows build. commit cd9e6c02a6ca5f0d66c1f770ee10a0d8f4419333 Author: Derek Parker <parkerderek86@gmail.com> Date: Wed Nov 3 08:58:04 2021 -0700 *: Replace libbpfgo with cilium/ebpf (#2771) commit c207db792a0757e8db7420d6729b3da2608c5f31 Author: Alessandro Arzilli <alessandro.arzilli@gmail.com> Date: Sat Oct 30 20:52:26 2021 +0200 proc,locspec: support setting breakpoints by func name on generic funcs (#2745) * proc,locspec: support setting breakpoints by func name on generic funcs Changes proc.Function to parse function names correctly when they contain instantiation lists and locspec to match generic functions. * vendor: update golang.org/x/tools The old version of golang.org/x/tools is incompatible with the new iexport format. commit 884ef4f3381639745a57cbad421025ccc30f7e8a Author: Alessandro Arzilli <alessandro.arzilli@gmail.com> Date: Sat Oct 30 20:51:02 2021 +0200 proc/gdbserial: workaround for debugserver register set bug (#2770) Debugserver has a bug where writing to a AVX-2 or AVX-512 register does not work unless it is followed by at least a write to a AVX (not 2 or 512) register. See also: https://bugs.llvm.org/show_bug.cgi?id=52362 Fixes #2767 commit af1c36365b6eba164bc397963c7f5a1a6783dc6e Author: Alessandro Arzilli <alessandro.arzilli@gmail.com> Date: Sat Oct 30 15:47:38 2021 +0200 proc/native: disable watchpoints on Windows (#2769) There are persistent issues with watchpoints on Windows, it is not clear whether it's a problem with the VM running the tests or if there is a real bug in our implementation of hardware breakpoints on Windows. Until the cause can be determined watchpoints on Windows will be disabled. Updates #2768 commit 19ce116bb2c14140b0286041cdd72b12f64da590 Author: Suzy Mueller <suzmue@golang.org> Date: Fri Oct 29 22:41:30 2021 -0400 service/dap: allow expression evaluation in log messages (#2747) From the DAP spec: If this attribute exists and is non-empty, the backend must not 'break' (stop) but log the message instead. Expressions within {} are interpolated. This change parses the log messages and stores the parsed values as a format string and list of expressions to evaluate and get the string value of. Updates golang/vscode-go#123 commit f8deab85224b61b2dab6a0cec4ea2ac9234761dc Author: Suzy Mueller <suzmue@golang.org> Date: Fri Oct 29 22:40:16 2021 -0400 service/dap: fix goroutine id selection for hardcoded breakpoints (#2748) * service/dap: fix goroutine id selection for hardcoded breakpoints Determining the stopped goroutine id on a breakpoint required checking for breakpoints since some may be tracepoints. However, there may be goroutines stopped on hardcoded breakpoints with no breakpoint. We fix this by checking for runtime.breakpoint or StopReason=proc.StopHardcodedBreakpoint. commit 922c4cebd4884bb0faca183361f9566da2868984 Author: Suzy Mueller <suzmue@golang.org> Date: Fri Oct 29 22:35:13 2021 -0400 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. commit b48ceec161d567a840def125e33ad734f8171b09 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Tue Oct 26 10:11:55 2021 -0700 service/dap: improve shutdown logic and test coverage (#2749) This high-level goal is to push more shutdown logic into Session and not rely Server.Stop() because dap's version of Stop() is different from rpccommon. That means triggering the same shutdown steps in multiple places, so additional safeguards are added to make some of the duplicate steps no-ops to avoid errors, extra logging, etc. This includes the following changes: close client conn when request loop in serveDAPCodec exits (to match rpccommon) exit request loop after processing a disconnect request (instead of relying on next read to fail because conn got closed by triggered Stop(), which is skipped in case of accept-multiclient and is not closed in Stop() in rpccommon) reset debugger to nil to avoid shutting it down more than once and causing duplicate logging (in case stopDebugSession is called from onDisconnectRequest and Server.Stop or Session.Close as things shut down) reset binaryToRemove to "" upon removal to avoid duplicate error (in case Close() is called more than once outside of Stop(), which technically is not the case right now) expand testing for all possible server shutdown triggers testing for Session-only shutdown as it will be integrated into rpccommon without dap.Server wrapper updates golang/vscode-go#1830 updates #2328 Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com> commit b31565d8aabfdedead0831d579b44805060741f8 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Mon Oct 25 12:39:28 2021 -0700 service/dap: support JSON-RPC and DAP on the same port from "dlv debug/exec/test/attach" (#2755) * Support JSON-RPC and DAP on the same port * Fix test Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com> commit fe100bcb1169e5bcd6835577e77b72881e59bd94 Author: Alessandro Arzilli <alessandro.arzilli@gmail.com> Date: Mon Oct 25 21:38:58 2021 +0200 _scripts: fix latestver.py (#2756) Fix latestver to sort rc and beta versions before normal releases. commit 689e08260be7359776cc14b1c7f8907069132d5a Author: Derek Parker <parkerderek86@gmail.com> Date: Mon Oct 25 12:37:36 2021 -0700 eBPF tracing backend return value parsing (#2704) Add return value parsing for eBPF tracing backend. commit 8ebd2d83aeef44de5011b696de040d20cd8d6395 Author: Alessandro Arzilli <alessandro.arzilli@gmail.com> Date: Mon Oct 18 22:17:47 2021 +0200 Misc fixes for test problems (#2751) * service/dap: remove deadlock in TestLaunchDebugRequest Fixes #2746 * terminal: fix TestScopePrefix flakiness When there are more than 10 frames api.PrintStack will prefix the output with spaces to right justify the frame number, which confuses TestScopePrefix. * _scripts: pass -buildvcs for Go 1.18 and later on TeamCity Go 1.18 will try to stamp builds with the VCS version, this doesn't work on TeamCity because the checkout isn't a valid repository (but looks like it). Pass -buildvcs=false to disable this feature. * proc: switch to goroutine stack if first frame's func can not be found If the first frame on the system stack can not be resolved to a function switch directly to the goroutine stack. commit b99d5f59718932a0dacafcdba5699da29f6eff30 Author: Suzy Mueller <suzmue@golang.org> Date: Mon Oct 18 16:13:12 2021 -0400 service/dap: add option to hide system goroutines (#2743) commit ea18bc6d6d9b05890a477ef7c34e0b1c09b7f869 Author: Alessandro Arzilli <alessandro.arzilli@gmail.com> Date: Mon Oct 18 22:11:59 2021 +0200 proc/native: support watchpoints on linux/arm64 (#2667) commit 99f03597c325e492581fdb94e43aaf18c45e9b74 Author: Suzy Mueller <suzmue@golang.org> Date: Fri Oct 15 07:57:50 2021 -0400 service/dap: add registers configuration for variables response (#2742) commit 9a5d5bc996d9668e0b52c1cb11d2fa0f481ac9fa Author: Alessandro Arzilli <alessandro.arzilli@gmail.com> Date: Thu Oct 14 20:06:14 2021 +0200 proc/gdbserial: support call injection with rr backend (#2740) Normally calls can't be performed on recorded processes, becuase the future instructions executed by the target are predetermined. The rr debugger however has a mechanism that allows this by taking the current state of the recording and allowing it to diverge from the recording, temporarily. This commit adds support for starting and ending such diversions around function calls. Note: this requires rr version 5.5 of later to work, see: https://github.com/rr-debugger/rr/pull/2748 commit c8f6c3a6853760d0ff8cd96368b8b17c86b599aa Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Thu Oct 14 10:58:53 2021 -0700 service/dap: support remote-attaching to running debugger (#2737) Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com> commit ce5238944d4ccb995dc577d23a2f4f5694bc90ae Author: Suzy Mueller <suzmue@golang.org> Date: Thu Oct 14 13:44:36 2021 -0400 service/dap: support disassemble request (#2728) This adds support for disassembling a region of code using the instructionPointerReference value returned in the stack trace request. commit 6cf7a7149d35fe8c349a03caa57627860bf48ddd Author: Alessandro Arzilli <alessandro.arzilli@gmail.com> Date: Thu Oct 14 03:46:20 2021 +0200 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> commit 64f2200202811e3d20812f556fc2a63006eff052 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Wed Oct 13 18:38:22 2021 -0700 service/dap: fix data race for noDebugProcess.ProcessState (#2735) Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com> commit 8a9f141d512e223cfdb3af29ab6eddf62b126acc Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Wed Oct 13 12:05:47 2021 -0700 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> commit 98a0bcf772d161cd6285096e88b6870679df20f6 Author: Hyang-Ah Hana Kim <hyangah@gmail.com> Date: Wed Oct 13 14:43:47 2021 -0400 cmd/dlv: add --client-addr flag to run dap with a predefined client (#2568) This adds a new `--client-addr=host:port` flag to `dlv dap`. If it is supplied, the dap process will dial into the tcp port where a DAP client is waiting, and work with only the DAP client. The DAP client is supposed to start the normal DAP message exchange starting with the 'initialize' request after the dlv dap process dials in and the connection is set up. VS Code Go extension plans to use this mode for * reliably detecting `dlv dap` readiness. Currently it depends on watching the log stream. After this PR, it can listen on a network port. * running `dlv dap` from any terminal (part of RunInTerminal workflow implementation). commit 6c4029c765f8afb049d1de5340f2491c2da7df62 Author: Suzy Mueller <suzmue@golang.org> Date: Wed Oct 13 11:52:06 2021 -0400 service/dap: auto resume execution when setting breakpoints (#2726) A set breakpoints request could come in while the program is running. For a seamless user experience, the server should set the breakpoint and then continue program execution. Updates golang/vscode-go#1676 commit bdcbcc68366980a0347eef8eb3fa959ab6ac3f2b Author: Alessandro Arzilli <alessandro.arzilli@gmail.com> Date: Wed Oct 13 17:44:59 2021 +0200 proc: return error when assigning between function variables (#2692) Fixes #2691 commit 1893c9769b8273a2be81e0a5f38b3c210b815481 Author: Alessandro Arzilli <alessandro.arzilli@gmail.com> Date: Wed Oct 13 17:43:54 2021 +0200 Miscellaneous fixes for Windows native backend (#2736) * proc/native: always stop after RequestManualStop on Windows On Windows RequestManualStop will generate an exception on a special DbgUiRemoteBreakin thread, sometimes this thread will die before we finish stopping the process. We need to account for that and still stop even if the thread is gone and no other thread hit a breakpoint. Fixes flakiness of TestIssue419. * proc/native: fix watchpoints with new threads on Windows When a new thread is created we must reapply all watchpoints to it, like we do on linux. * tests: be lenient on goroutinestackprog tests on Windows We can not guarantee that we find all goroutines stopped in a good place and sometimes the stacktrace fails on Windows. commit d1c888f22aa1d49d3f4ac3063557a104bbc65db9 Author: Suzy Mueller <suzmue@golang.org> Date: Wed Oct 13 11:34:09 2021 -0400 service/dap: set instruction breakpoints (#2716) Support setting instruction breakpoints, this is newly supported in VS Code for the disassembly view. commit 7899e94ff2972a1689355b00c3d933fbd22d9e41 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Wed Oct 13 00:10:55 2021 -0700 _fixtures/loopprog: print less often (#2738) Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com> commit d613f8ec457fa388302f4da189a6962c87e27d44 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Sun Oct 10 06:57:06 2021 -0700 service/dap: use constants for testing error codes (#2741) Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com> commit 3515be1db154659949a18c2d19dc28bcb36cd516 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Sun Oct 10 06:52:52 2021 -0700 service/dap: support accept-multiclient shutdown in remote attach mode (#2731) Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com> commit 69634d5d6023a6aa4bfdd383ba4af4d9ec53b015 Author: Suzy Mueller <suzmue@golang.org> Date: Fri Oct 8 02:58:19 2021 -0400 service/dap: allow "instruction" stepping granularity (#2713) commit 0baf3b7cf1d67e510f968af5b7270114a9c0f4c2 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Thu Oct 7 23:57:51 2021 -0700 service/dap: fix nil dereference when byte array cannot be converted to string (#2733) Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com> commit b3b177dc4052a3f4f314864fc4a04f5aa388150b Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Thu Oct 7 02:28:15 2021 -0700 service/dap: rename delveCwd to dlvCwd and clarify comments (#2734) Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com> commit b2a2b32336eb2e2a9039f8d0d3667276476cc298 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Thu Oct 7 02:27:04 2021 -0700 service/dap: Dap => DAP (#2739) Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com> commit b48dd09251436d072baaf398d6f724441e591838 Author: Suzy Mueller <suzmue@golang.org> Date: Tue Oct 5 21:29:46 2021 -0400 service/dap: log goroutine id and include source info (#2730) commit 70df230e72d97fe5b6e801ca6afae5db8546c71f Author: Suzy Mueller <suzmue@golang.org> Date: Tue Oct 5 13:35:14 2021 -0400 service/dap: merge arguments and local scopes (#2717) commit fa10cec9fa539f9cfc81d0d2e65db1ebbda100ad Author: Hyang-Ah Hana Kim <hyangah@gmail.com> Date: Tue Oct 5 07:40:17 2021 -0400 dap: support delveCwd and use a temporary file as default debug binary (#2660) commit 348c72298167f8825e9c825f4557ca7f16da2efe Author: Alessandro Arzilli <alessandro.arzilli@gmail.com> Date: Mon Oct 4 23:45:05 2021 +0200 proc/gdbserver: support watchpoints (#2659) Adds watchpoint support to gdbserver backend for rr debugger and debugserver on macOS/amd64 and macOS/arm64. Also changes stack watchpoints to support reverse execution. commit dc2f615c9a2b73e500bd335e8e0bd4c1619c7858 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Mon Oct 4 09:13:17 2021 -0700 service/dap: refactor the server into two layers (#2729) * service/dap: refactor the server into two layers * Add delay before setting debugger in remote tests Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com> commit 6a282112cce8ac3ec47205a7a34e4ddc397b806c Author: aarzilli <alessandro.arzilli@gmail.com> Date: Fri Sep 17 08:48:05 2021 +0200 TeamCity: enable tests on go-tip commit 9f908584dce1277308eb330cd1e8e1225ca2a59e Author: aarzilli <alessandro.arzilli@gmail.com> Date: Fri Sep 17 08:47:46 2021 +0200 proc/test: update RegabiSupported Change RegabiSupported to match the current state of Go 1.18 commit 18f2a4c46b8712188cc23f68cb0dc884a0a99f8b Author: aarzilli <alessandro.arzilli@gmail.com> Date: Thu Sep 16 21:26:36 2021 +0200 proc,dwarf/godwarf: support parametric types with dictionaries Change debug_info type reader and proc to convert parametric types into their real types by reading the corresponding dictionary entry and using the same method used for interfaces to retrieve the DIE from a runtime._type address. '2586e9b1'. commit 4e7b689e1a97428c7974bdb4ba3b1ba1e74ea3d1 Author: aarzilli <alessandro.arzilli@gmail.com> Date: Thu Sep 16 16:51:51 2021 +0200 proc: rewrite FindFileLocation to support generics With generics a single function can have multiple concrete instantiations, the old version of FindFileLocation supported at most one concrete instantiation per function and any number of inlined calls, this supports any number of inlined calls and concrete functions. commit 878a52539ef8330af75095a88f37712e0c621edf Author: aarzilli <alessandro.arzilli@gmail.com> Date: Thu Sep 16 15:38:15 2021 +0200 proc: use trampoline attribute to detect autogenerated wrappers Go 1.18 abandoned the 'dwrap' tag introduced by Go 1.17 commit ee1719f6ebdf4f6b9422bf702433334a095ccd7c Author: aarzilli <alessandro.arzilli@gmail.com> Date: Fri Sep 3 14:20:21 2021 +0200 proc: only apply regabiMallocgcWorkaround to first image The workaround for runtime.mallocgc with regabi should only be applied to the first image. commit 4a004e4bc1a7d2e2714a715768a1578b8da06228 Author: aarzilli <alessandro.arzilli@gmail.com> Date: Mon Aug 23 10:03:54 2021 +0200 proc: do not check return args when loading return vals of call injection When the function we are calling is an autogenerated stub (because, for example, we are calling it through a function pointer) the declaration line of variables is meaningless and could cause us to discard valid return arguments. commit de322cd113d83a7d678e7269a560f3c1fd0ae835 Author: aarzilli <alessandro.arzilli@gmail.com> Date: Sun Aug 22 16:46:00 2021 +0200 proc: fix deferreturn detection for Go 1.18 Go 1.18 removed the jmpdefer call from deferreturn, now deferreturn is a normal function call that can appear on the stack, rules for detecting a deferreturn call must be changed and new code must be added to skip it while stepping out. commit cf58ba438043d85b9a15b190bc3e1b602b1fecc8 Author: aarzilli <alessandro.arzilli@gmail.com> Date: Sun Aug 22 16:12:07 2021 +0200 tests: miscellaneus test fixes for Go 1.18 commit a97da22762ac08478db61373a7efe372f84d2d79 Author: Alessandro Arzilli <alessandro.arzilli@gmail.com> Date: Wed Sep 29 12:01:37 2021 +0200 proc: do not assign temporary breakpoint IDs (#2650) Internal breakpoints do not need IDs and assigning them from a counter separate from the user ID counter can be a cause of confusion. If a user breakpoint is overlayed on top of a pre-existing internal breakpoint the temporary ID will be surfaced as if it was a user ID, possibly conflicting with another user ID. If a temporary breakpoint is overlayed on top of a pre-existing user breakpoint and the user breakpoint is first deleted and then re-created, the user ID will be resurrected along with the breakpoint, instead of allocating a fresh one. This change removes internal breakpoint IDs entirely, only user breakpoints receive an ID. commit b8f8cd82a63338662782825c762ddb180944794d Author: Alessandro Arzilli <alessandro.arzilli@gmail.com> Date: Wed Sep 29 09:53:27 2021 +0200 service/rpccommon,service/dap: warn about listening to remote connections (#2721) Updates #2669 commit 29eae8f61731a77b95d61f69a782a2cde1e019bf Author: Alessandro Arzilli <alessandro.arzilli@gmail.com> Date: Tue Sep 28 21:07:42 2021 +0200 *: clean up staticcheck problems (#2723) Fix problems that can be fixed, ignore the ones that don't make sense commit efc44831754e5e66b66ec7375a3ca424426310ad Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Sat Sep 25 08:41:00 2021 -0700 pkg/goversion: visibly warn the user with --check-go-version=false (#2684) Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com> commit 038cd99b7310574bde3c5689d4e26e8a9adf40dd Author: Alessandro Arzilli <alessandro.arzilli@gmail.com> Date: Sat Sep 25 00:31:54 2021 +0200 tests: run staticcheck during tests (#2705) commit 041eedd1268323788606580a3463f6e8911ff30e Author: Michael Knyszek <mknyszek@google.com> Date: Fri Sep 24 18:27:44 2021 -0400 pkg/proc: merge register data before writing to register (#2699) Right now, if (*compositeMemory).WriteMemory needs to write a value to a register that's smaller than the full size of the register (say, a uint32 being passed as an argument), then (*AMD64Registers).SetReg can later fail a sanity check that ensures the passed DwarfRegister is a full size register. Fix this by reading the old value of the register and overwriting just the relevant parts with the new register. For the purposes of an argument, it would probably be fine to just pad with zeroes, but merging with the existing value is what gdb does. Fixes #2698 commit 4b30ba4228ee143ee24f88b2473ee6998c26ccba Author: Suzy Mueller <suzmue@golang.org> Date: Fri Sep 24 16:22:32 2021 -0600 service/dap: add basic log points (#2634) Log points are special kinds of breakpoints that do not 'break' but instead log a message and then continue. This change implements basic log points that simply log the provided message, without any interpolation. In order to resume execution after hitting a breakpoint, I added a new lock resumeMu and tracked the running state within the DAP server. resumeMu must be held in order to issue a debugger request that would start execution. This means it can be used to make sure that another goroutine does not resume execution while you are holding the lock. Most of the synchronization logic is taken from PR #2530 Updates golang/vscode-go#123 commit e00670b9018d273c67ec4fc93244c98597e4aa83 Author: Suzy Mueller <suzmue@golang.org> Date: Fri Sep 24 16:18:28 2021 -0600 service/debugger: return correct exit status on manual halt (#2674) * service/dap: add test for nonzero exit status commit b50052cc1767e2d5ebd6edc31f459bbace131722 Author: Alessandro Arzilli <alessandro.arzilli@gmail.com> Date: Sat Sep 25 00:17:46 2021 +0200 proc/native: support watchpoints on Windows (#2651) commit 2b306e32a6133da96e5b23613b978d69a0ef5d18 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Fri Sep 24 04:43:46 2021 -0700 service/dap: initial remote attach (handler support only) (#2709) commit eef04b964697f8fbdb4d28bf59869e1e09782ab0 Author: Hyang-Ah Hana Kim <hyangah@gmail.com> Date: Fri Sep 24 01:17:01 2021 -0400 dap: delete unused function (#2720) staticcheck reported a warning (U1000) commit c7e2a9b6fb902d685e77b28b001c0c95e5eb95b3 Author: Suzy Mueller <suzmue@golang.org> Date: Wed Sep 22 22:29:05 2021 -0600 service/dap: remove unused test helper arg (#2714) commit b03d468b24248bad102f35cbe2a73ee52ebdc2ba Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Wed Sep 22 21:26:40 2021 -0700 go.mod: update google/go-dap to 0.6.0 (#2710) Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com> commit ff52a37a6a0b25c4b24fa2640e3a25c4200972c6 Author: Yang Wei <yangweilim21@gmail.com> Date: Thu Sep 23 13:25:31 2021 +0900 cmd/dlv: Parse Go+BoringCrypto version (#2712) This changes allow us to parse Go+BoringCrypto which formatted in <GoVersion>b<BoringCryptoVersion> so that we can surpress `Version of Go is too old for this version of Delve` error. Fixes #2711 commit 9f8b352a98292cd72e5d9e9807c535dcfc01beb9 Author: Davide Masserut <dm@mssdvd.com> Date: Thu Sep 23 06:15:02 2021 +0200 vendor: update liner dependency (#2700) This change update liner to the latest release that adds support to delete the next and the previous word with Alt-d and Alt-BackSpace plus a small amount of fixes. commit a3897eafa771adcd5fa3de02ce3398750d84a5a9 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Wed Sep 22 21:12:48 2021 -0700 service/dap: client must treat non-build launch/attach errors as visible (#2671) Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com> commit 2adb72d05373c119b76ed6b4b7a631d8268b0134 Author: Derek Parker <parkerderek86@gmail.com> Date: Wed Sep 22 21:05:04 2021 -0700 v1.7.2 (#2708) Release v1.7.2, update CHANGELOG. commit cf106473606dd3c858447c60919e635e644bfcdb Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Mon Sep 20 08:53:01 2021 -0700 service/dap: fix test setup for forcing server stop, add extra test (#2702) Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com> commit ab38d71147ddb85aef56a81ed6d564c384e4bbf6 Author: Suzy Mueller <suzmue@golang.org> Date: Thu Sep 16 04:19:01 2021 -0600 service/dap: show decimal and hex values for uint (#2694) commit 53eed299004f638707abace9293082a7cbced742 Author: Suzy Mueller <suzmue@golang.org> Date: Mon Sep 13 15:42:21 2021 -0600 pkg/proc: update check for system goroutine (#2585) * pkg/proc: update check for system goroutine The finalizer goroutine can be either a system goroutine or a user goroutine. It is considered a user goroutine only when it calls back to user code. This change attempts to get closer to the implementation in the src/runtime/traceback.go by checking the value of fingRunning. We could alternatively adopt the approximation done by src/cmd/trace/trace.go which only special cases "runtime.main", and always considers the finalizer to be a system goroutine. commit 4bcb8fb14438542a49c7f3c374b14a3d80316ac8 Author: Claus Lensbøl <cmol@cmol.dk> Date: Mon Sep 13 12:11:45 2021 -0400 terminal/make: Add GOARCH and GOOS arguments (#2696) This change adds '--GOARCH=[arch]' and '--GOOS=[os]' as arguments for the make script to simplify the process of cross compilling. commit 822c1ed2f1da018a8313eae34590178aa7813099 Author: Gabriel Vasile <gabriel.vasile@email.com> Date: Mon Sep 13 11:55:06 2021 +0300 Documentation: remove individual os install instruction links (#2697) Since the install instructions are more or less the same on all four operating systems, remove individual install instruction links from readme. commit 09798471003d55918581b8b835c0046e0c2f560a Author: Suzy Mueller <suzmue@golang.org> Date: Thu Sep 9 09:49:11 2021 -0600 service/dap: do not send a halt request if the debuggee is not running (#2686) updates go-delve/delve#2685 commit 5d158820f69484106bee28f025bb6660c80bd6e3 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Wed Sep 1 10:31:37 2021 -0700 service/rpccommon: halt before detach in Stop (#2677) * service/rpccommon: halt before detach in Stop * Addd IsRunning check Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com> commit 45f44bc21837976a2aa9d87fbf429aeecfa5abfb Author: Johannes Altmanninger <aclopte@gmail.com> Date: Wed Sep 1 19:03:58 2021 +0200 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. commit 47d07e095c3efd70ffec917dbf4ea92e60cbd5ff Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Wed Sep 1 09:59:51 2021 -0700 service/dap: add test coverage for Stop() (#2678) Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com> commit f5105c57f7560f5c009c209259236d7429ea73aa Author: Johannes Altmanninger <aclopte@gmail.com> Date: Wed Sep 1 18:59:15 2021 +0200 terminal: config -list to print strings inside interfaces in quotes (#2680) Commit 3d6bbbe9 made "config -list" print strings in quotes to avoid the strings being interpreted as terminal escape codes. This commit does the same for "source-list-line-color", which is a raw interface. This fixes "config -list" with a config like source-list-line-color: "\x1b[34m" The "int" variant is already printed correctly, so just use the default case for that. commit 88b163d038ebb776332621cfdd5514780987884e Author: Suzy Mueller <suzmue@golang.org> Date: Wed Sep 1 10:58:42 2021 -0600 service/dap: include selected goroutine in threads request (#2683) When we set a limit on the number of threads that would be returned, it was possible that the selected thread was not included in the list of threads. This could cause issues because the stopped reason is associated with the selected goroutine, so users could be missing out on important info. This change makes sure that the selected goroutine is included by adding it to the end of the list. commit 7dddcc186ee7c03234a576e7eb40ddda7d47c7f0 Author: Alessandro Arzilli <alessandro.arzilli@gmail.com> Date: Tue Aug 31 19:44:57 2021 +0200 tests: fix TestIssue419 (#2682) errChan should not be closed otherwise the function that requests the manual stop might find it closed. commit 1433c079574bca60a9044feb319051f79c440e38 Author: Hyang-Ah Hana Kim <hyangah@gmail.com> Date: Thu Aug 26 08:42:58 2021 -0400 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. commit 7c91fa0d72d184f5954ab943c44474f8e45d8b25 Author: Johannes Altmanninger <aclopte@gmail.com> Date: Wed Aug 25 17:51:11 2021 +0200 pkg/terminal: avoid bright colors in default syntax highlighting (#2675) These two were hard to read on default xterm or on Konsole's "White on Black" theme. The non-bright colors still work on dark backgrounds. See https://github.com/go-delve/delve/pull/2294#discussion_r691076091 commit 914e1bc80e98423b00737f7894e0635a579c51fd Author: Derek Parker <parkerderek86@gmail.com> Date: Wed Aug 25 04:29:28 2021 -0700 pkg/proc: attempt to leverage debuginfod-find (#2670) If we cannot find debug information locally on the system, try and invoke debuginfod-find in order to ask the linux distribution we're on to find the debug information for us. commit a1a726d3152481f48ac1f1612988a70c1bdabf5f Author: Alessandro Arzilli <alessandro.arzilli@gmail.com> Date: Tue Aug 24 17:21:17 2021 +0200 tests: correctly check for 1.17 + regabi (#2673) regabi is not supported on FreeBSD, the tests must act accordingly commit 1b2f7f00519cdb14e150d61e225e7a1250ec4dc8 Author: Derek Parker <parkerderek86@gmail.com> Date: Tue Aug 24 05:53:27 2021 -0700 pkg/proc: Parse Goroutine ID in eBPF tracer (#2654) This patch enables the eBPF tracer backend to parse the ID of the Goroutine which hit the uprobe. This implementation is specific to AMD64 and will have to be generalized further in order to be used on other architectures. commit c379296cc8525333db69322cd56019be591a72be Author: Alessandro Arzilli <alessandro.arzilli@gmail.com> Date: Mon Aug 23 20:32:02 2021 +0200 _scripts: auto check that pkg/proc and runtime are synchronized (#2557) Adds a script that check automatically that the the assumptions that pkg/proc makes about runtime are met by the actual runtime, using a combination of parsing and magic comments. Also emits a file describing all the struct fields, constants and variables of the runtime that we use in pkg/proc. commit 3d6bbbe92ab7813bacb421027fce8f69ba3ddeec Author: Alessandro Arzilli <alessandro.arzilli@gmail.com> Date: Mon Aug 23 20:28:27 2021 +0200 terminal: config -list should print strings in quotes (#2605) Commit 8e91d3b0b added a number of configuration options to control the colors of sytnax highlighting, unfortunately 'config -list' will print all of those to stdout without quoting them, resulting in the color of the last one being applied to all subsequent text. Change 'config -list' to print strings in quotes so that we don't accidentally send escape sequences to the terminal. commit 7cdf48605be2809aecbd11f61a16f9edd32c5d15 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Mon Aug 23 11:27:49 2021 -0700 service/dap: clarify handling of relative program path (#2653) * service/dap: add test verifying handling of relative program path * Add exec test, log build dir and document in --help Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com> commit d76181bba5814083b1f5e2dcd5ae83914d7ac82e Author: Alessandro Arzilli <alessandro.arzilli@gmail.com> Date: Fri Aug 20 18:32:56 2021 +0200 Documentation: add notes on porting Delve to other architectures (#2666) commit df1108b277fc7e2e19f25e5c002f1fd781328c44 Author: Derek Parker <parkerderek86@gmail.com> Date: Wed Aug 18 00:08:57 2021 -0700 *: v1.7.1 (#2662) commit a4d416d5f182592fdb0bf8e1cf356fa95b301296 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Tue Aug 17 11:40:31 2021 -0700 service/dap: add test that verifies output path is relative to wd (#2656) * service/dap: add test that verifies output path is relative to wd * Use cleanExeName to get the right output name on Win Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com> commit 694b45c8939efcc56320dfbe4bceb5274eb8b38a Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Mon Aug 16 08:51:23 2021 -0700 service/dap: fix noDebug mode to handle requests while running (#2658) Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com> commit 513751573ea101f1d0f9373ed9b02fb716bfe566 Author: Alessandro Arzilli <alessandro.arzilli@gmail.com> Date: Tue Aug 10 11:40:39 2021 +0200 service: fix sameuser check (#2642) Change the socket search to check both the remote and local fields of the socket match the socket we want to find. Sockets are identified by the 4-uple local_addr, local_port, remote_addr, remote_port Two socket can differ by a single one of this four elements. It is possible for the same local_port to be used by two different sockets, as long as they are connecting to different remote addresses (or remote ports). An example of this bug in action can be seen at: https://github.com/golang/vscode-go/runs/3141270564?check_suite_focus=true There the server starts listening on 127.0.0.1:46011 and rejects a valid client connection by finding the following socket: 60: 0100007F:DD82 0100007F:962D 06 00000000:00000000 03:00000133 00000000 0 0 0 3 0000000000000000 the local address of this socket is 0100007F:DD82 (127.0.0.1:56706), and the remote address is 0100007F:962D (127.0.0.1:38445). The reported error is: closing connection from different user (127.0.0.1:56706): connections to localhost are only accepted from the same UNIX user for security reasons note how the local port does match the socket line (56706) but the remote port is wrong (38445 instead of 46011). Note also that the state of this socket is 06, or TIME_WAIT, which would be impossible if this was the right socket, since the right socket would still be open. Fixes https://github.com/golang/vscode-go/issues/1555 commit c426c5b38dbec14921633f33290a9f7442953bf4 Author: Suzy Mueller <suzmue@golang.org> Date: Mon Aug 9 11:56:20 2021 -0600 pkg/proc: configure target to not clear stepping breakpoints (#2635) In order for DAP to support halting the program (either manually or on a breakpoint) performing some action and then resuming execution, there needs to be a way to stop the program without clearing the internal breakpoints. This is necessary for log points and stopping the program to set breakpoints. The debugging UI makes it seem like a user should be able to set or clear a breakpoint at any time. Adding this ability to complete synchronous requests while the program is running is thus important to create a seamless user experience. This change just adds a configuration to determine whether the target should clear the stepping breakpoints, and changes the server to use this new mode. Using the new mode means that the DAP server must determine when it expect the next to be canceled and do this manually. commit 4264bf00f2e88927cda8eddb7ef8a04c84b58522 Author: Alessandro Arzilli <alessandro.arzilli@gmail.com> Date: Mon Aug 9 19:41:25 2021 +0200 proc,terminal,service: support stack watchpoints (#2521) * terminal,service: add way to see internal breakpoints Now that Delve has internal breakpoints that survive for long periods of time it will be useful to have an option to display them. * proc,terminal,service: support stack watchpoints Adds support for watchpoints on stack allocated variables. When a stack variable is watched, in addition to the normal watchpoint some support breakpoints are created: - one breakpoint inside runtime.copystack, used to adjust the address of the watchpoint when the stack is resized - one or more breakpoints used to detect when the stack variable goes out of scope, those are similar to the breakpoints set by StepOut. Implements #279 commit f3e76238e353e27b8abdc3db9b97025948a791eb Author: Alessandro Arzilli <alessandro.arzilli@gmail.com> Date: Mon Aug 9 19:16:24 2021 +0200 proc: move breakpoint condition evaluation out of backends (#2628) * proc: move breakpoint condition evaluation out of backends Moves breakpoint condition evaluation from the point where breakpoints are set, inside ContinueOnce, to (*Target).Continue. This accomplishes three things: 1. the breakpoint evaluation method needs not be exported anymore 2. breakpoint condition evaluation can be done with a full scope, containing a Target object, something that wasn't possible before because ContinueOnce doesn't have access to the Target object. 3. moves breakpoint condition evaluation out of the critical section where some of the threads of the target process might be still running. * proc/native: handle process death during stop() on Windows It is possible that the thread dies while we are inside the stop() function. This results in an Access is denied error being returned by SuspendThread being called on threads that no longer exist. Delay the reporting the error from SuspendThread until the end of stop() and only report it if the thread still exists at that point. Fixes flakyness with TestIssue1101 that was exacerbated by moving breakpoint condition evaluation outside of the backends. commit 4e5bddee9b8e4e819c7d641be065605f469e22d8 Author: hitzhangjie <hit.zhangjie@gmail.com> Date: Tue Aug 10 01:08:12 2021 +0800 cmd/dlv: use simple chan read instead of select-case (#2649) commit 6b83e6baae93c39bf983969c901a01a00d4a9fcd Author: hitzhangjie <hit.zhangjie@gmail.com> Date: Fri Aug 6 14:26:44 2021 +0800 vendor: run go mod vendor (#2647) commit e175d68e97ce02cee258ed248059148348db9f95 Author: Alessandro Arzilli <alessandro.arzilli@gmail.com> Date: Fri Aug 6 07:19:27 2021 +0200 service/dap: fix race condition in TestContinueOnEntry (#2641) The Threads request sent immediately after the ConfigurationDone request can be processed in two possible states: - while the program is being executed, when it will return Id=1, Name=Dummy - after the program terminates, when it will return Id=-1, Name=Current additionally the response could be received in any order with the Terminate event. Remove the problematic Threads request from the test. commit 43d50202f365ca6d988cae6dc92dbfe7ae8b9946 Author: Derek Parker <parkerderek86@gmail.com> Date: Thu Aug 5 10:55:27 2021 -0700 pkg/terminal: Allow fuzzy searching tab completions (#2633) This patch implements fuzzy searching for tab completions in the terminal client. Under the hood it is using a trie data structure (https://en.wikipedia.org/wiki/Trie) to perform very fast prefix / fuzzy searches. commit 985eca462c9f67ff0b014990f9dbe57d417741e6 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Thu Aug 5 10:16:15 2021 -0700 service/dap: log execution-halted message when setting breakpoints (#2631) Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com> commit 7caa534d7617b2d12b7e821394be95c59cbb8ada Author: Derek Parker <parkerderek86@gmail.com> Date: Thu Aug 5 04:53:09 2021 -0700 service/debugger: Remove target lock on GetBufferedTracepoints (#2645) There is already a lock on the actual buffered tracepoints collection within proc, and this method call doesn't do anything to mutate Target otherwise so we shouldn't be opening ourselves up for a race condition error or any other kind of parallelism problem. Additionally, with this lock we essentially can never get the data until the process has exited becuase `continue` will lock the target. This change allows us to get the buffered tracepoint information immediately and display it as the program is running. commit 2971fd4c685aeda74b087078f203436c73f94a07 Author: Alessandro Arzilli <alessandro.arzilli@gmail.com> Date: Wed Aug 4 23:12:58 2021 +0200 service/dap: fix TestNextParked/TestStepInParked (#2643) The loop searching for a suitable goroutine is not guaranteed to ever find it, and failing to find one is not an error. Changes testStepParkedHelper to match the behavior of TestNextParked in proc_test.go. Deletes TestStepInParked because it does not test anything meaningful beyond what's already tested by TestNextParked. commit 4e242098f8f2ffe6b80a5422bf4340ef370c651e Author: Alessandro Arzilli <alessandro.arzilli@gmail.com> Date: Wed Aug 4 23:12:15 2021 +0200 tests: check presence of gcc for cgo tests (#2644) The install of gcc sometimes fails on our CI, it is not an error if the tests for cgo can not run because there's no C compiler. commit f95340ae1bf9fed8740d5fd39f5758d41770d967 Author: Derek Parker <parkerderek86@gmail.com> Date: Wed Aug 4 01:00:32 2021 -0700 pkg/proc: Fix build errors (#2637) Fix ebpf build errors on Windows and update bininfo.Location API call. Fixes #2636 commit 7462767355bec5818d2f3f287ee27c4a01bc7751 Author: nd <dmitry.neverov@gmail.com> Date: Tue Aug 3 19:42:53 2021 +0200 teamcity: report go test exit code on windows (#2638) commit fdb5189e8cf9721f0500a3512993fd4ecef71369 Author: Alessandro Arzilli <alessandro.arzilli@gmail.com> Date: Tue Aug 3 18:51:15 2021 +0200 dwarf/op,proc: implement more DWARF expression opcodes (#2606) commit 229fcf1559ac4755b013c734181f0e956670af20 Author: polinasok <51177946+polinasok@users.noreply.github.com> Date: Tue Aug 3 09:48:01 2021 -0700 cmd: refactor building logic into a helper (#2629) * cmd: refactor building logic into a helper * Address review comments Co-authored-by: Polina Sokolova <polinasok@users.noreply.github.com> commit df5812bf2d623647ef705cacb9ac5fc4eb37f29e Author: Suzy Mueller <suzmue@golang.org> Date: Tue Aug 3 10:47:24 2021 -0600 pkg/proc: add tests for next interrupted by bp (#2632) Adds tests that make sure that when a next request is interrupted by a breakpoint, the stepping breakpoints are cleared. commit 10406f96d539d905fbe8e8d102d7a01e61f26f04 Author: Derek Parker <parkerderek86@gmail.com> Date: Sat Jul 31 08:16:26 2021 -0700 *: Initial eBPF tracing support (#2625) commit 89ed5a0b19725999db55706a7b191a6e94065414 Author: Suzy Mueller <suzmue@golang.org> Date: Thu Jul 29 11:34:01 2021 -0600 service/dap: page stack frames (#2597) Returning monotonically increasing totalFrames values for subsequent requests can be used to enforce paging in the client. If we are not at the end of the stackFrames that are returned, we return a higher total frames to suggest to the client that they should request more frames. commit b87a1fc55d6175de83ab20d0a712eacb5253509d Author: Suzy Mueller <suzmue@golang.org> Date: Thu Jul 29 11:27:49 2021 -0600 service/dap: make next while nexting error more clear (#2622) To make it more clear that the user can resume the program when they encounter a next while nexting error, make the exception information have instructions for resuming the program. This implements the suggestions outlined by @polinasok in #2443. commit a2b839990e21690e9e60a74c582c4acece6196d8 Author: Austin Clements <aclements@csail.mit.edu> Date: Wed Jul 28 11:18:20 2021 -0400 Fix crashes on Go dev.typeparams (soon to be Go main branch) (#2627) * proc: Go 1.18 removes the _defer.siz field As of Go 1.17, the _defer.siz field is always 0 because _defer no longer stores defer call arguments at all. golang.org/cl/326062 removes it entirely for Go 1.18. Simply treat it as 0 if the field is missing from the _defer type. * proc: Go 1.18 changes _defer.fn from *funcval to func() golang.org/cl/325918 changed the type of the _defer.fn field from *funcval to func() for Go 1.18. This CL was later reverted because it caused failures in Delve, but we would like to un-revert it. Handle this change by inspecting the type of this field before decoding it. commit cb73ef8f83d7837486b3f7b9043ce07df96e466c Author: Derek Parker <parkerderek86@gmail.com> Date: Wed Jul 28 04:13:32 2021 -0700 pkg/terminal: Ignore existing breakpoints for continue until (#2624) Ignore existing breakpoints when using the continue command to continue to a specific location such as `continue main.main`. The point of this command is to continue to a specific location, so if there is already a breakpoint set there there should be no error returned, just continue until we hit the breakpoint already set in that location. commit 56731bd88a880ae8563ff23498793e6b3bd6641e Author: Derek Parker <parkerderek86@gmail.com> Date: Wed Jul 28 04:12:51 2021 -0700 Documentation: Improve help output for examinemem (#2623) Before this change when you typed `help` at the Delve prompt you would only see the following: ``` examinemem (alias: x) Examine memory: ``` Now with this patch the output is more descriptive: ``` examinemem (alias: x) Examine raw memory at the given addres…
Background
The following debug configurations are offered to users in vscode-go.
request='launch' mode='debug'/'test'/'exec' program=...
(Local Debugging)request='attach' mode='local' processId=...
(Local Debugging)request='attach' mode='remote' host=... port=...
(Remote Debugging)With traditional
dlv
, (1) and (2) configuration attributes are translated into cli arguments:dlv debug/exec/test <program> --headless
dlv attach <pid> --headless
With
dlv dap
, the server command takes no args, but waits for the DAP client to tell it what to debug viaThis difference is hidden under the hood and is irrelevant to the local debugging users - options (1) and (2) as the debug configuration is the only thing a user needs to provide.
In case of Remote Debugging, option (3), the user first starts the debug server on their own at host/port, locally or remotely, and then the client connects to it for the debug session as per the host/port in the debug configuration. Because the user deals with the server command directly, the differences in how program/pid are supplied come into light. In addition, remote debugging comes with the use case of connecting to the server with multiple client (tracked under #2323).
Remote Option 1 (Done)
If we follow the traditional DAP initialization sequence, the user would need to launch the server outside of the client, then use the client to start a debug session and tell the server what to launch/attach to (options (1) and (2) above). So essentially this means introducing new client-side configurations to express (3)+(1) and (3)+(2). This could look like:
host=... port=... request='launch' mode='debug'/'test'/'exec' program=...
host=... port=... request='attach' mode='local' processId=...
Host and port will be used to connect to dlv-dap. Request mode, etc will drive the launch/attach request sent to it just like they do in (1) and (2). Any additional configuration processing would need to be done on the client side. Dlv-dap can already support this bearing the considerations below.
Remote Option 2 (Done)
The above model is different from the current model that dlv users are used to where they specify pid or package/program on the command-line as part of launching the headless server. To make dlv-dap experience more familiar and behave like (3) above, we could add a couple more variants - dlv-dap-debug and dlv-dap-attach. These would accept the same command-line arguments as dlv-debug and dlv-attach and go straight to launching/attaching without the formal initialize and launch/attach requests. Then when a client finally connects to the server and does send a launch/attach request, it could be treated as a no-op or perhaps a sanity check that the server is indeed running the expected program. In other words, the server would do the following:
This will also fit with a requirement that a remote server should be reusable between multiple debug sessions while being attached to the same process and having it run or be suspended even when without a client (see also #2323).
The supported attribute configuration could be the following
host=... port=... request="attach" mode="remote"
(we considered using"connect"
or"external"
to signal that this will be mostly a no-op request because we already attached/launched, but decided to go with the familiar legacy names after all)Note that if program or pid are also specified, they will be ignored because he server already stared debugging a program.
We would need special handling for
stopOnEntry
(the server won't halt the program by default like in case of regular launch/attach).Would this make more sense if DAP had a third kind of request ("connect"?) in place of launch/attach to signal the expectation that there is already a running process associated with the debugger that we are connecting to as-is? Maybe worth filing an DAP issue requesting this.
Other Considerations
What else?
@suzmue @hyangah
The text was updated successfully, but these errors were encountered: