Bug 26054 - step skipping over recommended breakpoint location
Summary: step skipping over recommended breakpoint location
Status: NEW
Alias: None
Product: gdb
Classification: Unclassified
Component: symtab (show other bugs)
Version: HEAD
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
: 26059 (view as bug list)
Depends on:
Blocks:
 
Reported: 2020-05-27 15:50 UTC by Tom de Vries
Modified: 2021-01-13 12:56 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tom de Vries 2020-05-27 15:50:06 UTC
[ spinoff of https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95360 ]

Consider test-case:
...
$ cat small.c
unsigned int b,d;
static int c[1][2] = {{0, 1}};

int main() {
  for (; d<1; d++)
    for (; b<1; b++)
      c[b][d+1] = 0;

  return 0;
}
...

Compiled like so:
...
$ gcc-10 -O0 -g small.c
...

When stepping through the program, we go straight from line 5 to line 7:
...
Temporary breakpoint 1 at 0x400496: file small.c, line 5.
Starting program: /home/vries/a.out 

Temporary breakpoint 1, main () at small.c:5
5         for (; d<1; d++)
(gdb) n
7             c[b][d+1] = 0;
...

If we disable the filtering in dwarf_record_line_p, we have instead:
...
Temporary breakpoint 1 at 0x400496: file small.c, line 5.
Starting program: /home/vries/a.out 

Temporary breakpoint 1, main () at small.c:5
5         for (; d<1; d++)
(gdb) n
6           for (; b<1; b++)
(gdb) n
7             c[b][d+1] = 0;
...
Comment 1 Anonymous 2021-01-13 12:56:51 UTC
*** Bug 26059 has been marked as a duplicate of this bug. ***