diff options
author | Tom Tromey <tromey@adacore.com> | 2022-03-28 09:46:55 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2022-03-30 09:08:48 -0600 |
commit | c50e54825bfea1ab6afbd984a4d2e78e9306e70f (patch) | |
tree | 661e2a6a793aeb0a6ede10a3c5543253cc96eb08 | |
parent | d537777dfe634f3109125156484e33d421b03f1b (diff) | |
download | binutils-c50e54825bfea1ab6afbd984a4d2e78e9306e70f.zip binutils-c50e54825bfea1ab6afbd984a4d2e78e9306e70f.tar.gz binutils-c50e54825bfea1ab6afbd984a4d2e78e9306e70f.tar.bz2 |
Consolidate definition of current_directory
I noticed that both gdbserver and gdb define current_directory.
However, as it is referenced by gdbsupport, it seemed better to define
it there as well. This patch also moves the declaration to
pathstuff.h. Tested by rebuilding.
-rw-r--r-- | gdb/top.c | 4 | ||||
-rw-r--r-- | gdbserver/server.cc | 4 | ||||
-rw-r--r-- | gdbsupport/common-defs.h | 3 | ||||
-rw-r--r-- | gdbsupport/pathstuff.cc | 4 | ||||
-rw-r--r-- | gdbsupport/pathstuff.h | 3 |
5 files changed, 7 insertions, 11 deletions
@@ -141,10 +141,6 @@ show_confirm (struct ui_file *file, int from_tty, value); } -/* Current working directory. */ - -char *current_directory; - /* The last command line executed on the console. Used for command repetitions when the user enters an empty line. */ diff --git a/gdbserver/server.cc b/gdbserver/server.cc index 8e53f22..9f52d6e 100644 --- a/gdbserver/server.cc +++ b/gdbserver/server.cc @@ -65,10 +65,6 @@ break; \ } -/* String containing the current directory (what getwd would return). */ - -char *current_directory; - /* The environment to pass to the inferior when creating it. */ static gdb_environ our_environ; diff --git a/gdbsupport/common-defs.h b/gdbsupport/common-defs.h index e263d94..eed364a 100644 --- a/gdbsupport/common-defs.h +++ b/gdbsupport/common-defs.h @@ -213,9 +213,6 @@ /* Pull in gdb::unique_xmalloc_ptr. */ #include "gdbsupport/gdb_unique_ptr.h" -/* String containing the current directory (what getwd would return). */ -extern char *current_directory; - /* sbrk on macOS is not useful for our purposes, since sbrk(0) always returns the same value. brk/sbrk on macOS is just an emulation that always returns a pointer to a 4MB section reserved for diff --git a/gdbsupport/pathstuff.cc b/gdbsupport/pathstuff.cc index cb2dd4f..a347123 100644 --- a/gdbsupport/pathstuff.cc +++ b/gdbsupport/pathstuff.cc @@ -29,6 +29,10 @@ /* See gdbsupport/pathstuff.h. */ +char *current_directory; + +/* See gdbsupport/pathstuff.h. */ + gdb::unique_xmalloc_ptr<char> gdb_realpath (const char *filename) { diff --git a/gdbsupport/pathstuff.h b/gdbsupport/pathstuff.h index 38828b7..50e388a 100644 --- a/gdbsupport/pathstuff.h +++ b/gdbsupport/pathstuff.h @@ -136,4 +136,7 @@ extern const char *get_shell (); extern gdb::char_vector make_temp_filename (const std::string &f); +/* String containing the current directory (what getwd would return). */ +extern char *current_directory; + #endif /* COMMON_PATHSTUFF_H */ |