vscode-bash-debug icon indicating copy to clipboard operation
vscode-bash-debug copied to clipboard

It does not work using the extension Remote Development v0.25.0 and being debugging inside the docker environment

Open ldrahnik opened this issue 4 months ago • 2 comments

In addition to the details for issue, please provide us Executables information and Debug output unless you have confidence that they don't help us.

Executables

Version of bash-debug: (can be checked in: ctrl+shift+X or command+shift+X -> INSTALLED: Bash Debug)

Bash Debugf
v0.3.9

Output of following commands (on windows, execute them in Command Prompt or PowerShell):

/workspaces/project_name # where bash
/bin/sh: where: not found
/workspaces/project_name # bash -c 'uname -a; for P in bash bashdb cat mkfifo pkill; do echo ---; which -a $P; command $P --version; done'
Linux 1b98d84450d2 5.14.0-388.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Nov 21 10:17:52 UTC 2023 x86_64 Linux
---
/bin/bash
GNU bash, version 5.2.26(1)-release (x86_64-alpine-linux-musl)
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
---
bash: line 1: bashdb: command not found
---
/bin/cat
cat: unrecognized option: version
BusyBox v1.36.1 (2024-06-10 07:11:47 UTC) multi-call binary.

Usage: cat [-nbvteA] [FILE]...

Print FILEs to stdout

        -n      Number output lines
        -b      Number nonempty lines
        -v      Show nonprinting characters as ^x or M-x
        -t      ...and tabs as ^I
        -e      ...and end lines with $
        -A      Same as -vte
---
/usr/bin/mkfifo
mkfifo: unrecognized option: version
BusyBox v1.36.1 (2024-06-10 07:11:47 UTC) multi-call binary.

Usage: mkfifo [-m MODE] NAME

Create named pipe

        -m MODE Mode (default a=rw)
---
/usr/bin/pkill
pkill: unrecognized option: version
BusyBox v1.36.1 (2024-06-10 07:11:47 UTC) multi-call binary.

Usage: pkill [-l|-SIGNAL] [-xfvnoe] [-s SID|-P PPID|PATTERN]

Send signal to processes selected by regex PATTERN

        -l      List all signals
        -x      Match whole name (not substring)
        -f      Match against entire command line
        -s SID  Match session ID (0 for current)
        -P PPID Match parent process ID
        -v      Negate the match
        -n      Signal the newest process only
        -o      Signal the oldest process only
        -e      Display name and PID of the process being killed
        -u EUID Match against effective UID
        -U UID  Match against UID

Debug output

I tried to put a breakpoint to the testing_debugging.sh:

#!/usr/bin/env bash
export NICE_VAR=10
export ANOTHER_VAR=20
for i in {0..25..5}
do
  export NICE_VAR=$NICE_VAR+$i
  echo $NICE_VAR
done
for ((i=1;i<=25;i+=1))
do
  export ANOTHER_VAR=$ANOTHER_VAR+$i
  echo $ANOTHER_VAR
done
if [ $ANOTHER_VAR -gt $NICE_VAR ]
then
  echo "ANOTHER bigger than nice"
else
  echo "Nice is bigger or equal"
fi

launch.json:

{
  // Use IntelliSense to learn about possible attributes.
  // Hover to view descriptions of existing attributes.
  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [
    {
      "type": "bashdb",
      "request": "launch",
      "name": "Bash-Debug (simplest configuration)",
      "cwd": "${workspaceFolder}",
      "program": "${file}",
      "showDebugOutput": true,
      "terminalKind": "integrated",
      "trace": true
    }
  ]
}

settings.json:

{
  "r.alwaysUseActiveTerminal": true,
  "r.bracketedPaste": true,
  "r.sessionWatcher": true,
  "r.plot.useHttpgd": true,
  "r.lsp.diagnostics": false
}

Debug console:

::PROXYID::93900
(/workspaces/project_name/src/testing_debugging.sh:2):
2:	export NICE_VAR=10

Terminal:

/vscode/vscode-server/bin/linux-alpine/38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40 #  bash -c cd\ \"/workspaces/project_name\"\;\ while\ \[\[\ \!\ -p\ \"/tmp/vscode-bash-debug-fifo-19340\"\ \]\]\;\ do\ sleep\ 0.25\;\ done\;\ \
"bash\"\ \"/root/.vscode-server/extensions/rogalmic.bash-debug-0.3.9/bashdb_dir/bashdb\"\ --quiet\ --tty\ \"/tmp/vscode-bash-debug-fifo-19340\"\ --tty_in\ \"/tmp/vscode-bash-debug-fifo-19340_in\"\ --library\ \"/root/.vscod
e-server/extensions/rogalmic.bash-debug-0.3.9/bashdb_dir\"\ --\ \"/workspaces/project_name/app/src/testing_debugging.sh\"\ \

devcontainer.json

// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-docker-compose
{
	"name": "Existing Docker Compose (Extend)",

	// Update the 'dockerComposeFile' list if you have more compose files or use different names.
	// The .devcontainer/docker-compose.yml file contains any overrides you need/want to make.
	"dockerComposeFile": [
		"../docker-compose.yml",
    "docker-compose.yml"
	],

	// The 'service' property is the name of the service for the container that VS Code should
	// use. Update this value and .devcontainer/docker-compose.yml to the real service name.
	"service": "job",

	// The optional 'workspaceFolder' property is the path VS Code should open by default when
	// connected. This is typically a file mount in .devcontainer/docker-compose.yml
	"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",

	// Features to add to the dev container. More info: https://containers.dev/features.
	// "features": {},

	// Use 'forwardPorts' to make a list of ports inside the container available locally.
	// "forwardPorts": [],

	// Uncomment the next line if you want start specific services in your Docker Compose config.
	// "runServices": [],

	// Uncomment the next line if you want to keep your containers running after VS Code shuts down.
	// "shutdownAction": "none",

	// Uncomment the next line to run commands after the container is created.
	// "postCreateCommand": "cat /etc/os-release",

	// Configure tool-specific properties.
	// "customizations": {},
  "customizations": {
    "vscode": {
        "extensions": [
            // bash Extensions
            "rogalmic.bash-debug",
            // R Extensions
            "rdebugger.r-debugger",
            "reditorsupport.r",
            // Documentation Extensions
            "quarto.quarto",
            "purocean.drawio-preview",
            "redhat.vscode-yaml",
            "yzhang.markdown-all-in-one",
            // Docker Supporting Extensions
            "ms-azuretools.vscode-docker",
            "ms-vscode-remote.remote-containers",
            // Python Extensions
            "ms-python.python",
            "ms-toolsai.jupyter"
        ],
        "settings": {
          "python.defaultInterpreterPath": ".venv/bin/python"
        }
    }
  }

	// Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root.
	// "remoteUser": "devcontainer"
}

docker-compose.yml

version: '3.8'
services:
  # Update this to the name of the service you want to work with in your docker-compose.yml file
  job:
    # Uncomment if you want to override the service's Dockerfile to one in the .devcontainer
    # folder. Note that the path of the Dockerfile and context is relative to the *primary*
    # docker-compose.yml file (the first in the devcontainer.json "dockerComposeFile"
    # array). The sample below assumes your primary file is in the root of your project.
    #
    # build:
    #   context: .
    #   dockerfile: .devcontainer/Dockerfile

    volumes:
      # Update this to wherever you want VS Code to mount the folder of your project
      - ..:/workspaces:cached

    # Uncomment the next four lines if you will use a ptrace-based debugger like C++, Go, and Rust.
    # cap_add:
    #   - SYS_PTRACE
    # security_opt:
    #   - seccomp:unconfined

    # Overrides default command so things don't shut down after the process ends.
    command: sleep infinity
services:
  job:
    build:
      context: ./app
      dockerfile: Dockerfile
    restart: unless-stopped

Dockerfile

FROM alpine:3.20.3

RUN apk add R=~4.4.0
RUN apk add R-dev R-doc build-base automake autoconf ttf-freefont linux-headers bash curl py3-pip py3-virtualenv wget
RUN apk add libxml2-dev freetype-dev fontconfig-dev fribidi-dev harfbuzz-dev tiff-dev jpeg-dev mysql-dev
RUN apk add openjdk11 --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community

CMD ["/usr/sbin/crond", "-f"]

ldrahnik avatar Oct 11 '24 11:10 ldrahnik