diff options
Diffstat (limited to 'gdbserver/inferiors.cc')
-rw-r--r-- | gdbserver/inferiors.cc | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/gdbserver/inferiors.cc b/gdbserver/inferiors.cc index 0a09de7..32f8478 100644 --- a/gdbserver/inferiors.cc +++ b/gdbserver/inferiors.cc @@ -28,8 +28,10 @@ std::list<thread_info *> all_threads; struct thread_info *current_thread; -/* The current working directory used to start the inferior. */ -static const char *current_inferior_cwd = NULL; +/* The current working directory used to start the inferior. + + Empty if not specified. */ +static std::string current_inferior_cwd; struct thread_info * add_thread (ptid_t thread_id, void *target_data) @@ -235,7 +237,7 @@ switch_to_process (process_info *proc) /* See gdbsupport/common-inferior.h. */ -const char * +const std::string & get_inferior_cwd () { return current_inferior_cwd; @@ -244,11 +246,7 @@ get_inferior_cwd () /* See inferiors.h. */ void -set_inferior_cwd (const char *cwd) +set_inferior_cwd (std::string cwd) { - xfree ((void *) current_inferior_cwd); - if (cwd != NULL) - current_inferior_cwd = xstrdup (cwd); - else - current_inferior_cwd = NULL; + current_inferior_cwd = std::move (cwd); } |