From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17420 invoked by alias); 22 Sep 2012 15:50:56 -0000 Received: (qmail 17412 invoked by uid 22791); 22 Sep 2012 15:50:54 -0000 X-SWARE-Spam-Status: No, hits=-3.4 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from server-nat-6.cs.umd.edu (HELO bacon.cs.umd.edu) (128.8.127.149) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 22 Sep 2012 15:50:42 +0000 Received: from [192.168.2.10] (pool-72-83-72-24.washdc.east.verizon.net [72.83.72.24]) (Authenticated sender: khooyp) by bacon.cs.umd.edu (Postfix) with ESMTPSA id DAD22B409DC; Sat, 22 Sep 2012 11:50:39 -0400 (EDT) Subject: Re: [PATCH 2/2] Try to initialize data-directory by first searching for "data-directory" in the same directory as the gdb binary Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Khoo Yit Phang In-Reply-To: <20120922110822.GA28159@host2.jankratochvil.net> Date: Sat, 22 Sep 2012 15:50:00 -0000 Cc: Khoo Yit Phang , GDB Patches Content-Transfer-Encoding: quoted-printable Message-Id: <78B3333C-92F9-474D-8352-087C5A0F575B@cs.umd.edu> References: <21ACC598-F6B4-4117-BA7B-B316414DE9E3@cs.umd.edu> <20120919130040.GA20442@host2.jankratochvil.net> <20120921183122.GB8747@host2.jankratochvil.net> <20120922110822.GA28159@host2.jankratochvil.net> To: Jan Kratochvil X-CSD-MailScanner-ID: DAD22B409DC.A1A92 X-CSD-MailScanner: Found to be clean X-CSD-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-50, required 5, autolearn=not spam, ALL_TRUSTED -50.00) X-CSD-MailScanner-From: khooyp@cs.umd.edu X-CSD-MailScanner-Watermark: 1348933840.32056@w+IJrDttZ8r2g/954A+hJw 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-09/txt/msg00471.txt.bz2 Hi Jan, On Sep 22, 2012, at 7:08 AM, Jan Kratochvil wrote: > On Fri, 21 Sep 2012 21:05:36 +0200, Khoo Yit Phang wrote: >> On Sep 21, 2012, at 2:31 PM, Jan Kratochvil wrote: >>> Also it could check for /usr/gdb/data-directory which is less likely to= be >>> present than /usr/bin/data-directory . >>=20 >> That does not happen, since the first part of relocate_gdb_data_director= y finds BINDIR/data-directory by finding the directory containing the gdb b= inary, then appending "data-directory" to it. But in your patch: >>=20 >>> + build directory. */ >>> + datadir =3D ldirname (BINDIR); >>> + datadir =3D reconcat (datadir, datadir, >>> + SLASH_STRING "gdb" SLASH_STRING "data-directory", NULL); >>> + dir =3D relocate_path (gdb_program_name, datadir, 1, 1); >>=20 >> Doesn't this have a possibility of finding /usr/gdb/data-directory? >=20 > Your patch may find /usr/bin/data-directory, my patch may find > /usr/gdb/data-directory, I find the latter as a less possibly existing my > mistake. But maybe it does not matter much. Personally, I'm not fond of either my patch or yours, since they hard code = parts of the build directory into the binary (whether "data-directory" or "= gdb/data-directory"). In either case, they can lead to weird, difficult-to-= understand behavior (possibly even dangerous) in the off chance that one th= ose directory exist. I'd rather leave it out. Yit September 22, 2012