From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26039 invoked by alias); 31 Mar 2010 06:09:20 -0000 Received: (qmail 26027 invoked by uid 22791); 31 Mar 2010 06:09:19 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=BAYES_00,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, 31 Mar 2010 06:09:15 +0000 Received: (qmail 19042 invoked from network); 31 Mar 2010 06:09:13 -0000 Received: from unknown (HELO ?117.131.21.199?) (jie@127.0.0.2) by mail.codesourcery.com with ESMTPA; 31 Mar 2010 06:09:13 -0000 Message-ID: <4BB2E6F7.4020401@codesourcery.com> Date: Wed, 31 Mar 2010 06:09:00 -0000 From: Jie Zhang User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100317 Thunderbird/3.0.4 MIME-Version: 1.0 To: tromey@redhat.com CC: gdb-patches@sourceware.org Subject: Re: [RFC] Fix a bug in source file searching References: <4BB01CC6.3090402@codesourcery.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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: 2010-03/txt/msg01107.txt.bz2 On 03/31/2010 06:14 AM, Tom Tromey wrote: >>>>>> "Jie" == Jie Zhang writes: > > Jie> I found this bug when debugging GCC. (Actually I don't know if this is > Jie> a bug in GDB code or documentation.) I prepared a patch so you can > Jie> easily comment. > > Thanks. > > Jie> And .gdbinit file in GCC build directory has > Jie> dir ../../../svn/trunk/gcc/fortran > Jie> So it looked GDB searched pathes added by dir command first. > > Jie> But the GDB documentation says in "9.5 Specifying Source Directories": > Jie> [quote] > Jie> For example, suppose an executable references the file > Jie> /usr/src/foo-1.0/lib/foo.c, and our source path is /mnt/cross. The > Jie> file is first looked up literally; if this fails, > Jie> /mnt/cross/usr/src/foo-1.0/lib/foo.c is tried; if this fails, > Jie> /mnt/cross/foo.c is opened; if this fails, an error message is > Jie> printed. > Jie> [/quote] > > Maybe the documentation is just wrong or misleading here. I say that > because the special entry `$cdir' expands to the compilation directory, > and you can control where this appears pretty easily. > Maybe I misunderstood the document. I thought comp_dir = /usr/src/foo-1.0 filename = lib/foo.c should be same as comp_dir = filename = /usr/src/foo-1.0/lib/foo.c Obviously GDB treats them differently although I don't know why. And I don't know why GCC adds those dir commands in its .gdbinit. I will ask on GCC mailing list. -- Jie Zhang CodeSourcery (650) 331-3385 x735