Fix PR gdb/21954: make 'unset environment' work again
When I made commit 9a6c7d9c02
, which
C++-fied gdb/common/environ.[ch], I mistakenly altered the behaviour
of the 'unset environment' command. This command, which should delete
all environment variables, is now resetting the list of variables to
the state they were when GDB was started.
This commit fixes this regression, and also adds a test on
gdb.base/environ.exp which really checks if 'unset environment'
worked.
gdb/ChangeLog:
2017-08-15 Sergio Durigan Junior <sergiodj@redhat.com>
PR gdb/21954
* infcmd.c (unset_environment_command): Use the 'clear' method on
the environment instead of resetting it.
gdb/testsuite/ChangeLog:
2017-08-15 Sergio Durigan Junior <sergiodj@redhat.com>
PR gdb/21954
* gdb.base/environ.exp: Add test to check if 'unset environment'
works.
This commit is contained in:
parent
0335ac6d12
commit
206726fbfd
4 changed files with 16 additions and 1 deletions
|
@ -2230,7 +2230,7 @@ unset_environment_command (char *var, int from_tty)
|
|||
/* If there is no argument, delete all environment variables.
|
||||
Ask for confirmation if reading from the terminal. */
|
||||
if (!from_tty || query (_("Delete all environment variables? ")))
|
||||
current_inferior ()->environment = gdb_environ::from_host_environ ();
|
||||
current_inferior ()->environment.clear ();
|
||||
}
|
||||
else
|
||||
current_inferior ()->environment.unset (var);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue