From: Eli Zaretskii Date: Thu, 12 May 2005 21:23:17 +0000 (+0000) Subject: * Makefile.in (go32-nat.o): Add $(top_h) to prerequisites. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=eaae39195e3ebc6d1bd7d9d5750552184c32dc1f;p=binutils-gdb.git * Makefile.in (go32-nat.o): Add $(top_h) to prerequisites. * go32-nat.c: Include top.h. Update copyright years. (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. * config/i386/go32.mh (XM_FILE): Remove. * config/i386/xm-go32.h: Remove file. --- diff --git a/gdb/Makefile.in b/gdb/Makefile.in index a971bff698d..4241ffd2142 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -1993,7 +1993,7 @@ gnu-v3-abi.o: gnu-v3-abi.c $(defs_h) $(value_h) $(cp_abi_h) $(cp_support_h) \ go32-nat.o: go32-nat.c $(defs_h) $(inferior_h) $(gdb_wait_h) $(gdbcore_h) \ $(command_h) $(gdbcmd_h) $(floatformat_h) $(buildsym_h) \ $(i387_tdep_h) $(i386_tdep_h) $(value_h) $(regcache_h) \ - $(gdb_string_h) + $(gdb_string_h) $(top_h) h8300-tdep.o: h8300-tdep.c $(defs_h) $(value_h) $(arch_utils_h) $(regcache_h) \ $(gdbcore_h) $(objfiles_h) $(gdb_assert_h) $(dis_asm_h) \ $(dwarf2_frame_h) $(frame_base_h) $(frame_unwind_h) diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index 3d25f1ac986..af110961db9 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -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,7 @@ void init_cli_cmds (void) { struct cmd_list_element *c; + char *source_help_text; /* Define the classes of commands. They will appear in the help list in the reverse of this order. */ @@ -1164,10 +1161,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.")); diff --git a/gdb/config/i386/xm-go32.h b/gdb/config/i386/xm-go32.h deleted file mode 100644 index 168c5d75e2b..00000000000 --- a/gdb/config/i386/xm-go32.h +++ /dev/null @@ -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" diff --git a/gdb/go32-nat.c b/gdb/go32-nat.c index 9758129cd7e..0556f578b62 100644 --- a/gdb/go32-nat.c +++ b/gdb/go32-nat.c @@ -1,5 +1,5 @@ /* Native debugging support for Intel x86 running DJGPP. - Copyright 1997, 1999, 2000, 2001 Free Software Foundation, Inc. + Copyright 1997, 1999, 2000, 2001, 2005 Free Software Foundation, Inc. Written by Robert Hoehne. This file is part of GDB. @@ -34,6 +34,7 @@ #include "value.h" #include "regcache.h" #include "gdb_string.h" +#include "top.h" #include /* might be required for __DJGPP_MINOR__ */ #include @@ -894,6 +895,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; diff --git a/gdb/top.c b/gdb/top.c index b56a3cfb026..1bd22e3706d 100644 --- a/gdb/top.c +++ b/gdb/top.c @@ -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 + 1] = GDBINIT_FILENAME; int inhibit_gdbinit = 0;