Community
Participate
Working Groups
Build Identifier: I20110127-2034 environment variables defined in launch configurations environment tab are not visible by the gdb process. As consequence of this, command/executable launched inside .gdbinit script or other gdb script cannot use the above defined environment variable this appears only in debug, while works in run mode Reproducible: Always Steps to Reproduce: 1. create a simple C hello world project 2. in launch configuration environment tab add a variable, for eg. ZHELLO = CIAO 3. start debug 4. with external tool like sysinternals project explorer check that the environment of gdb process don't have the ZHELLO variable defined
Created attachment 189949 [details] proposed patch attached my proposed patch
In Bug 196275 comment 1, Doug mentions that the env variables of the target are not the same as the one for the debugger. Do we really want to make the target env become the debugger env?
(In reply to comment #2) > Do we really want to make the target env become the debugger env? Here we use the environment defined in the toolchain when running GDB (Properties > C/C++ Build > Environment). This means all tools in the toolchain get a consistent env. I think users have a need to control both the env set when running gdb and the target's env, but that doesn't mean they should be one and the same.
I have a gdb command script that invoke a command that use an environment variable the only place where I can set thi variable is the environment tab of launch configuration. When gdb is launched, .gdbinit is executed, THEN the environment variable of the environment tab is passed to the debug session and the target see it (show env var in gdb console) but I need the variable to be visible when executed .gdbinit or other gdb command script when gdb starts if i use RUN instead of DEBUG the environemnt tab variable are available to the gdb process (at least for CDI, but probably I've tested it also in DSF)
James you are right, so, the patch become useless for DSF I've developed it for CDI, where what you say do not work then I see that DSF works similar and I propose the simplified patch for DSF now my question is: what is the purpose of the environment tab in launch configuration? (in DSF) if all the env vars from the build are passed to gdb