From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 111772 invoked by alias); 19 Dec 2017 09:24:38 -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 102091 invoked by uid 89); 19 Dec 2017 09:24:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=risk, our X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 19 Dec 2017 09:24:13 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 22F33117034; Tue, 19 Dec 2017 04:24:10 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 3ZELLWNY6CqT; Tue, 19 Dec 2017 04:24:10 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id AA61D116E35; Tue, 19 Dec 2017 04:24:09 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id 653D6809B4; Tue, 19 Dec 2017 13:24:05 +0400 (+04) Date: Tue, 19 Dec 2017 09:24:00 -0000 From: Joel Brobecker To: Simon Marchi Cc: gdb-patches@sourceware.org, Keith Seitz , Xavier Roirand Subject: Re: [RFA/linespec] wrong line number in breakpoint location Message-ID: <20171219092405.n2dql5ji52qhjilj@adacore.com> References: <1513565091-118926-1-git-send-email-brobecker@adacore.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) X-SW-Source: 2017-12/txt/msg00415.txt.bz2 > That change sounds good to me, but I'd suggest waiting to see if other > people have something to say. Thanks, and of course! > I noted two nits. > > 1. We resolve the small.c:8 linespec into a symtab_and_line which > > small.c:18 Fixed. > > +/* We implement the following function as far away from the first line > > + of this file, so as to reduce confusion between line numbers from > > + this file, and line numbers from body.inc (which only really has > > body.inc is now called break-include.inc. I am a bit confused with "as far > away from the first line of this file". From what I understand, the > important thing is that the next function is at a different line than the > assignment in break-include.inc, to avoid the risk of having a false PASS? That's correct. Attached is a second version of the patch which hopefully clarifies everything: /* The following function's implementation starts by including a file (break-include.inc) which contains a copyright header followed by a single C statement. When we break on the line where the function name is declared, we expect GDB to skip the function's prologue, and insert the breakpoint on the first line of "user" code for that function, which we have set up to be that single statement break-include.inc provides. The purpose of this testcase is to verify that, when we insert that breakpoint, GDB reports the location as being in that include file, but also using the correct line number inside that include file -- NOT the line number we originally used to insert the breakpoint, nor the location where the file is included from. In order to verify that GDB shows the right line number, we must be careful that this first statement located in break-include.inc and our function are not on the same line number. Otherwise, we could potentially have a false PASS. This is why we implement the following function as far away from the start of this file as possible, as we know that break-include.inc is a fairly short file (copyright header and single statement only). */ gdb/ChangeLog: * linespec.c (create_sals_line_offset): Remove code that preserved the symtab_and_line's line number. gdb/testsuite/ChangeLog: * break-include.c, break-include.inc, break-include.exp: New files. * gdb.base/ending-run.exp: Minor adaptations due to the breakpoint's line number now being the actual line number where the breakpoint was inserted. * gdb.mi/mi-break.exp: Likewise. * gdb.mi/mi-reverse.exp: Likewise. * gdb.mi/mi-simplerun.exp: Ditto. Tested on x86_64-linux. Thanks, -- Joel