aboutsummaryrefslogtreecommitdiff
path: root/gdb/common/environ.h
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/common/environ.h')
-rw-r--r--gdb/common/environ.h24
1 files changed, 23 insertions, 1 deletions
diff --git a/gdb/common/environ.h b/gdb/common/environ.h
index 0bbb191..4003f4e 100644
--- a/gdb/common/environ.h
+++ b/gdb/common/environ.h
@@ -18,6 +18,7 @@
#define ENVIRON_H 1
#include <vector>
+#include <set>
/* Class that represents the environment variables as seen by the
inferior. */
@@ -41,12 +42,16 @@ public:
/* Move constructor. */
gdb_environ (gdb_environ &&e)
- : m_environ_vector (std::move (e.m_environ_vector))
+ : m_environ_vector (std::move (e.m_environ_vector)),
+ m_user_set_env (std::move (e.m_user_set_env)),
+ m_user_unset_env (std::move (e.m_user_unset_env))
{
/* Make sure that the moved-from vector is left at a valid
state (only one NULL element). */
e.m_environ_vector.clear ();
e.m_environ_vector.push_back (NULL);
+ e.m_user_set_env.clear ();
+ e.m_user_unset_env.clear ();
}
/* Move assignment. */
@@ -73,9 +78,26 @@ public:
/* Return the environment vector represented as a 'char **'. */
char **envp () const;
+ /* Return the user-set environment vector. */
+ const std::set<std::string> &user_set_env () const;
+
+ /* Return the user-unset environment vector. */
+ const std::set<std::string> &user_unset_env () const;
+
private:
+ /* Unset VAR in environment. If UPDATE_UNSET_LIST is true, then
+ also update M_USER_UNSET_ENV to reflect the unsetting of the
+ environment variable. */
+ void unset (const char *var, bool update_unset_list);
+
/* A vector containing the environment variables. */
std::vector<char *> m_environ_vector;
+
+ /* The environment variables explicitly set by the user. */
+ std::set<std::string> m_user_set_env;
+
+ /* The environment variables explicitly unset by the user. */
+ std::set<std::string> m_user_unset_env;
};
#endif /* defined (ENVIRON_H) */