diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 0abd3dd6df1..bcd3786598f 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2021-04-06 Tom de Vries + + PR breakpoints/25884 + * infcmd.c (prepare_one_step): Using inline frame info to narrow + stepping range. + 2021-04-06 Tom de Vries PR tui/27680 diff --git a/gdb/infcmd.c b/gdb/infcmd.c index 9b0186dd391..60f25d24686 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -1013,6 +1013,20 @@ prepare_one_step (thread_info *tp, struct step_command_fsm *sm) &tp->control.step_range_start, &tp->control.step_range_end); + /* There's a problem in gcc (PR gcc/98780) that causes missing line + table entries, which results in a too large stepping range. + Use inlined_subroutine info to make the range more narrow. */ + if (inline_skipped_frames (tp) > 0) + { + symbol *sym = inline_skipped_symbol (tp); + if (SYMBOL_CLASS (sym) == LOC_BLOCK) + { + const block *block = SYMBOL_BLOCK_VALUE (sym); + if (BLOCK_END (block) < tp->control.step_range_end) + tp->control.step_range_end = BLOCK_END (block); + } + } + tp->control.may_range_step = 1; /* If we have no line info, switch to stepi mode. */ diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index f5fe029c049..c6063be3832 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2021-04-06 Tom de Vries + + PR breakpoints/25884 + * gdb.opt/inline-cmds.exp: Remove kfail. + 2021-04-06 Tom de Vries PR testsuite/27691 diff --git a/gdb/testsuite/gdb.opt/inline-cmds.exp b/gdb/testsuite/gdb.opt/inline-cmds.exp index 17720c46795..981dcbb4a29 100644 --- a/gdb/testsuite/gdb.opt/inline-cmds.exp +++ b/gdb/testsuite/gdb.opt/inline-cmds.exp @@ -222,22 +222,7 @@ gdb_breakpoint $line3 gdb_continue_to_breakpoint "consecutive func1" gdb_test "next" ".*func1 .*first call.*" "next to first func1" -set msg "next to second func1" -gdb_test_multiple "next" $msg { - -re ".*func1 .*second call.*$gdb_prompt $" { - pass $msg - } - -re ".*marker .*$gdb_prompt $" { - # This assembles to two consecutive call instructions. - # Both appear to be at the same line, because they're - # in the body of the same inlined function. This is - # reasonable for the line table. GDB should take the - # containing block and/or function into account when - # deciding how far to step. The single line table entry - # is actually two consecutive instances of the same line. - kfail gdb/25884 $msg - } -} +gdb_test "next" ".*func1 .*second call.*" "next to second func1" # It is easier when the two inlined functions are not on the same line. set line4 [gdb_get_line_number "set breakpoint 4 here"]