public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/26524] New: advance/until and multiple locations
@ 2020-08-22 20:14 palves at redhat dot com
  2020-08-27  2:02 ` [Bug gdb/26524] " simark at simark dot ca
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: palves at redhat dot com @ 2020-08-22 20:14 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26524

            Bug ID: 26524
           Summary: advance/until and multiple locations
           Product: gdb
           Version: unknown
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: palves at redhat dot com
  Target Milestone: ---

If you do "advance LINESPEC", and LINESPEC expands to more than one
location, GDB just errors out:

   if (sals.size () != 1)
     error (_("Couldn't get information on specified line."));

For example, advancing to a line in an inlined function, inlined three times:

 (gdb) b 21
 Breakpoint 1 at 0x55555555516f: advance.cc:21. (3 locations)
 (gdb) info breakpoints
 Num     Type           Disp Enb Address            What
 1       breakpoint     keep y   <MULTIPLE>
 1.1                         y   0x000055555555516f in inline_func at
advance.cc:21
 1.2                         y   0x000055555555517e in inline_func at
advance.cc:21
 1.3                         y   0x000055555555518d in inline_func at
advance.cc:21
 (gdb) advance 21
 Couldn't get information on specified line.
 (gdb)

Since, as the comment in gdb.base/advance.exp says, "advance <location>"
is really just syntactic sugar for "tbreak <location>;continue",
GDB should not assume <location> expands to a single sal, and should instead
insert a breakpoint at all the resolved locations.

Same issue with the "until" command, as it shares the implementation with
"advance".

Another case where you can end up with multiple sals is if you set a breakpoint
at an overloaded C++ function.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug gdb/26524] advance/until and multiple locations
  2020-08-22 20:14 [Bug gdb/26524] New: advance/until and multiple locations palves at redhat dot com
@ 2020-08-27  2:02 ` simark at simark dot ca
  2020-08-27 20:04 ` cvs-commit at gcc dot gnu.org
  2020-08-27 21:49 ` palves at redhat dot com
  2 siblings, 0 replies; 4+ messages in thread
From: simark at simark dot ca @ 2020-08-27  2:02 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26524

Simon Marchi <simark at simark dot ca> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |simark at simark dot ca

--- Comment #1 from Simon Marchi <simark at simark dot ca> ---
Proposed patches:
https://sourceware.org/pipermail/gdb-patches/2020-August/171427.html

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug gdb/26524] advance/until and multiple locations
  2020-08-22 20:14 [Bug gdb/26524] New: advance/until and multiple locations palves at redhat dot com
  2020-08-27  2:02 ` [Bug gdb/26524] " simark at simark dot ca
@ 2020-08-27 20:04 ` cvs-commit at gcc dot gnu.org
  2020-08-27 21:49 ` palves at redhat dot com
  2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-08-27 20:04 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26524

--- Comment #2 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Pedro Alves <palves@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=df63178325a5705a609bff94a349162bbb839895

commit df63178325a5705a609bff94a349162bbb839895
Author: Pedro Alves <pedro@palves.net>
Date:   Thu Aug 27 21:03:53 2020 +0100

    Fix advance/until and multiple locations (PR gdb/26524)

    If you do "advance LINESPEC", and LINESPEC expands to more than one
    location, GDB just errors out:

       if (sals.size () != 1)
         error (_("Couldn't get information on specified line."));

    For example, advancing to a line in an inlined function, inlined three
    times:

     (gdb) b 21
     Breakpoint 1 at 0x55555555516f: advance.cc:21. (3 locations)
     (gdb) info breakpoints
     Num     Type           Disp Enb Address            What
     1       breakpoint     keep y   <MULTIPLE>
     1.1                         y   0x000055555555516f in inline_func at
advance.cc:21
     1.2                         y   0x000055555555517e in inline_func at
advance.cc:21
     1.3                         y   0x000055555555518d in inline_func at
advance.cc:21
     (gdb) advance 21
     Couldn't get information on specified line.
     (gdb)

    Similar issue with the "until" command, as it shares the
    implementation with "advance".

    Since, as the comment in gdb.base/advance.exp says, "advance <location>"
    is really just syntactic sugar for "tbreak <location>;continue",
    fix this by making GDB insert a breakpoint at all the resolved
    locations.

    A new testcase is included, which exercises both "advance" and
    "until", in two different cases expanding to multiple locations:

      - inlined functions
      - C++ overloads

    This also exercises the inline frames issue fixed by the previous
    patch.

    gdb/ChangeLog:

            PR gdb/26524
            * breakpoint.c (until_break_fsm) <location_breakpoint,
            caller_breakpoint>: Delete fields.
            <breakpoints>: New field.
            <until_break_fsm>: Adjust to save a breakpoint vector instead of
            two individual breakpoints.
            (until_break_fsm::should_stop): Loop over breakpoints in the
            breakpoint vector.
            (until_break_fsm::clean_up): Adjust to clear the breakpoints
            vector.
            (until_break_command): Handle location expanding into multiple
            sals.

    gdb/testsuite/ChangeLog:

            PR gdb/26523
            PR gdb/26524
            * gdb.base/advance-until-multiple-locations.cc: New.
            * gdb.base/advance-until-multiple-locations.exp: New.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug gdb/26524] advance/until and multiple locations
  2020-08-22 20:14 [Bug gdb/26524] New: advance/until and multiple locations palves at redhat dot com
  2020-08-27  2:02 ` [Bug gdb/26524] " simark at simark dot ca
  2020-08-27 20:04 ` cvs-commit at gcc dot gnu.org
@ 2020-08-27 21:49 ` palves at redhat dot com
  2 siblings, 0 replies; 4+ messages in thread
From: palves at redhat dot com @ 2020-08-27 21:49 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26524

Pedro Alves <palves at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #3 from Pedro Alves <palves at redhat dot com> ---
Fix merged.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-08-27 21:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-22 20:14 [Bug gdb/26524] New: advance/until and multiple locations palves at redhat dot com
2020-08-27  2:02 ` [Bug gdb/26524] " simark at simark dot ca
2020-08-27 20:04 ` cvs-commit at gcc dot gnu.org
2020-08-27 21:49 ` palves at redhat dot com

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).