diff options
author | Pierre Muller <muller@sourceware.org> | 2011-10-05 14:23:37 +0000 |
---|---|---|
committer | Pierre Muller <muller@sourceware.org> | 2011-10-05 14:23:37 +0000 |
commit | 7fea69231b71b2bae46c2a8f9bb77d6739c3e1b4 (patch) | |
tree | 40f3af23cf956074212b0412e5b5d5301123cc7f /gdb/testsuite/gdb.base/testenv.c | |
parent | d4cb0ea0caf03bea93ae6891017bb2301facb33f (diff) | |
download | gdb-7fea69231b71b2bae46c2a8f9bb77d6739c3e1b4.zip gdb-7fea69231b71b2bae46c2a8f9bb77d6739c3e1b4.tar.gz gdb-7fea69231b71b2bae46c2a8f9bb77d6739c3e1b4.tar.bz2 |
Add tests for passing of environment variables to inferior.
* gdb.base/testenv.c: New test source.
* gdb.base/testenv.exp: New expect test.
Diffstat (limited to 'gdb/testsuite/gdb.base/testenv.c')
-rwxr-xr-x | gdb/testsuite/gdb.base/testenv.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.base/testenv.c b/gdb/testsuite/gdb.base/testenv.c new file mode 100755 index 0000000..83f7e9c --- /dev/null +++ b/gdb/testsuite/gdb.base/testenv.c @@ -0,0 +1,47 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2011 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* + This source is used to check that GDB correctly + passes on environment variables down to inferior. + One of the tests checks that 'unset' variables also are removed from + inferior environment list. */ + +#include <stdio.h> + +int main (int argc, char **argv, char **envp) + +{ + int i, j; +#ifdef usestubs + set_debug_traps(); + breakpoint(); +#endif + + j = 0; + for (i = 0; envp[i]; i++) + { + if (strncmp ("TEST_GDB", envp[i], 8) == 0) + { + printf ("%s\n", envp[i]); + j++; + } + } + printf ("Program found %d variables starting with TEST_GDB\n", j); + return 0; /* set breakpoint here. */ +} + |