Closed sbobko closed 1 year ago
@sean-mcmanus , @browntarik @Colengms Could you help me to sort out this problem?
@WardenGnaw Are you able to help?
From the logs I can see GDB setting it to its debug session.
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (2366) <-1013-interpreter-exec console \"set env ZET_ENABLE_PROGRAM_DEBUGGING 1\"\n"},"seq":142} 1: (2366) <-1013-interpreter-exec console "set env ZET_ENABLE_PROGRAM_DEBUGGING 1" --> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (2368) <-1014-interpreter-exec console \"set env IGC_EnableGTLocationDebugging 1\"\n"},"seq":150} 1: (2368) <-1014-interpreter-exec console "set env IGC_EnableGTLocationDebugging 1"
These variables are expected to only live in the debugee process. They should be set in the created process' environment before it starts up. They are not set in the terminal.
Hello @WardenGnaw , this is exactly the problem, environment variables are not set for the process being debugged. I found out this because without these environment variables, debugging the GPU kernel is impossible. However, everything works if I set variables in the Debug console manually.
This issue has been closed because the described behavior was determined to be by design.
With this example program, I was able to see the environment set by environment
.
#include <iostream>
int main(int argc, char **argv, char **envp)
{
for (char **env = envp; *env != 0; env++)
{
char *thisEnv = *env;
printf("%s\n", thisEnv);
}
return 0;
{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/a.out",
"args": [],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": [
{
"name": "ZET_ENABLE_PROGRAM_DEBUGGING", "value": "1"
},
{
"name": "IGC_EnableGTLocationDebugging", "value": "1"
}
],
"externalConsole": false,
"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
}
]
}
]
}
Terminal Output:
SHELL=/bin/bash
COLORTERM=truecolor
WSL2_GUI_APPS_ENABLED=1
TERM_PROGRAM_VERSION=1.77.1
WSL_DISTRO_NAME=Ubuntu
ZET_ENABLE_PROGRAM_DEBUGGING=1
...
DISPLAY=:0
SHLVL=2
IGC_EnableGTLocationDebugging=1
Environment
Bug Summary and Steps to Reproduce
Bug Summary: Variables listed in "environment" are not applied.
Steps to reproduce:
extra: https://github.com/microsoft/vscode/issues/177857
Debugger Configurations
Other Extensions
No response
Additional Information
No response