aboutsummaryrefslogtreecommitdiff
path: root/gdb/environ.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/environ.c')
-rw-r--r--gdb/environ.c35
1 files changed, 14 insertions, 21 deletions
diff --git a/gdb/environ.c b/gdb/environ.c
index 8d5dba1..193f34d 100644
--- a/gdb/environ.c
+++ b/gdb/environ.c
@@ -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"
/* 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;
}