From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Received: (qmail 18798 invoked from network); 9 Jan 2003 18:50:19 -0000 Received: from unknown (HELO hub.ott.qnx.com) (209.226.137.76) by 209.249.29.67 with SMTP; 9 Jan 2003 18:50:19 -0000 Received: from smtp.ott.qnx.com (smtp.ott.qnx.com [10.0.2.158]) by hub.ott.qnx.com (8.9.3/8.9.3) with ESMTP id NAA07799 for ; Thu, 9 Jan 2003 13:41:57 -0500 Received: from catdog ([10.4.2.2]) by smtp.ott.qnx.com (8.8.8/8.6.12) with SMTP id NAA14781 for ; Thu, 9 Jan 2003 13:50:03 -0500 Message-ID: <09fc01c2b80f$e035fd10$0202040a@catdog> From: "Kris Warkentin" To: References: <013201c2b297$566460e0$0202040a@catdog> <1030108231501.ZM637@localhost.localdomain> <002801c2b7e3$86df1020$2a00a8c0@dash> <20030109182114.GA3648@redhat.com> Subject: Re: how to access show/set data Date: Thu, 09 Jan 2003 18:50:00 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-SW-Source: 2003-01/txt/msg00143.txt.bz2 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" To: 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 >