Type: Debugger
Describe the bug
OS and Version: Linux (RHEL 7.6)
VS Code Version: 1.43.0
C/C++ Extension Version: 0.27.0-insiders
Other extensions you installed (and if the issue persists after disabling them): It does
To Reproduce
Please include a code sample and launch.json configuration.
Example launch.json:
{
"name": "debug_Binary",
"type": "cppdbg",
"request": "attach",
"program": "${workspaceRoot}/debug64/bin/debug_Binary",
"processId": "${command:pickRemoteProcess}",
"MIMode": "gdb",
"pipeTransport": {
"pipeCwd": "/usr/bin",
"pipeProgram": "/usr/bin/ssh",
"pipeArgs": ["top@${input:serverName}"],
"debuggerPath": "/usr/bin/gdb"
},
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
},
"inputs": [
{
"type": "promptString",
"id": "serverName",
"description": "Server to connect to"
}
]
Steps to reproduce the behavior:
ssh: Could not resolve hostname : Name or service not known
Command failed: "/usr/bin/ssh" "top@${input:serverName}" 'sh -c "uname && if [ $(uname) = \"Linux\" ] ; then ps axww -o pid=,comm=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,args= ; elif [ $(uname) = \"Darwin\" ] ; then ps axww -o pid=,comm=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,args= -c; fi"'
Additional context
If applicable, please include logging by adding "logging": { "engineLogging": true, "trace": true, "traceResponse": true } in your launch.json
The pipeArgs is substituted if ${command:pickRemoteProcess} is not used (i.e. with explicit process ID configuration)
FWIW the substitution will work with the remoteProcessPicker for ${config: } variables, it seems to be a specific issue with ${input: }
Could this be because input type isn't resolved in the resolveVariables function from src/common.ts ?
${input:...} is resolved by VS Code.
This used to be an issue for VS Code to provide us a way to replace those. But they recently created an hook resolveDebugConfigurationWithSubstitutedVariables to use.
I've tried to look at adding this myself, but I've found an issue - it seems as though the ${command:pickRemoteProcess} is resolved during the resolveDebugConfiguration call, so the ${input:...} is always passed unresolved.
Since resolveDebugConfigurationWithSubstitutedVariables is called after resolveDebugConfiguration I don't think there is a way to get ${input:...} to work with it right now.
I think if we get rid of resolveDebugConfiguration in the extension and only have resolveDebugConfigurationWithSubstitutedVariables, ${command:*} will be resolved only in resolveDebugConfigurationWithSubstitutedVariables
If resolveDebugConfiguration does not exist, it will never be called.
I've now tried this with just resolveDebugConfigurationWithSubstitutedVariables defined, and it gets a slight improvement - the input prompt pops up but then in the config object passed to ShowAttachEntries() the variable is still not resolved:

Other variable types which aren't ${input:*} are resolved by this point though. Could this be a bug with VSCode and resolveDebugConfigurationWithSubstitutedVariables ?
Yeah, this would be an issue with the VS Code extension. In microsoft/vscode#87450, they mentioned it was either provide an API to resolve variables or create a new API for resolvingDebug configuraitons and they went with the latter. This means that we have no way to resolve ${input:...} at this point.
Can you file an issue that not all variables are being substituted in resolveDebugConfigurationWithSubstitutedVariables?
Looks like someone has already opened an issue
@Helloimbob Thank you for your time investigating this issue.
Lets readdress this once https://github.com/microsoft/vscode/issues/89758 is resolved.