From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 66852 invoked by alias); 13 Sep 2019 06:36:34 -0000 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 Received: (qmail 66844 invoked by uid 89); 13 Sep 2019 06:36:33 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-16.1 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.1 spammy=retry X-HELO: eggs.gnu.org Received: from eggs.gnu.org (HELO eggs.gnu.org) (209.51.188.92) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 13 Sep 2019 06:36:32 +0000 Received: from fencepost.gnu.org ([2001:470:142:3::e]:48409) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1i8fC1-0004PA-Cm; Fri, 13 Sep 2019 02:36:29 -0400 Received: from [176.228.60.248] (port=3028 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1i8fC0-0006T4-Jh; Fri, 13 Sep 2019 02:36:29 -0400 Date: Fri, 13 Sep 2019 06:36:00 -0000 Message-Id: <835zlw1z45.fsf@gnu.org> From: Eli Zaretskii To: Andrew Burgess CC: mgulick@mathworks.com, gdb-patches@sourceware.org In-reply-to: <20190913013851.GT6076@embecosm.com> (message from Andrew Burgess on Thu, 12 Sep 2019 21:38:51 -0400) Subject: Re: [RFC] Apply compilation dir to source_path lookup References: <8058b501-9020-84f1-ecf4-b46bfe3b86e3@mathworks.com> <20190907235059.GN6076@embecosm.com> <4d9f4c81-8580-2b42-a434-389ed7655d7f@mathworks.com> <20190913013851.GT6076@embecosm.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-IsSubscribed: yes X-SW-Source: 2019-09/txt/msg00234.txt.bz2 > Date: Thu, 12 Sep 2019 21:38:51 -0400 > From: Andrew Burgess > Cc: "gdb-patches@sourceware.org" , > Eli Zaretskii > > diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo > index 79824a0226a..b6b87b28b9f 100644 > --- a/gdb/doc/gdb.texinfo > +++ b/gdb/doc/gdb.texinfo > @@ -8968,9 +8968,23 @@ > Plain file names, relative file names with leading directories, file > names containing dots, etc.@: are all treated as described above; for > instance, if the source path is @file{/mnt/cross}, and the source file > -is recorded as @file{../lib/foo.c}, @value{GDBN} would first try > -@file{../lib/foo.c}, then @file{/mnt/cross/../lib/foo.c}, and after > -that---@file{/mnt/cross/foo.c}. > +is recorded as @file{../lib/foo.c} and no compilation directory is > +recorded, @value{GDBN} would first try @file{../lib/foo.c}, then > +@file{/mnt/cross/../lib/foo.c}, and after that > +@file{/mnt/cross/foo.c}. > + > +When there is both a filename and a compilation directory in the debug > +information, and if @value{GDBN} hasn't found the source file using > +the above approach, then @value{GDBN} will append the filename to the > +compilation directory and retry using the above steps; for instance, > +if the source path is @file{/mnt/cross}, and the source file is > +recorded as @file{../lib/foo.c} and the compilation directory is > +recorded as @file{/usr/src/foo-1.0/build}, @value{GDBN} would first > +try @file{../lib/foo.c}, then @file{/mnt/cross/../lib/foo.c}, then > +@file{/mnt/cross/foo.c}, using the approach outlined above. If the > +source file still hasn't been found then @value{GDBN} will next check > +@file{/usr/src/foo-1.0/build/../lib/foo.c}, then > +@file{/mnt/cross/usr/src/foo-1.0/build/../lib/foo.c}. This text is unnecessarily long and complicated. How about this shortened version -- does it correctly convey the intent? Plain file names, relative file names with leading directories, file names containing dots, etc.@: are all treated as described above; for instance, if the source path is @file{/mnt/cross}, and the source file is recorded as @file{../lib/foo.c}, @value{GDBN} would first try @file{../lib/foo.c}, then @file{/mnt/cross/../lib/foo.c}, and after that---@file{/mnt/cross/foo.c}. If the above search fails to find the source file @file{foo.c}, and the compilation directory is recorded in the debug information, @value{GDBN} will repeat the search using the compilation directory as if it were in the source path. > @value{GDBN} will also append the compilation > +directory to the filename and check this against all other entries in > +the source path. I think "append" here is a mistake. Should it be "prepend"? And anyway, doesn't this simply repeat what was described in the text above? Thanks.