diff options
author | Vladimir Prus <vladimir@codesourcery.com> | 2010-01-20 14:23:07 +0000 |
---|---|---|
committer | Vladimir Prus <vladimir@codesourcery.com> | 2010-01-20 14:23:07 +0000 |
commit | 3f81c18a86568f2d36fda242e9221a3526550f64 (patch) | |
tree | 7a69a7d908e74eb4b02ba02e4f89f65089e9b347 /gdb/mi | |
parent | 760f3a89bc848e34713cbbe356c1dfb5af2514ba (diff) | |
download | gdb-3f81c18a86568f2d36fda242e9221a3526550f64.zip gdb-3f81c18a86568f2d36fda242e9221a3526550f64.tar.gz gdb-3f81c18a86568f2d36fda242e9221a3526550f64.tar.bz2 |
Per-inferior args and tty and environment.
* infcmd.c (inferior_args): Rename to ...
(inferior_args_scratch): ... this.
(inferior_io_terminal): Rename to ...
(inferior_io_terminal_scratch): ... this.
(inferior_argc, inferior_argv): Remove.
(set_inferior_io_terminal, get_inferior_io_terminal): Store
inside current_inferior().
(set_inferior_tty_command, show_inferior_tty_command): New.
(get_inferior_args, set_inferior_args): Store inside
current_inferior().
(notice_args_set): Likewise and rename to...
(set_args_command): ... this.
(set_inferior_args_vector): Likewise.
(notice_args_read): Rename to...
(show_args_command): ...new.
(tty_command): Remove.
(run_command_1): Don't free old args, as they are freed by
set_inferior_arg now.
(run_no_args_command): Likewise.
(inferior_environ): Remove.
(run_command_1): Use environment of the current inferior.
(environment_info, set_environment_command)
(unset_environment_command, path_info, path_command): Likewise.
(_initialize_infcmd): Adjust for function and variable renames.
Do not init inferior_environ.
* inferior.h (set_inferior_arg): Adjust prototype.
(struct inferior): New fields args, argc, argv, terminal, environment.
(inferior_environ): Remove declaration.
* inferior.c (free_inferior): Free new fields.
(add_inferior_silent): Initialize 'environment' field.
* main.c (captured_main): Set arguments only after the initial
inferior has been created. Set set_inferior_io_terminal,
not tty_command.
* mi/mi-main.c (mi_cmd_env_path): Use environment of the current
inferior.
(_initialize_mi_cmd_env): Adjust for disappearance of global
inferior_environ.
* solib.c (solib_find): Use environment of the current inferior.
Diffstat (limited to 'gdb/mi')
-rw-r--r-- | gdb/mi/mi-cmd-env.c | 17 |
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) |