-
Notifications
You must be signed in to change notification settings - Fork 845
Open
Labels
DebugIssues related to the debugging functionality of the extension.Issues related to the debugging functionality of the extension.upstream-toolsIssues that are caused by problems in the tools that the extension depends on.Issues that are caused by problems in the tools that the extension depends on.
Milestone
Description
Hi all,
It seems that debugging in a remote dlv instance via docker works, but does not show stdout in the debug console.
I am just using a toy example pasted below to reproduce. This issue persists with both dlp-dap and legacy debug adapters.
System info:
Version: 1.93.1 (user setup)
Commit: 38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40
Date: 2024-09-11T17:20:05.685Z
Electron: 30.4.0
ElectronBuildId: 10073054
Chromium: 124.0.6367.243
Node.js: 20.15.1
V8: 12.4.254.20-electron.0
OS: Windows_NT x64 10.0.22631 (WSL2)
WSL version: 2.2.4.0
Kernel version: 5.15.153.1-2
WSLg version: 1.0.61
MSRDC version: 1.2.5326
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.26091.1-240325-1447.ge-release
Windows version: 10.0.22631.4169
Distributor ID: Ubuntu
Description: Ubuntu 22.04.4 LTS
Release: 22.04
Codename: jammy
dockerfile.debug
# Start from the official Golang base image
FROM golang:1.23-alpine
# Set the Current Working Directory inside the container
WORKDIR /app
# Download all dependencies. Dependencies will be cached if the go.mod and go.sum files are not changed
ENV CGO_ENABLED=0
RUN go install -ldflags "-s -w -extldflags '-static'" github.com/go-delve/delve/cmd/dlv@latest
# Copy go mod and sum files
# not used atm
# COPY go.mod ./
# COPY go.sum ./
# RUN go mod download
# Copy the source from the current directory to the Working Directory inside the container
COPY . .
RUN go build -gcflags "all=-N -l" -o test-api ./cmd
CMD [ "/go/bin/dlv", "--listen=:4001", "--headless=true", "--continue", "--log=true", "--accept-multiclient", "--api-version=2", "exec", "/app/test-api" ]tasks.json
{
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"command": "docker build ${workspaceFolder}/api -t test-api-debug -f ${workspaceFolder}/api/dockerfile.debug",
"label": "api-debugging-container-build",
},
{
"type": "shell",
"label": "api-debugging-container-up",
"isBackground": true,
"command": "docker run -p 8001:8001 -p 4001:4001 test-api-debug",
"dependsOn": [
"api-debugging-container-build"
],
"problemMatcher": [
{
"pattern": [
{
"regexp": ".",
"file": 1,
"location": 2,
"message": 3
}
],
"background": {
"activeOnStart": true,
"beginsPattern": ".",
"endsPattern": ".",
}
}
]
},
{
"type": "shell",
"label": "api-debugging-container-down",
"command": "docker stop $(docker ps -a -q --filter ancestor=test-api-debug) && docker rm $(docker ps -a -q --filter ancestor=test-api-debug)",
}
],
}launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Docker Debug",
"type": "go",
"debugAdapter": "dlv-dap", // issue exists with both dap and legacy adapters
"request": "attach",
"mode": "remote",
"port": 4001,
"showLog": true,
"preLaunchTask": "api-debugging-container-up",
"postDebugTask": "api-debugging-container-down",
"substitutePath": [
{
"from": "${workspaceFolder}/api",
"to": "/app"
},
],
},
]
}./api/cmd/api.go
package main
import (
"fmt"
"net/http"
)
func main() {
fmt.Println("Starting server at port 8001")
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
fmt.Println("Request received")
fmt.Fprintf(w, "Hello, World!")
})
if err := http.ListenAndServe(":8001", nil); err != nil {
fmt.Println(err)
}
}thedemons, bionut, auxmoney-tbarcala and loehde
Metadata
Metadata
Assignees
Labels
DebugIssues related to the debugging functionality of the extension.Issues related to the debugging functionality of the extension.upstream-toolsIssues that are caused by problems in the tools that the extension depends on.Issues that are caused by problems in the tools that the extension depends on.
