From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5467 invoked by alias); 21 Sep 2012 19:05:59 -0000 Received: (qmail 5458 invoked by uid 22791); 21 Sep 2012 19:05:58 -0000 X-SWARE-Spam-Status: No, hits=-3.8 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; Fri, 21 Sep 2012 19:05:44 +0000 Received: from [10.109.174.174] (129-2-129-155.wireless.umd.edu [129.2.129.155]) (Authenticated sender: khooyp) by bacon.cs.umd.edu (Postfix) with ESMTPSA id 49A57B407AC; Fri, 21 Sep 2012 15:05:42 -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: <20120921183122.GB8747@host2.jankratochvil.net> Date: Fri, 21 Sep 2012 19:05:00 -0000 Cc: Khoo Yit Phang , GDB Patches Content-Transfer-Encoding: quoted-printable Message-Id: References: <21ACC598-F6B4-4117-BA7B-B316414DE9E3@cs.umd.edu> <20120919130040.GA20442@host2.jankratochvil.net> <20120921183122.GB8747@host2.jankratochvil.net> To: Jan Kratochvil X-CSD-MailScanner-ID: 49A57B407AC.AFFF5 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: 1348859142.40159@srZ/Iltp2zjYirJmiYfmyA 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/msg00452.txt.bz2 Hi, On Sep 21, 2012, at 2:31 PM, Jan Kratochvil wrote: > I am not happy from the code duplication with existing function: Yeah, it's not pretty, but I'm not sure how to eliminate the redundancy sin= ce if "data-directory" is found, it may have to be canonicalized as well. > Also it could check for /usr/gdb/data-directory which is less likely to be > present than /usr/bin/data-directory . That does not happen, since the first part of relocate_gdb_data_directory f= inds BINDIR/data-directory by finding the directory containing the gdb bina= ry, then appending "data-directory" to it. But in your patch: > + 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); Doesn't this have a possibility of finding /usr/gdb/data-directory? Yit September 21, 2012