Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: "Kris Warkentin" <kewarken@qnx.com>
To: <gdb@sources.redhat.com>
Subject: Re: how to access show/set data
Date: Thu, 09 Jan 2003 18:50:00 -0000	[thread overview]
Message-ID: <09fc01c2b80f$e035fd10$0202040a@catdog> (raw)
In-Reply-To: <20030109182114.GA3648@redhat.com>

Not quite that simple.  If I have to provide a .gdbinit file for EVERY user
in order for gdb to properly find our libs, how do I write an installer that
does the right thing?  Some users might use Cygwin, some might not.  $HOME
might be set, it might not.  If I'm installing to Solaris or Linux, which
user accounts do I install a .gdbinit in?  It's non-trivial, especially when
you ship tools where various cpu targets have their libs in
$QNX_TARGET/$CPU/lib, and so on.  We ship gdb targetting 5 different CPU's
(arm, mips, powerpc, sh, i386) on 4 different hosts (QNX, Solaris, Linux and
Windows) so having a routine that programmatically sets up some defaults for
where host and target files are is the only sensible way to go.

Either way, I found a nice clean way to do it so I'm happy.  By the way, one
my coworkers wrote a very small enhancement to the .gdbinit code that I
would like to submit.  Basically it allows a backend writer to define
EXTRA_GDBINIT_FILENAME to a string which will be pre-pended to .gdbinit for
initial sourcing.  ie. We define it to be .ntoCPU-gdbinit and then if, for
instance, our x86 targetting gdb finds $HOME/.ntox86-gdbinit, it reads it
instead.  This is really handy for us because most of our development is
targetting remote machines so this way you can automatically connect to the
cpu target when you start gdb.  All you need then is 'source .gdbinit' at
the end of your cpu specific one and you can have specific and generic
sections for your init code.

Sorry about the patch (I just diffed it from CVS so you could take a look).
If you're interested in accepting this, I'll patch your CVS head branch and
submit a diff against that.

cheers,

Kris

Index: main.c
===================================================================
RCS file: /product/tools/gdb/gdb/main.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -c -r1.2 -r1.3
*** main.c 6 Sep 2002 20:20:43 -0000 1.2
--- main.c 6 Sep 2002 21:23:46 -0000 1.3
***************
*** 524,534 ****
    homedir = getenv ("HOME");
    if (homedir)
      {
!       homeinit = (char *) alloca (strlen (homedir) +
!       strlen (gdbinit) + 10);
!       strcpy (homeinit, homedir);
!       strcat (homeinit, "/");
!       strcat (homeinit, gdbinit);

        if (!inhibit_gdbinit)
   {
--- 524,553 ----
    homedir = getenv ("HOME");
    if (homedir)
      {
!       /* 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)
   {
Index: top.h
===================================================================
RCS file: /product/tools/gdb/gdb/top.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -c -r1.2 -r1.3
*** top.h 6 Sep 2002 20:20:47 -0000 1.2
--- top.h 6 Sep 2002 21:23:46 -0000 1.3
***************
*** 30,35 ****
--- 30,36 ----
  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: /product/tools/gdb/gdb/top.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -c -r1.2 -r1.3
*** top.c 6 Sep 2002 20:20:47 -0000 1.2
--- top.c 6 Sep 2002 21:23:46 -0000 1.3
***************
*** 76,81 ****
--- 76,87 ----
  #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,

----- Original Message -----
From: "Christopher Faylor" <cgf@redhat.com>
To: <gdb@sources.redhat.com>
Sent: Thursday, January 09, 2003 1:21 PM
Subject: Re: how to access show/set data


> On Thu, Jan 09, 2003 at 08:32:15AM -0500, Kris Warkentin wrote:
> >Besides, where do you put your gdbinit on a windows host?  ;-)
>
> In your home directory, same as UNIX.
>
> cgf
>


  reply	other threads:[~2003-01-09 18:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-02 19:44 Kris Warkentin
2003-01-02 20:59 ` Kris Warkentin
2003-01-04  2:19   ` GDB 5.2/5.3 breakpoint bug Sunil Alankar
2003-01-04  2:23     ` Daniel Jacobowitz
2003-01-08 23:16 ` how to access show/set data Kevin Buettner
2003-01-09 13:31   ` Kris Warkentin
2003-01-09 18:20     ` Christopher Faylor
2003-01-09 18:50       ` Kris Warkentin [this message]
2003-01-09 18:52         ` 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='09fc01c2b80f$e035fd10$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