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.
This commit is contained in:
Tom Tromey 2022-03-28 09:46:55 -06:00
parent d537777dfe
commit c50e54825b
5 changed files with 7 additions and 11 deletions

View File

@ -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. */

View File

@ -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;

View File

@ -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

View File

@ -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)
{

View File

@ -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 */