aboutsummaryrefslogtreecommitdiff
path: root/gdb/mi/mi-cmd-env.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/mi/mi-cmd-env.c')
-rw-r--r--gdb/mi/mi-cmd-env.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/gdb/mi/mi-cmd-env.c b/gdb/mi/mi-cmd-env.c
index d9703ee..cdd25f2 100644
--- a/gdb/mi/mi-cmd-env.c
+++ b/gdb/mi/mi-cmd-env.c
@@ -162,7 +162,7 @@ mi_cmd_env_path (char *command, char **argv, int argc)
else
{
/* Otherwise, get current path to modify. */
- env = get_in_environ (inferior_environ, path_var_name);
+ env = get_in_environ (current_inferior ()->environment, path_var_name);
/* Can be null if path is not set. */
if (!env)
@@ -173,9 +173,9 @@ mi_cmd_env_path (char *command, char **argv, int argc)
for (i = argc - 1; i >= 0; --i)
env_mod_path (argv[i], &exec_path);
- set_in_environ (inferior_environ, path_var_name, exec_path);
+ set_in_environ (current_inferior ()->environment, path_var_name, exec_path);
xfree (exec_path);
- env = get_in_environ (inferior_environ, path_var_name);
+ env = get_in_environ (current_inferior ()->environment, path_var_name);
ui_out_field_string (uiout, "path", env);
}
@@ -260,10 +260,17 @@ mi_cmd_inferior_tty_show (char *command, char **argv, int argc)
void
_initialize_mi_cmd_env (void)
{
+ struct gdb_environ *environment;
char *env;
- /* We want original execution path to reset to, if desired later. */
- env = get_in_environ (inferior_environ, path_var_name);
+ /* We want original execution path to reset to, if desired later.
+ At this point, current inferior is not created, so cannot use
+ current_inferior ()->environment. Also, there's no obvious
+ place where this code can be moved suchs that it surely run
+ before any code possibly mangles original PATH. */
+ environment = make_environ ();
+ init_environ (environment);
+ env = get_in_environ (environment, path_var_name);
/* Can be null if path is not set. */
if (!env)