From: Christopher Faylor Date: Sat, 24 Nov 2001 18:21:27 +0000 (+0000) Subject: * win32-nat.c (_initialize_check_for_gdb_ini): New function. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2a3d56452522dae64cbc02bc72166e674dbc1032;p=binutils-gdb.git * win32-nat.c (_initialize_check_for_gdb_ini): New function. * config/i386/xm-cygwin.h: Remove obsolete handling of __CYGWIN32__. (GDBINIT_FILENAME): Remove. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 8f5dc9111d8..761c7f47929 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2001-11-24 Christopher Faylor + + * win32-nat.c (_initialize_check_for_gdb_ini): New function. + * config/i386/xm-cygwin.h: Remove obsolete handling of __CYGWIN32__. + (GDBINIT_FILENAME): Remove. + 2001-11-23 Mark Kettenis Add x86 OpenBSD native configuration. diff --git a/gdb/config/i386/xm-cygwin.h b/gdb/config/i386/xm-cygwin.h index bb9cfd893c5..1945a75aea7 100644 --- a/gdb/config/i386/xm-cygwin.h +++ b/gdb/config/i386/xm-cygwin.h @@ -22,15 +22,5 @@ #include "fopen-bin.h" -#define GDBINIT_FILENAME "gdb.ini" - /* Define this if source files use \r\n rather than just \n. */ #define CRLF_SOURCE_FILES - -/* If under Cygwin, provide backwards compatibility with older - Cygwin compilers that don't define the current cpp define. */ -#ifdef __CYGWIN32__ -#ifndef __CYGWIN__ -#define __CYGWIN__ -#endif -#endif diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 97ab02d8b90..c0d928a34c4 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,9 @@ +2001-11-24 Christopher Faylor + + * gdb.texinfo (File Options): Change description of -nx and gdb.ini to + specifically refer to MS-DOS. + (command files): Mention gdb.ini is only used on MS-DOS. + 2001-11-21 Tom Tromey * gdb.texinfo (Invoking GDB): Document --args. diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 4d55b7a59fe..f682067119a 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -913,7 +913,7 @@ batch mode or quiet mode. @cindex @code{--nx} @cindex @code{-n} Do not execute commands found in any initialization files (normally -called @file{.gdbinit}, or @file{gdb.ini} on PCs). Normally, +called @file{.gdbinit} or @file{gdb.ini} under MS-DOS). Normally, @value{GDBN} executes the commands in these files after all the command options and arguments have been processed. @xref{Command Files,,Command files}. @@ -13067,8 +13067,9 @@ the last command, as it would from the terminal. @cindex @file{.gdbinit} @cindex @file{gdb.ini} When you start @value{GDBN}, it automatically executes commands from its -@dfn{init files}. These are files named @file{.gdbinit} on Unix and -@file{gdb.ini} on DOS/Windows. During startup, @value{GDBN} does the +@dfn{init files}. These files are normally named @file{.gdbinit} although +filename limitations require that they be named @file{gdb.ini} on MS-DOS. +During startup, @value{GDBN} does the following: @enumerate diff --git a/gdb/win32-nat.c b/gdb/win32-nat.c index ab5f3f32878..48ac8931a7a 100644 --- a/gdb/win32-nat.c +++ b/gdb/win32-nat.c @@ -32,6 +32,7 @@ #include "command.h" #include "completer.h" #include "regcache.h" +#include "top.h" #include #include #include @@ -1753,3 +1754,31 @@ _initialize_core_win32 (void) { add_core_fns (&win32_elf_core_fns); } + +void +_initialize_check_for_gdb_ini (void) +{ + char *homedir; + if (inhibit_gdbinit) + return; + + homedir = getenv ("HOME"); + if (homedir) + { + char *p; + char *oldini = (char *) alloca (strlen (homedir) + + sizeof ("/gdb.ini")); + strcpy (oldini, homedir); + p = strchr (oldini, '\0'); + if (p > oldini && p[-1] != '/') + *p++ = '/'; + strcpy (p, "gdb.ini"); + if (access (oldini, 0) == 0) + { + int len = strlen (oldini); + char *newini = alloca (len + 1); + sprintf (newini, "%.*s.gdbinit", len - (sizeof ("gdb.ini") - 1), oldini); + warning ("obsolete '%s' found. Rename to '%s'.", oldini, newini); + } + } +} diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index ab5f3f32878..48ac8931a7a 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -32,6 +32,7 @@ #include "command.h" #include "completer.h" #include "regcache.h" +#include "top.h" #include #include #include @@ -1753,3 +1754,31 @@ _initialize_core_win32 (void) { add_core_fns (&win32_elf_core_fns); } + +void +_initialize_check_for_gdb_ini (void) +{ + char *homedir; + if (inhibit_gdbinit) + return; + + homedir = getenv ("HOME"); + if (homedir) + { + char *p; + char *oldini = (char *) alloca (strlen (homedir) + + sizeof ("/gdb.ini")); + strcpy (oldini, homedir); + p = strchr (oldini, '\0'); + if (p > oldini && p[-1] != '/') + *p++ = '/'; + strcpy (p, "gdb.ini"); + if (access (oldini, 0) == 0) + { + int len = strlen (oldini); + char *newini = alloca (len + 1); + sprintf (newini, "%.*s.gdbinit", len - (sizeof ("gdb.ini") - 1), oldini); + warning ("obsolete '%s' found. Rename to '%s'.", oldini, newini); + } + } +}