Environment
- OS and version: Ubuntu 24.04.4 LTS running in WSL2 under Windows 11
- VS Code: 1.1119.0
- C/C++ extension: 1.32.2
- OS and version of remote machine: Bespoke Linux distro via Buildroot
- GDB / LLDB version: Any (not relevant)
Bug Summary and Steps to Reproduce
Bug Summary: The ps options this command uses on the remote system depends on a behavior that is not the default on all systems (see the additional information), and breaks on systems that use a different default.
Steps to reproduce:
- With a remote system that uses an undesirable default (unfortunately, the only system I have identified where this is the case is a bespoke buildroot distro, and I can't share details; maybe try a default buildroot?)
- Make a debug config that specifies
"processId": "${command:pickRemoteProcess}"
- Try to use that config to attach to a process on that remote system
- The dropdown in VSCode will be empty, despite
ps working just fine on the remote system.
Debugger Configurations
{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Pipe Attach",
"type": "cppdbg",
"request": "attach",
"program": "enter program name, for example ${workspaceFolder}/a.out",
"processId": "${command:pickRemoteProcess}",
"pipeTransport": {
"debuggerPath": "/usr/bin/gdb",
"pipeProgram": "/usr/bin/ssh",
"pipeArgs": [],
"pipeCwd": ""
},
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
]
},
]
}
Debugger Logs
Other Extensions
No response
Additional Information
The pickRemoteProcess/extension.pickRemoteNativeProcess command runs ps on the remote system with arguments that may or may not work, depending on the ps "personality," which is a mode-type setting that changes how various details of the ps command work, which is a problem because the remote system may not use the personality which is necessary for this command to work as expected.
Specifically, the command runs something like
ps axww -o pid=,comm=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,args=
The man page for ps explicitly documents that syntax like ps -o pid=X,comm=Y can either
- show both a
pid and a comm column with headers X and Y respectively (which appears to be the behavior this pickRemoteProcess is expecting), or
- show just a
pid column with header X,comm=Y (which is what my remote system does).
Which behavior this syntax has depends on the personality setting. The man page for ps claims can be set via the environment variable PS_PERSONALITY, though I was not able to observe this.
In this case, there is a simpler solution: don't use syntax that relies on the personality. Multiple uses of -o should each make their own column, so the command should be changed to
ps axww -o pid= -o comm=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa -o args=
This should behave identically on systems that already worked, but should fix the problem on systems that default to a different personality.
Environment
Bug Summary and Steps to Reproduce
Bug Summary: The
psoptions this command uses on the remote system depends on a behavior that is not the default on all systems (see the additional information), and breaks on systems that use a different default.Steps to reproduce:
"processId": "${command:pickRemoteProcess}"psworking just fine on the remote system.Debugger Configurations
{ "version": "0.2.0", "configurations": [ { "name": "(gdb) Pipe Attach", "type": "cppdbg", "request": "attach", "program": "enter program name, for example ${workspaceFolder}/a.out", "processId": "${command:pickRemoteProcess}", "pipeTransport": { "debuggerPath": "/usr/bin/gdb", "pipeProgram": "/usr/bin/ssh", "pipeArgs": [], "pipeCwd": "" }, "MIMode": "gdb", "setupCommands": [ { "description": "Enable pretty-printing for gdb", "text": "-enable-pretty-printing", "ignoreFailures": true }, { "description": "Set Disassembly Flavor to Intel", "text": "-gdb-set disassembly-flavor intel", "ignoreFailures": true } ] }, ] }Debugger Logs
Other Extensions
No response
Additional Information
The
pickRemoteProcess/extension.pickRemoteNativeProcesscommand runspson the remote system with arguments that may or may not work, depending on theps"personality," which is a mode-type setting that changes how various details of thepscommand work, which is a problem because the remote system may not use the personality which is necessary for this command to work as expected.Specifically, the command runs something like
The man page for
psexplicitly documents that syntax likeps -o pid=X,comm=Ycan eitherpidand acommcolumn with headersXandYrespectively (which appears to be the behavior thispickRemoteProcessis expecting), orpidcolumn with headerX,comm=Y(which is what my remote system does).Which behavior this syntax has depends on the personality setting. The man page for
psclaims can be set via the environment variablePS_PERSONALITY, though I was not able to observe this.In this case, there is a simpler solution: don't use syntax that relies on the personality. Multiple uses of
-oshould each make their own column, so the command should be changed toThis should behave identically on systems that already worked, but should fix the problem on systems that default to a different personality.