public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: Simon Marchi <simon.marchi@polymtl.ca>
Cc: gdb-patches@sourceware.org, Keith Seitz <keiths@redhat.com>,
	Xavier Roirand <roirand@adacore.com>
Subject: Re: [RFA/linespec] wrong line number in breakpoint location
Date: Tue, 19 Dec 2017 09:24:00 -0000	[thread overview]
Message-ID: <20171219092405.n2dql5ji52qhjilj@adacore.com> (raw)
In-Reply-To: <a02f608153c9050c0275ae058ffd60b9@polymtl.ca>

> 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

  reply	other threads:[~2017-12-19  9:24 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-18  2:44 Joel Brobecker
2017-12-18  4:09 ` Simon Marchi
2017-12-19  9:24   ` Joel Brobecker [this message]
2017-12-21  1:31     ` Simon Marchi
2017-12-21 11:31       ` Joel Brobecker
2017-12-21 11:32         ` Joel Brobecker
2018-01-22  4:17           ` pushed: " Joel Brobecker
2018-01-26 17:16           ` Simon Marchi
2018-01-29  4:45             ` Joel Brobecker
2018-01-29 17:01               ` Simon Marchi
2018-01-30  4:09                 ` Joel Brobecker
2018-01-30 12:39                   ` Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171219092405.n2dql5ji52qhjilj@adacore.com \
    --to=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=keiths@redhat.com \
    --cc=roirand@adacore.com \
    --cc=simon.marchi@polymtl.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).