]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit - gdb/testsuite/ChangeLog
Fix advance/until and multiple locations (PR gdb/26524)
authorPedro Alves <pedro@palves.net>
Thu, 27 Aug 2020 20:03:53 +0000 (21:03 +0100)
committerPedro Alves <pedro@palves.net>
Thu, 27 Aug 2020 20:03:53 +0000 (21:03 +0100)
commitdf63178325a5705a609bff94a349162bbb839895
treedf44a2706a8aa07bc3523f6c2948576905387e87
parentb2b38aa45ba2eb2e7e4c70689d679c4c467eda73
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.
gdb/ChangeLog
gdb/breakpoint.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/advance-until-multiple-locations.cc [new file with mode: 0644]
gdb/testsuite/gdb.base/advance-until-multiple-locations.exp [new file with mode: 0644]