From: "Kris Warkentin" <kewarken@qnx.com>
To: <gdb@sources.redhat.com>
Subject: patch to use target specific .gdbinit file
Date: Fri, 10 Jan 2003 17:11:00 -0000 [thread overview]
Message-ID: <0b9e01c2b8cb$4a81fd20$0202040a@catdog> (raw)
The following code will allow backend writers to define
EXTRA_GDBINIT_FILENAME to be an alternate filename for sourcing on startup.
For example, since we have gdb versions for 5 different CPU targets, we
allow users to create a $HOME/.ntoCPU-gdbinit. This is especially handy if
you're dealing with several remote targets that you want to be connected to
every time. A simple "source .gdbinit" at the end of .ntoCPU-gdbinit gives
a very nice way to have specific initializations followed by generic ones.
cheers,
Kris
Index: top.h
===================================================================
RCS file: /cvs/src/src/gdb/top.h,v
retrieving revision 1.7
diff -u -r1.7 top.h
--- top.h 19 Mar 2002 19:00:04 -0000 1.7
+++ top.h 10 Jan 2003 17:06:43 -0000
@@ -30,6 +30,7 @@
extern int inhibit_gdbinit;
extern int epoch_interface;
extern char gdbinit[];
+extern char *extragdbinit;
extern void print_gdb_version (struct ui_file *);
Index: top.c
===================================================================
RCS file: /cvs/src/src/gdb/top.c,v
retrieving revision 1.69
diff -u -r1.69 top.c
--- top.c 9 Dec 2002 00:59:26 -0000 1.69
+++ top.c 10 Jan 2003 17:06:43 -0000
@@ -77,6 +77,12 @@
#endif
char gdbinit[] = GDBINIT_FILENAME;
+#ifndef EXTRA_GDBINIT_FILENAME
+#define EXTRA_GDBINIT_FILENAME 0
+#endif
+
+char *extragdbinit = EXTRA_GDBINIT_FILENAME;
+
int inhibit_gdbinit = 0;
/* If nonzero, and GDB has been configured to be able to use windows,
Index: main.c
===================================================================
RCS file: /cvs/src/src/gdb/main.c,v
retrieving revision 1.20
diff -u -r1.20 main.c
--- main.c 26 Sep 2002 17:46:04 -0000 1.20
+++ main.c 10 Jan 2003 17:06:44 -0000
@@ -530,11 +530,30 @@
homedir = getenv ("HOME");
if (homedir)
{
- homeinit = (char *) alloca (strlen (homedir) +
- strlen (gdbinit) + 10);
- strcpy (homeinit, homedir);
- strcat (homeinit, "/");
- strcat (homeinit, gdbinit);
+ /* Allow for a target specific gdbinit that will only override
+ the default gdbinit if it exists. GP QNX Sep 6 2002 */
+ homeinit = 0;
+ if (extragdbinit)
+ {
+ homeinit = (char *) alloca (strlen (homedir) +
+ strlen (extragdbinit) + 10);
+
+ strcpy (homeinit, homedir);
+ strcat (homeinit, "/");
+ strcat (homeinit, extragdbinit);
+
+ if (stat (homeinit, &homebuf) < 0)
+ homeinit = 0;
+ }
+
+ if (!homeinit)
+ {
+ homeinit = (char *) alloca (strlen (homedir) +
+ strlen (gdbinit) + 10);
+ strcpy (homeinit, homedir);
+ strcat (homeinit, "/");
+ strcat (homeinit, gdbinit);
+ }
if (!inhibit_gdbinit)
{
next reply other threads:[~2003-01-10 17:11 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-01-10 17:11 Kris Warkentin [this message]
2003-01-10 22:44 ` Felix Lee
2003-01-13 16:12 ` Kris Warkentin
2003-01-13 18:53 ` Andrew Cagney
2003-01-13 19:01 ` Kris Warkentin
2003-01-13 19:38 ` Andrew Cagney
2003-01-13 21:07 ` Kris Warkentin
2003-01-13 21:42 ` Andrew Cagney
2003-01-13 22:17 ` Kris Warkentin
2003-01-13 22:30 ` Andrew Cagney
2003-01-14 19:11 ` Kris Warkentin
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='0b9e01c2b8cb$4a81fd20$0202040a@catdog' \
--to=kewarken@qnx.com \
--cc=gdb@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