This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[RFA] Get rid of xm-go32.h (was: [COMMIT] Get rid of xm-cygwin.h)
> Date: Fri, 06 May 2005 13:14:08 +0300
> From: "Eli Zaretskii" <eliz@gnu.org>
> CC: gdb-patches@sourceware.org
>
> > Date: Fri, 6 May 2005 10:07:09 +0200
> > From: Mark Kettenis <kettenis@gnu.org>
> > CC: eliz@gnu.org
> >
> > Eli, any chance you can get rid of xm-go32.h too?
>
> Chance, yes. We have a public holiday coming up, I hope I will have
> time to finally keep my promise to Andrew.
The holiday came, and here's what I have in my sandbox. Is this way
of solving the issue of non-standard init file names is acceptable?
If so, I will commit the changes.
Note that tm-cisco.h and tm-os68k.h override the standard definition
of GDBINIT_FILENAME. Should we switch those platforms to the dynamic
initialization as well?
2005-05-11 Eli Zaretskii <eliz@gnu.org>
* config/i386/xm-go32.h: Remove file.
* config/i386/go32.mh (XM_FILE): Remove xm-go32.h.
* go32-nat.c (init_go32_ops): Override the default value of
gdbinit[] with "gdb.ini".
* cli/cli-cmds.c (init_cli_cmds): Use gdbinit[] instead of a
compile-time literal string GDBINIT_FILENAME.
* top.c (PATH_MAX): Define if not defined.
(gdbinit): Declare with a constant size PATH_MAX and don't
initialize statically.
(gdb_init): Initialize gdbinit[] dynamically using
GDBINIT_FILENAME.
--- gdb/config/i386/xm-go32.h~0 2004-11-13 19:00:02.000000000 +0200
+++ /dev/null 2005-05-12 11:47:16.000000000 +0300
@@ -1,21 +0,0 @@
-/* Host-dependent definitions for Intel x86 running DJGPP.
- Copyright 1993-1996 Free Software Foundation, Inc.
-
- This file is part of GDB.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#define GDBINIT_FILENAME "gdb.ini"
--- gdb/config/i386/go32.m~0 2004-01-20 11:29:16.000000000 +0200
+++ gdb/config/i386/go32.mh 2005-05-11 19:32:58.000000000 +0300
@@ -1,7 +1,7 @@
# Host: Intel x86 running DJGPP
MH_CFLAGS=
-XM_FILE= xm-go32.h
+XM_FILE=
NAT_FILE= nm-go32.h
NATDEPFILES= go32-nat.o i386-nat.o
--- gdb/top.c~0 2005-02-24 15:51:34.000000000 +0200
+++ gdb/top.c 2005-05-11 19:10:20.000000000 +0300
@@ -71,10 +71,18 @@
/* Initialization file name for gdb. This is overridden in some configs. */
+#ifndef PATH_MAX
+# ifdef FILENAME_MAX
+# define PATH_MAX FILENAME_MAX
+# else
+# define PATH_MAX 512
+# endif
+#endif
+
#ifndef GDBINIT_FILENAME
#define GDBINIT_FILENAME ".gdbinit"
#endif
-char gdbinit[] = GDBINIT_FILENAME;
+char gdbinit[PATH_MAX];
int inhibit_gdbinit = 0;
@@ -1521,6 +1529,11 @@ gdb_init (char *argv0)
if (pre_init_ui_hook)
pre_init_ui_hook ();
+ /* Set up the default name of the init file. Specific configs can
+ override this in some _init_FOO function on one of their source
+ files. */
+ strcpy (gdbinit, GDBINIT_FILENAME);
+
/* Run the init function of each source file */
getcwd (gdb_dirbuf, sizeof (gdb_dirbuf));
--- gdb/cli/cli-cmds.c~0 2005-04-28 23:32:40.000000000 +0300
+++ gdb/cli/cli-cmds.c 2005-05-11 19:21:58.000000000 +0300
@@ -50,10 +50,6 @@
#include "tui/tui.h" /* For tui_active et.al. */
#endif
-#ifndef GDBINIT_FILENAME
-#define GDBINIT_FILENAME ".gdbinit"
-#endif
-
/* Prototypes for local command functions */
static void complete_command (char *, int);
@@ -1100,6 +1096,8 @@ void
init_cli_cmds (void)
{
struct cmd_list_element *c;
+ char *source_help_text;
+ extern char gdbinit[];
/* Define the classes of commands.
They will appear in the help list in the reverse of this order. */
@@ -1164,10 +1162,12 @@ End with a line of just \"end\".\n\
Use the \"document\" command to give documentation for the new command.\n\
Commands defined in this way may have up to ten arguments."));
- c = add_cmd ("source", class_support, source_command, _("\
+ source_help_text = xstrprintf (_("\
Read commands from a file named FILE.\n\
-Note that the file \"" GDBINIT_FILENAME "\" is read automatically in this way\n\
-when gdb is started."), &cmdlist);
+Note that the file \"%s\" is read automatically in this way\n\
+when gdb is started."), gdbinit);
+ c = add_cmd ("source", class_support, source_command,
+ source_help_text, &cmdlist);
set_cmd_completer (c, filename_completer);
add_com ("quit", class_support, quit_command, _("Exit gdb."));
--- gdb/go32-nat.c~0 2005-02-15 17:49:10.000000000 +0200
+++ gdb/go32-nat.c 2005-05-11 19:31:04.000000000 +0300
@@ -848,6 +848,8 @@ go32_terminal_ours (void)
static void
init_go32_ops (void)
{
+ extern char gdbinit[];
+
go32_ops.to_shortname = "djgpp";
go32_ops.to_longname = "djgpp target process";
go32_ops.to_doc =
@@ -894,6 +896,9 @@ init_go32_ops (void)
/* We are always processing GCC-compiled programs. */
processing_gcc_compilation = 2;
+
+ /* Override the default name of the GDB init file. */
+ strcpy (gdbinit, "gdb.ini");
}
unsigned short windows_major, windows_minor;