From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31113 invoked by alias); 11 Jan 2012 17:48:56 -0000 Received: (qmail 31105 invoked by uid 22791); 11 Jan 2012 17:48:55 -0000 X-SWARE-Spam-Status: No, hits=-3.2 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_LOW,TW_SM,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail-vx0-f169.google.com (HELO mail-vx0-f169.google.com) (209.85.220.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 11 Jan 2012 17:48:41 +0000 Received: by vcge1 with SMTP id e1so828153vcg.0 for ; Wed, 11 Jan 2012 09:48:41 -0800 (PST) Received: by 10.221.13.135 with SMTP id pm7mr69696vcb.51.1326304121171; Wed, 11 Jan 2012 09:48:41 -0800 (PST) MIME-Version: 1.0 Received: by 10.221.13.135 with SMTP id pm7mr69688vcb.51.1326304121087; Wed, 11 Jan 2012 09:48:41 -0800 (PST) Received: by 10.220.229.1 with HTTP; Wed, 11 Jan 2012 09:48:41 -0800 (PST) In-Reply-To: <4F0CD948.8080909@gmail.com> References: <83hb03e9sx.fsf@gnu.org> <838vlfe0k9.fsf@gnu.org> <4F0CD948.8080909@gmail.com> Date: Wed, 11 Jan 2012 17:54:00 -0000 Message-ID: Subject: Re: Building GDB 7.3.92 with MinGW From: Doug Evans To: asmwarrior Cc: gdb-patches@sourceware.org X-System-Of-Record: true Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-01/txt/msg00358.txt.bz2 On Tue, Jan 10, 2012 at 4:35 PM, asmwarrior wrote: > On 2012-1-11 5:23, Doug Evans wrote: >> >> For one, remembering to pass -data-directory is a pain. > > > This parameter does not work correctly under MinGW in the case that I wou= ld > like gdb to automatically run the python script when it startup. When you say "run the python script", *which* python script are you referring to? > Normally, my gdb is put in MinGW/bin, and the gdb's own python script is > under: > MinGW\share\gdb\python\gdb\*.py > > I need to hard-code the code in gdb/main.c to set the data-directory valu= e. > (Because gdb is build from MSYS+MinGW, but it run normally on Windows she= ll > without MSYS) > > Here are some hard-code modify to the main.c file, if you do not change > this, there is no way to load gdb's own python scripts. > > diff --git a/gdb/main.c b/gdb/main.c > index 8b45c25..46b11a8 100644 > --- a/gdb/main.c > +++ b/gdb/main.c > @@ -42,6 +42,10 @@ > =A0#include "python/python.h" > =A0#include "objfiles.h" > =A0+#ifdef _WIN32 > +extern int get_app_fullpath(char *location, int length); > +#endif > + > =A0/* The selected interpreter. =A0This will be used as a set command > =A0 =A0variable, so it should always be malloc'ed - since > =A0 =A0do_setshow_command will free it. =A0*/ > @@ -355,8 +359,27 @@ captured_main (void *data) > =A0 debug_file_directory =3D relocate_gdb_directory (DEBUGDIR, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 DEBUGDIR_RELOCATABLE); > =A0+ > +#ifdef _WIN32 > + =A0{ > + =A0 =A0char location[500]; > + =A0 =A0int len=3D get_app_fullpath(location, sizeof (location)); > + =A0 =A0if (len =3D=3D 0 || len > 500 - 1) > + =A0 =A0 =A0gdb_datadir =3D relocate_gdb_directory > (GDB_DATADIR,GDB_DATADIR_RELOCATABLE); > + =A0 =A0else > + =A0 =A0{ > + =A0 =A0 =A0 =A0char *p_slash =3Dstrrchr(location,'\\'); > + =A0 =A0 =A0 =A0*p_slash =3D '\000'; > + =A0 =A0 =A0 =A0p_slash =3Dstrrchr(location,'\\'); /* remove the bin fol= der*/ > + =A0 =A0 =A0 =A0*p_slash =3D '\000'; > + =A0 =A0 =A0 =A0strcat(location,"\\share\\gdb"); > + =A0 =A0 =A0 =A0gdb_datadir =3D xstrdup (location); > + =A0 =A0} > + =A0} > +#else > =A0 gdb_datadir =3D relocate_gdb_directory (GDB_DATADIR, > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 GDB_DATADIR_RELOCATABLE); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 GDB_DATADIR_RELOCATABLE); > +#endif > =A0#ifdef WITH_PYTHON_PATH > =A0 { > > If I remember correctly, I have post it some months ago. *If* there is a bug here, and it's not pilot error, it feels like perhaps the bug is in relocate_gdb_directory. [Why don't all calls to relocate_gdb_directory require similar treatment? Thus this feels like the wrong way to go.] Maybe if you provide a sample session (and complete session please, no editing to trim it down), that will help.