Re: [PATCH 2/7] gdb: use get_standard_config_dir when looking for .gdbinit

Tom Tromey
2020-11-09T13:53:03Z

>>>>> "Andrew" == Andrew Burgess <andrew.burgess@embecosm.com> writes:

Andrew> This commit effectively changes the default location of the .gdbinit
Andrew> file, while maintaining backward compatibility.

Andrew> diff --git a/gdbsupport/pathstuff.cc b/gdbsupport/pathstuff.cc
Andrew> index 9fb5e5cf614..a52e53b8671 100644
Andrew> --- a/gdbsupport/pathstuff.cc
Andrew> +++ b/gdbsupport/pathstuff.cc
Andrew> @@ -23,6 +23,10 @@
Andrew> #include "filenames.h"
Andrew> #include "gdb_tilde_expand.h"

Andrew> +#include <sys/types.h>
Andrew> +#include <sys/stat.h>
Andrew> +#include <unistd.h>
Andrew> +
Andrew> #ifdef USE_WIN32API
Andrew> #include <windows.h>
Andrew> #endif
Andrew> @@ -298,6 +302,51 @@ get_standard_config_dir ()
Andrew> return {};
Andrew> }

Andrew> +std::string
Andrew> +find_gdb_home_config_file (const char *name, struct stat *buf)
Andrew> +{

For my mingw build, this fails with:

CXX pathstuff.o
../../binutils-gdb/gdbsupport/pathstuff.cc:324:1: error: no previous declaration for 'std::string find_gdb_home_config_file(const char*, _stati64*)' [-Werror=missing-declarations]
324 | find_gdb_home_config_file (const char *name, struct stat *buf)
| ^~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors

I suppose the definition of "stat" changes between the header and the
.cc file, probably due to the new includes somehow.

I configure like this:

../binutils-gdb/configure '--host=i686-w64-mingw32' '--target=i686-w64-mingw32' '--disable-binutils' '--disable-gas' '--disable-gold' '--disable-gprof' '--disable-ld' '--disable-guile' '--disable-source-highlight' 'host_alias=i686-w64-mingw32' 'target_alias=i686-w64-mingw32' '--without-debuginfod'

This build is done on x86-64 Fedora 32.

Tom