From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16523 invoked by alias); 9 Mar 2011 12:58:43 -0000 Received: (qmail 16506 invoked by uid 22791); 9 Mar 2011 12:58:42 -0000 X-SWARE-Spam-Status: No, hits=-1.0 required=5.0 tests=AWL,BAYES_40,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 09 Mar 2011 12:58:38 +0000 Received: (qmail 27786 invoked from network); 9 Mar 2011 12:58:36 -0000 Received: from unknown (HELO scottsdale.localnet) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 9 Mar 2011 12:58:36 -0000 From: Pedro Alves To: Eli Zaretskii Subject: Re: [patch libiberty include]: Add additional helper functions for directory-separator searching Date: Wed, 09 Mar 2011 13:39:00 -0000 User-Agent: KMail/1.13.5 (Linux/2.6.35-27-generic; KDE/4.6.1; x86_64; ; ) Cc: gdb-patches@sourceware.org, dj@redhat.com, ktietz70@googlemail.com, binutils@sourceware.org, gcc-patches@gcc.gnu.org References: <201103091146.36746.pedro@codesourcery.com> <83pqq0pj4b.fsf@gnu.org> In-Reply-To: <83pqq0pj4b.fsf@gnu.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201103091258.38655.pedro@codesourcery.com> 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: 2011-03/txt/msg00594.txt.bz2 On Wednesday 09 March 2011 12:35:00, Eli Zaretskii wrote: > > I meant a valid use case in the code bases. > > Sorry for my misunderstanding. NP. > > > Might as well cook up a (gdb) patch. Find it pasted below. Does it > > look good to you? > > Yes, looks fine. Thanks. Thanks. I've applied it. > > The one's left are: 1 in a linux-native only file (never cares > > for other filesystem semantics), and a couple in the coff and > > mdebug readers. The latter could be rewritten in terms of > > lbasename, but I'm not sure whether gcc outputs a literal '/' in > > that case even when building on mingw. If so, and we changed them, > > we'd be breaking reading these files on Windows > > Sorry, I don't understand how would that break on Windows. Could you > elaborate? And what "couple of coff and mdebug readers" did you have > in mind? Sorry, in the hurry, I had a (another) brain cramp. Wouldn't break. Still it'd be useless to change this _if_ gcc hardcodes '/'. Dunno whether it does. >find . -name "*.c" | xargs grep strrchr | grep "'/'" ./linux-thread-db.c: cp = strrchr (path, '/'); ./mdebugread.c: p = strrchr (namestring, '/'); ./dbxread.c: p = strrchr (namestring, '/'); Both look like this: /* Some compilers (including gcc) emit a pair of initial N_SOs. The first one is a directory name; the second the file name. If pst exists, is empty, and has a filename ending in '/', we assume the previous N_SO was a directory name. */ p = strrchr (namestring, '/'); if (p && *(p + 1) == '\000') { /* Save the directory name SOs locally, then save it into the psymtab when it's created below. */ dirname_nso = namestring; continue; } -- Pedro Alves