From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 36525 invoked by alias); 1 Feb 2016 19:51:49 -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 36512 invoked by uid 89); 1 Feb 2016 19:51:48 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=psymtab, hesitant, fc, f.c X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 01 Feb 2016 19:51:47 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id 7C3075275B; Mon, 1 Feb 2016 19:51:46 +0000 (UTC) Received: from valrhona.uglyboxes.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u11Jpi9s031703 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 1 Feb 2016 14:51:45 -0500 Subject: Re: RFC: branching for GDB 7.11 soon? (possibly Wed) To: Joel Brobecker , gdb-patches@sourceware.org, sergiodj@redhat.com, Yao Qi , Pedro Alves References: <20160201030638.GG4008@adacore.com> From: Keith Seitz X-Enigmail-Draft-Status: N1110 Message-ID: <56AFB750.3030702@redhat.com> Date: Mon, 01 Feb 2016 19:51:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <20160201030638.GG4008@adacore.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2016-02/txt/msg00019.txt.bz2 On 01/31/2016 07:06 PM, Joel Brobecker wrote: > > PR19474 "break LINE_NUM" set breakpoint on file other than current source file > (suggest Keith?) > At the moment, I would be hesitant to branch before we first > analyze what would be required to fix PR19474 ("break LINE_NUM"). > But if we're confident that it can be fairly safely fixed on > the branch, I don't see any other issue blocking for branching, > which I would then propose to be doing sometime early Wed. I started looking at this last week, and I have an analysis of the problems. It all basically boils down to: we cannot (reliably) win in this situation. Reminder of the situation from the bug: We have the two symtabs /home/keiths/tmp/f.c and /home/keiths/tmp/foo/f.c. This later symtab exists on the disk, though, as /home/keiths/tmp/bar/f.c. In create_sals_line_offset, we get the current source symtab and then search for all symtabs matching that name. This is required because we may have multiple symtabs for the same source file. [See expand-psymtabs.exp for an example.] When we go looking for the psymtab, we call psymtab_to_fullname, which uses find_and_open_source to search the source path, which includes /home/keiths/tmp/foo (the CDIR) and CWD. This last bit is the problem. If the user's CWD is /home/keiths/tmp, openp will return that /home/keiths/tmp/f.c is a match for the requested symtab filename, /home/keiths/tmp/foo/f.c. This is clearly incorrect. The two source files are /not/ the same, but find_and_open_source returns that it found the foo/f.c symtab even when it didn't. [When sal conversion is complete, gdb will look up the symtab name by PC, it then finds the "correct" symtab for reporting during "info break."] So, yes, this bug can be worked around by NOT having your CWD set to /home/keiths/tmp. A simple "cd .." will "fix" things. Ouch! Aside: It seems to me that instead of doing basename searches and using CWD, this whole thing should really do/support directory mappings, e.g., the user can say, "whenever you see /home/keiths/tmp/foo, look instead in /home/keiths/tmp/bar." But I don't think that really addresses the problem at hand. The only solution I've come up with is changing the whole API so that in this specific case (searching for a known symtab), we reject searching the source path. As you can imagine, that could open up an entirely new "can of worms." [And that change would be quite intrusive.] Like Yao, I'm not entirely sure what to do here yet. Keith