This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [RFA] Get rid of xm-go32.h (was: [COMMIT] Get rid of xm-cygwin.h)
Date: Thu, 12 May 2005 11:55:30 +0300
From: "Eli Zaretskii" <eliz@gnu.org>
> 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.
Thanks!
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?
I'd happily see tm-cisco.h and tm-os68k.h removed. But if there are
reasons to keep them, or if you don't feel like doing the legwork
needed to remove the associated targets completely, just remove the
definition of GDBINIT_FILENAME from those files.
--- 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
Please remove XM_FILE completely.
--- 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
I think the proper constant to use here is NAME_MAX, which is the
POSIX standard for the "Maximum number of bytes in a filename (not
including terminating null)". Hmm, so the code should actually use
`NAME_MAX + 1' for the array size.
#ifndef GDBINIT_FILENAME
#define GDBINIT_FILENAME ".gdbinit"
#endif
-char gdbinit[] = GDBINIT_FILENAME;
+char gdbinit[PATH_MAX];
Why not simply write:
char gdbinit[NAME_MAX + 1] = ".gdbinit";
That way we don't need the strcpy in gdb_init().
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[];
Please don't add new 'externs'. Include "top.h" instead.
Mark