Back out change to signals.exp (test_handle_all_print): Add setup_xfail for "alpha...
[deliverable/binutils-gdb.git] / gdb / environ.c
index 8d5dba1339342a3d04a5f25e816d6671fa015d15..193f34de53afaf6c4b75c07814f3719ce641c680 100644 (file)
@@ -20,8 +20,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #include "defs.h"
 #include "environ.h"
-#include <string.h>
-#include "defs.h" /* For strsave().  */
+#include "gdb_string.h"
+#include "gdbcore.h"
 
 \f
 /* Return a new environment object.  */
@@ -64,6 +64,9 @@ init_environ (e)
   extern char **environ;
   register int i;
 
+  if (environ == NULL)
+    return;
+
   for (i = 0; environ[i]; i++) /*EMPTY*/;
 
   if (e->allocated < i)
@@ -149,26 +152,16 @@ set_in_environ (e, var, value)
   strcat (s, value);
   vector[i] = s;
 
-  /* Certain variables get exported back to the parent (e.g. our) 
-     environment, too.  FIXME: this is a hideous hack and should not be
-     allowed to live.  What if we want to change the environment we pass to
-     the program without affecting GDB's behavior?  */
-  if (STREQ(var, "PATH")               /* Object file location */
-      || STREQ (var, "G960BASE")               /* Intel 960 downloads */
-      || STREQ (var, "G960BIN")                /* Intel 960 downloads */
-      )
-    {
-      putenv (strsave (s));
-    }
+  /* This used to handle setting the PATH and GNUTARGET variables
+     specially.  The latter has been replaced by "set gnutarget"
+     (which has worked since GDB 4.11).  The former affects searching
+     the PATH to find SHELL, and searching the PATH to find the
+     argument of "symbol-file" or "exec-file".  Maybe we should have
+     some kind of "set exec-path" for that.  But in any event, having
+     "set env" affect anything besides the inferior is a bad idea.
+     What if we want to change the environment we pass to the program
+     without afecting GDB's behavior?  */
 
-  /* This is a compatibility hack, since GDB 4.10 and older didn't have
-     `set gnutarget'.  Eventually it should go away, so that (for example)
-     you can debug objdump's handling of GNUTARGET without affecting GDB's
-     behavior.  */
-  if (STREQ (var, "GNUTARGET"))
-    {
-      set_gnutarget (value);
-    }
   return;
 }
 
This page took 0.024559 seconds and 4 git commands to generate.