codelldb icon indicating copy to clipboard operation
codelldb copied to clipboard

Debugger Gets Stuck When Trying to Debug Rust Inside a Dev Container

Open mcmah309 opened this issue 6 months ago • 3 comments

The debugger gets stuck when trying to debug rust container inside a dev container. Here's an example, it stays like this forever

https://github.com/vadimcn/codelldb/assets/56412856/c76d4c03-89c0-4a39-ac78-80d8231db1de

.devcontainer

{
	"name": "rust_dev",
	"image": "rust_dev",
	"customizations": {
		"vscode": {
			"extensions": [
				"rust-lang.rust-analyzer",
				"serayuzgur.crates",
				"vadimcn.vscode-lldb"
			]
		}
	},
	"mounts": [
		// rust
		"source=/home/henry/.local/share/containers/storage/volumes/rust_dev/_data/root/.cargo,target=/root/.cargo,type=bind",
		"source=/home/henry/.local/share/containers/storage/volumes/rust_dev/_data/root/.rustup,target=/root/.rustup,type=bind"
	],
	"runArgs": [
		"--net=host",
	],
	"remoteUser": "root"
}

Compiling with cargo and running with vscode works fine.

The output that is notable is this

Warning: codelldb.cargo tasks are unavailable in the current environment.

Warning: codelldb.cargo tasks are unavailable in the current environment.

VSCode version: 1.85.1 Commit: 0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2 Date: 2023-12-13T09:47:11.635Z Electron: 25.9.7 ElectronBuildId: 25551756 Chromium: 114.0.5735.289 Node.js: 18.15.0 V8: 11.4.183.29-electron.0 OS: Linux x64 6.5.13

CodeLLDB version: v1.10.0 Compiler: rustc Target: stable-x86_64-unknown-linux-musl

log

   Compiling surrealdb_migrations v0.1.0 (/workspaces/surrealdb_migrations)
    Finished test [unoptimized + debuginfo] target(s) in 0.26s
Launching debug configuration:
{
  "type": "lldb",
  "request": "launch",
  "name": "run mod",
  "program": "${workspaceFolder}/target/debug/deps/mod-ebdd3fb29dbc1e23",
  "args": [],
  "cwd": "${workspaceFolder}",
  "sourceMap": {},
  "sourceLanguages": [
    "rust"
  ],
  "env": {
    "RUST_BACKTRACE": "short",
    "SHLVL": "2",
    "HOME": "/root",
    "container": "podman",
    "PATH": "/vscode/vscode-server/bin/linux-alpine/0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2/bin/remote-cli:/root/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
    "VSCODE_AGENT_FOLDER": "/root/.vscode-server",
    "SHELL": "/bin/ash",
    "PWD": "/vscode/vscode-server/bin/linux-alpine/0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2",
    "VSCODE_HANDLES_SIGPIPE": "true",
    "VSCODE_AMD_ENTRYPOINT": "vs/workbench/api/node/extensionHostProcess",
    "VSCODE_HANDLES_UNCAUGHT_ERRORS": "true",
    "VSCODE_NLS_CONFIG": "{\"locale\":\"en\",\"osLocale\":\"en\",\"availableLanguages\":{}}",
    "PAGER": "less",
    "REMOTE_CONTAINERS_IPC": "/tmp/vscode-remote-containers-ipc-0a4f2bfb-8a00-41d2-baa0-4712d4583698.sock",
    "LC_COLLATE": "C",
    "REMOTE_CONTAINERS_SOCKETS": "[\"/tmp/vscode-ssh-auth-0a4f2bfb-8a00-41d2-baa0-4712d4583698.sock\",\"/tmp/.X11-unix/X9\"]",
    "LANG": "C.UTF-8",
    "CHARSET": "UTF-8",
    "SSH_AUTH_SOCK": "/tmp/vscode-ssh-auth-0a4f2bfb-8a00-41d2-baa0-4712d4583698.sock",
    "DISPLAY": ":9",
    "REMOTE_CONTAINERS_DISPLAY_SOCK": "/tmp/.X11-unix/X9",
    "REMOTE_CONTAINERS": "true",
    "BROWSER": "/vscode/vscode-server/bin/linux-alpine/0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2/bin/helpers/browser.sh",
    "VSCODE_CWD": "/vscode/vscode-server/bin/linux-alpine/0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2",
    "ELECTRON_RUN_AS_NODE": "1",
    "VSCODE_IPC_HOOK_CLI": "/tmp/vscode-ipc-f23cff8d-2135-498e-bee0-ca04ae85d761.sock",
    "VSCODE_L10N_BUNDLE_LOCATION": ""
  }
}

mcmah309 avatar Jan 27 '24 17:01 mcmah309

I was able to fix this issue by using another rust image. It would be nice if Warning: codelldb.cargo tasks are unavailable in the current environment. was more specific and didn't cause vscode to hang indefinitely without being able to be cancelled.

mcmah309 avatar Jan 28 '24 20:01 mcmah309

Same problem here. Docker image built from alpine:3.18 . Rust version 1.77.2 installed with rustup 1.27.0

chris-the-wiz avatar Apr 24 '24 18:04 chris-the-wiz

Same issue: MacOS Sonoma 14.2.1 rustup 1.27.0 (bbb9276d2 2024-03-08) info: This is the version for the rustup toolchain manager, not the rustc compiler. info: The currently active rustc version is rustc 1.77.2 (25ef9e3d8 2024-04-09) rust-analyzer: v0.3.1932 CodeLLDB: v1.10.0

1414C avatar Apr 26 '24 01:04 1414C