public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/26523] New: advance/until to inline frames
@ 2020-08-22 20:10 palves at redhat dot com
2020-08-27 20:04 ` [Bug gdb/26523] " cvs-commit at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: palves at redhat dot com @ 2020-08-22 20:10 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=26523
Bug ID: 26523
Summary: advance/until to inline frames
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 "tbreak LINENO; c" to advance to an inlined function, GDB
presents the stop at the inline frame instead of at the non-artificial
stack frame:
(gdb) list 21
18 static inline __attribute__ ((always_inline)) int
19 inline_func (int i)
20 {
21 return i + 1;
22 }
(gdb) tbreak 21
Temporary breakpoint 3 at 0x55555555516f: advance.cc:21.
(gdb) c
Continuing.
Temporary breakpoint 3, inline_func (i=0) at advance.cc:21
21 return i + 1; /* multiple locations here */
If however, you do "advance LINENO" or "until LINENO" instead, GDB
presents the stop at the non-artificial frame:
(gdb) advance 21
main () at advance.cc:43
43 i = inline_func (i);
(gdb)
"advance" and "until" should really behave like user breakpoints here, since
their location is also user-specified.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug gdb/26523] advance/until to inline frames
2020-08-22 20:10 [Bug gdb/26523] New: advance/until to inline frames palves at redhat dot com
@ 2020-08-27 20:04 ` cvs-commit at gcc dot gnu.org
2020-08-27 20:04 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ 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=26523
--- Comment #1 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=b2b38aa45ba2eb2e7e4c70689d679c4c467eda73
commit b2b38aa45ba2eb2e7e4c70689d679c4c467eda73
Author: Pedro Alves <pedro@palves.net>
Date: Thu Aug 27 21:03:53 2020 +0100
Fix advance/until and inline frames (PR gdb/26523)
If you do "tbreak LINENO; c" to advance to an inlined function, GDB
presents the stop at the inline frame instead of at the non-artificial
stack frame:
(gdb) list 21
18 static inline __attribute__ ((always_inline)) int
19 inline_func (int i)
20 {
21 return i + 1;
22 }
(gdb) tbreak 21
Temporary breakpoint 3 at 0x55555555516f: advance.cc:21.
(gdb) c
Continuing.
Temporary breakpoint 3, inline_func (i=0) at advance.cc:21
21 return i + 1;
The logic for this is in stopped_by_user_bp_inline_frame:
/* Loop over the stop chain and determine if execution stopped in an
inlined frame because of a breakpoint with a user-specified
location set at FRAME_BLOCK. */
static bool
stopped_by_user_bp_inline_frame (const block *frame_block, bpstat
stop_chain)
If however, you do "advance LINENO" or "until LINENO" instead, GDB
presents the stop at the non-artificial frame:
(gdb) advance 21
main () at advance.cc:43
43 i = inline_func (i);
(gdb)
"advance" and "until" should really behave like user breakpoints here,
since their location is also user-specified. As the comment in
gdb.base/advance.exp says, "advance <location>" is really just
syntactic sugar for "tbreak <location>; continue".
Fix this by making stopped_by_user_bp_inline_frame also consider
advance/until breakpoints.
A testcase covering this will be included in the next patch.
gdb/ChangeLog:
PR gdb/26523
* inline-frame.c (stopped_by_user_bp_inline_frame): Also consider
bp_until breakpoints user-specified locations. Update intro
comment.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug gdb/26523] advance/until to inline frames
2020-08-22 20:10 [Bug gdb/26523] New: advance/until to inline frames palves at redhat dot com
2020-08-27 20:04 ` [Bug gdb/26523] " cvs-commit at gcc dot gnu.org
@ 2020-08-27 20:04 ` cvs-commit at gcc dot gnu.org
2020-08-27 20:21 ` palves at redhat dot com
2020-08-27 20:21 ` palves at redhat dot com
3 siblings, 0 replies; 5+ 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=26523
--- 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] 5+ messages in thread
* [Bug gdb/26523] advance/until to inline frames
2020-08-22 20:10 [Bug gdb/26523] New: advance/until to inline frames palves at redhat dot com
2020-08-27 20:04 ` [Bug gdb/26523] " cvs-commit at gcc dot gnu.org
2020-08-27 20:04 ` cvs-commit at gcc dot gnu.org
@ 2020-08-27 20:21 ` palves at redhat dot com
2020-08-27 20:21 ` palves at redhat dot com
3 siblings, 0 replies; 5+ messages in thread
From: palves at redhat dot com @ 2020-08-27 20:21 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=26523
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] 5+ messages in thread
* [Bug gdb/26523] advance/until to inline frames
2020-08-22 20:10 [Bug gdb/26523] New: advance/until to inline frames palves at redhat dot com
` (2 preceding siblings ...)
2020-08-27 20:21 ` palves at redhat dot com
@ 2020-08-27 20:21 ` palves at redhat dot com
3 siblings, 0 replies; 5+ messages in thread
From: palves at redhat dot com @ 2020-08-27 20:21 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=26523
--- Comment #4 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] 5+ messages in thread
end of thread, other threads:[~2020-08-27 20:21 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-22 20:10 [Bug gdb/26523] New: advance/until to inline frames palves at redhat dot com
2020-08-27 20:04 ` [Bug gdb/26523] " cvs-commit at gcc dot gnu.org
2020-08-27 20:04 ` cvs-commit at gcc dot gnu.org
2020-08-27 20:21 ` palves at redhat dot com
2020-08-27 20:21 ` 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).