Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 312422

Summary: Gdb 7.1 does not take the environment correctly
Product: [Tools] CDT Reporter: Rudolf Hornig <rudolf.hornig>
Component: cdt-debug-dsf-gdbAssignee: Project Inbox <cdt-debug-dsf-gdb-inbox>
Status: RESOLVED NOT_ECLIPSE QA Contact: Marc Khouzam <marc.khouzam>
Severity: major    
Priority: P3 CC: martin, pawel.1.piech
Version: 0 DD 1.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Rudolf Hornig CLA 2010-05-11 09:29:50 EDT
Build Identifier: 3.5.2

When using gdb 7.1 (MINGW) (and 7.0 too), when I set an environment variable, it is set by the "set environment VAR VALUE" command but because of a gdb bug the process does not receive the new variable. This causes the debug session to fail if path to required DLLs are set in the process environment (i.e. on the environment tab). This seems to be a gdb bug (http://sourceforge.net/tracker/?func=detail&atid=102435&aid=2994861&group_id=2435) but somehow it should be worked around in CDT too.

Reproducible: Always

Steps to Reproduce:
- Make sure you are using gdb 7.x
- Create a small C project using:

#include <stdio.h>
#include <stdlib.h>
int main()
{
printf("TEST = %s\n", getenv("TEST"));
return 0;
}

Create a lauch configuration and set the TEST environement variable on the Environment tab to "HELLOWORLD"

Run the program. It will display correctly TEST=HELLOWORLD

Now debug with the same configuration. It will print TEST=(null)
Comment 1 Marc Khouzam CLA 2010-05-26 09:47:21 EDT
Another reference to this GDB problem
http://sourceware.org/ml/gdb-patches/2010-05/msg00317.html