Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 338420 - Launch configuration's Environment tab variables are not passed to the gdb process itself
Summary: Launch configuration's Environment tab variables are not passed to the gdb pr...
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-debug-dsf-gdb (show other bugs)
Version: 8.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-28 09:48 EST by Gaetano Santoro CLA
Modified: 2020-09-04 15:22 EDT (History)
3 users (show)

See Also:


Attachments
proposed patch (1.34 KB, patch)
2011-02-28 09:49 EST, Gaetano Santoro CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Gaetano Santoro CLA 2011-02-28 09:48:41 EST
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
Comment 1 Gaetano Santoro CLA 2011-02-28 09:49:49 EST
Created attachment 189949 [details]
proposed patch

attached my proposed patch
Comment 2 Marc Khouzam CLA 2011-02-28 11:21:20 EST
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?
Comment 3 James Blackburn CLA 2011-02-28 11:35:27 EST
(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.
Comment 4 Gaetano Santoro CLA 2011-02-28 11:41:53 EST
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)
Comment 5 Gaetano Santoro CLA 2011-02-28 11:52:48 EST
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