Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Christopher Faylor <cgf@redhat.com>
To: gdb-patches@sources.redhat.com
Subject: [PATCH] Make cygwin use .gdbinit
Date: Sat, 10 Nov 2001 12:38:00 -0000	[thread overview]
Message-ID: <20011124182316.GA24305@redhat.com> (raw)

I've changed the default initialization file for cygwin to '.gdbinit',
issuing a warning if the old style initialization filename was found.

Since this changes documented behavior, I also modified the documentation
as an obvious fix.

FYI,
cgf

ChangeLog:
2001-11-24  Christopher Faylor  <cgf@redhat.com>

	* win32-nat.c (_initialize_check_for_gdb_ini): New function.

doc/ChangeLog:
2001-11-24  Christopher Faylor  <cgf@redhat.com>

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

Index: win32-nat.c
===================================================================
RCS file: /cvs/uberbaum/gdb/win32-nat.c,v
retrieving revision 1.36
diff -u -p -r1.36 win32-nat.c
--- win32-nat.c	2001/11/01 16:17:08	1.36
+++ win32-nat.c	2001/11/24 18:17:38
@@ -32,6 +32,7 @@
 #include "command.h"
 #include "completer.h"
 #include "regcache.h"
+#include "top.h"
 #include <signal.h>
 #include <sys/types.h>
 #include <fcntl.h>
@@ -1752,4 +1753,32 @@ void
 _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);
+	}
+    }
 }
Index: config/i386/xm-cygwin.h
===================================================================
RCS file: /cvs/uberbaum/gdb/config/i386/xm-cygwin.h,v
retrieving revision 1.4
diff -u -p -r1.4 xm-cygwin.h
--- xm-cygwin.h	2001/08/27 22:39:56	1.4
+++ xm-cygwin.h	2001/11/24 18:17:38
@@ -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 
Index: doc/gdb.texinfo
===================================================================
RCS file: /cvs/uberbaum/gdb/doc/gdb.texinfo,v
retrieving revision 1.55
diff -u -p -r1.55 gdb.texinfo
--- gdb.texinfo	2001/11/22 00:21:45	1.55
+++ gdb.texinfo	2001/11/24 18:17:49
@@ -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 t
 @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


             reply	other threads:[~2001-11-24 18:23 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-10 12:38 Christopher Faylor [this message]
2001-11-10 13:37 ` Eli Zaretskii
2001-11-10 21:53   ` Christopher Faylor
2001-11-25 11:14     ` Eli Zaretskii
2001-11-11  1:14       ` Eli Zaretskii
2001-11-11  8:09       ` Christopher Faylor
2001-11-11  9:57         ` DJ Delorie
2001-11-11 10:33           ` Eli Zaretskii
2001-11-25 23:55             ` Eli Zaretskii
2001-11-26 10:32             ` Christopher Faylor
2001-11-12 13:13               ` Christopher Faylor
2001-11-12 14:43               ` Eli Zaretskii
2001-11-12 21:19                 ` Christopher Faylor
2001-11-26 12:34                   ` Christopher Faylor
2001-11-26 11:23                 ` Eli Zaretskii
2001-11-26 10:42               ` DJ Delorie
2001-11-12 13:22                 ` DJ Delorie
2001-11-25 20:09           ` DJ Delorie
2001-11-25 11:35         ` Christopher Faylor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20011124182316.GA24305@redhat.com \
    --to=cgf@redhat.com \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox