[RFC][PATCH 0/6] Step program considering the source column information

Hannes Domani ssbssa@yahoo.de
Tue May 19 16:02:14 GMT 2020


 Am Dienstag, 19. Mai 2020, 14:27:44 MESZ hat Luis Machado <luis.machado@linaro.org> Folgendes geschrieben:

> Thanks for working on this, it is really useful.
>
> I'm guessing this series would probably handle the following situation
> very well:
>
> https://sourceware.org/bugzilla/show_bug.cgi?id=21221

According to the debug info, the i initialization is on line 5, column 23.
And the rest of the for-loop is on line 5, column 5.

With the new column-based next-command, it goes back and forth between
them (but you have to wait a while for the inner loop to finish).

Debug session:

(gdb) start
Temporary breakpoint 1 at 0x40162d: file gdb-21221.c, line 5, column 23.
Starting program: C:\src\tests\gdb-21221.exe

Temporary breakpoint 1, main () at gdb-21221.c:5
5           for (unsigned int i = 0U; i < 0xFFFFFU; i++)
                              ^
(gdb) nc
5           for (unsigned int i = 0U; i < 0xFFFFFU; i++)
            ^
(gdb) nc
5           for (unsigned int i = 0U; i < 0xFFFFFU; i++)
                              ^
(gdb) nc
5           for (unsigned int i = 0U; i < 0xFFFFFU; i++)
            ^
(gdb) l
1       int main (void)
2       {
3         while (1)
4         {
5           for (unsigned int i = 0U; i < 0xFFFFFU; i++)
6           {
7             ;
8           }
9         }
10      }
(gdb) disas
Dump of assembler code for function main:
   0x0000000000401620 <+0>:     push   %rbp
   0x0000000000401621 <+1>:     mov    %rsp,%rbp
   0x0000000000401624 <+4>:     sub    $0x30,%rsp
   0x0000000000401628 <+8>:     callq  0x401700 <__main>
   0x000000000040162d <+13>:    movl   $0x0,-0x4(%rbp)
   0x0000000000401634 <+20>:    jmp    0x40163a <main+26>
   0x0000000000401636 <+22>:    addl   $0x1,-0x4(%rbp)
   0x000000000040163a <+26>:    cmpl   $0xffffe,-0x4(%rbp)
   0x0000000000401641 <+33>:    jbe    0x401636 <main+22>
   0x0000000000401643 <+35>:    jmp    0x40162d <main+13>
End of assembler dump.
(gdb) maint info line-table gdb-21221.c
objfile: C:\src\tests\gdb-21221.exe ((struct objfile *) 0x11f4e670)
compunit_symtab: ((struct compunit_symtab *) 0x11f71890)
symtab: C:\src\tests\gdb-21221.c ((struct symtab *) 0x11f71910)
linetable: ((struct linetable *) 0x1204fde0):
INDEX  LINE   COLUMN ADDRESS            IS-STMT
0      2      1      0x0000000000401620 Y
1      2      1      0x0000000000401628 Y
2      5      23     0x000000000040162d Y
3      5      5      0x0000000000401634 Y
4      END           0x0000000000401645 Y


More information about the Gdb-patches mailing list