Does anyone know why the cygwin version of gdb doesn't pass exported
variables to the program being debugged? I have a simple test case
where the program can retrieve an environment variable via getenv().
The program works when NOT running with gdb. If I run the same
executable with gdb, either window or non-window mode, the same
variable is not defined -- not retrievable via getenv().

Thanks for any help!!





cat x.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>



int
main (int argc, char *argv[])
{
        char    *env;

        env = getenv ("Var1");
        printf ("Var1=[%s]\n", env==NULL?"NULL":env);
        return 0;
}

gcc -g x.c -o x
gcc -dumpversion
2.95.3-5

Maybe the problem is due to:
  ntdll.dll: No such file or directory.
But, dunno what that means either...

Also:
bash --version
GNU bash, version 2.05a.0(2)-release (i686-pc-cygwin)
Copyright 2001 Free Software Foundation, Inc.

WEASEL:> export Var1=1
WEASEL:> x
Var1=[1]
WEASEL:> gdb -nw x
GNU gdb 5.0 (20010428-3)
Copyright 2001 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and
you are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for
details.
This GDB was configured as "i686-pc-cygwin"...
(gdb) run
Starting program: /home/harold/win32_1-0/mainsail/build/bin/x.exe
ntdll.dll: No such file or directory.
Var1=[NULL]

Program exited normally.
(gdb) quit
WEASEL:>

_______________________________________________
Bug-gdb mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-gdb

Reply via email to