From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2126) id 598B1388458B; Wed, 30 Mar 2022 15:14:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 598B1388458B Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom Tromey To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Consolidate definition of current_directory X-Act-Checkin: binutils-gdb X-Git-Author: Tom Tromey X-Git-Refname: refs/heads/master X-Git-Oldrev: d537777dfe634f3109125156484e33d421b03f1b X-Git-Newrev: c50e54825bfea1ab6afbd984a4d2e78e9306e70f Message-Id: <20220330151404.598B1388458B@sourceware.org> Date: Wed, 30 Mar 2022 15:14:04 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Mar 2022 15:14:04 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Dc50e54825bfe= a1ab6afbd984a4d2e78e9306e70f commit c50e54825bfea1ab6afbd984a4d2e78e9306e70f Author: Tom Tromey Date: Mon Mar 28 09:46:55 2022 -0600 Consolidate definition of current_directory =20 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. Diff: --- gdb/top.c | 4 ---- gdbserver/server.cc | 4 ---- gdbsupport/common-defs.h | 3 --- gdbsupport/pathstuff.cc | 4 ++++ gdbsupport/pathstuff.h | 3 +++ 5 files changed, 7 insertions(+), 11 deletions(-) diff --git a/gdb/top.c b/gdb/top.c index a28e72f77f3..f12a2111a9a 100644 --- a/gdb/top.c +++ b/gdb/top.c @@ -141,10 +141,6 @@ show_confirm (struct ui_file *file, int from_tty, value); } =20 -/* 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. */ =20 diff --git a/gdbserver/server.cc b/gdbserver/server.cc index 8e53f226d3c..9f52d6e63fe 100644 --- a/gdbserver/server.cc +++ b/gdbserver/server.cc @@ -65,10 +65,6 @@ break; \ } =20 -/* String containing the current directory (what getwd would return). */ - -char *current_directory; - /* The environment to pass to the inferior when creating it. */ =20 static gdb_environ our_environ; diff --git a/gdbsupport/common-defs.h b/gdbsupport/common-defs.h index e263d948ee1..eed364a48ce 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" =20 -/* 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 cb2dd4f5782..a347123cf2b 100644 --- a/gdbsupport/pathstuff.cc +++ b/gdbsupport/pathstuff.cc @@ -29,6 +29,10 @@ =20 /* See gdbsupport/pathstuff.h. */ =20 +char *current_directory; + +/* See gdbsupport/pathstuff.h. */ + gdb::unique_xmalloc_ptr gdb_realpath (const char *filename) { diff --git a/gdbsupport/pathstuff.h b/gdbsupport/pathstuff.h index 38828b7c4a3..50e388aad04 100644 --- a/gdbsupport/pathstuff.h +++ b/gdbsupport/pathstuff.h @@ -136,4 +136,7 @@ extern const char *get_shell (); =20 extern gdb::char_vector make_temp_filename (const std::string &f); =20 +/* String containing the current directory (what getwd would return). */ +extern char *current_directory; + #endif /* COMMON_PATHSTUFF_H */