This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug breakpoints/13574] New: breakpoint data not consistent aftersource editing and run


http://sourceware.org/bugzilla/show_bug.cgi?id=13574

             Bug #: 13574
           Summary: breakpoint data not consistent after source editing
                    and run
           Product: gdb
           Version: 7.3
            Status: NEW
          Severity: normal
          Priority: P2
         Component: breakpoints
        AssignedTo: unassigned@sourceware.org
        ReportedBy: xdegaye@gmail.com
    Classification: Unclassified


The following gdb session shows that after inserting an empty line
before a breakpoint, recompiling and re-running, then the 'info' and
'clear' commands refer to the breakpoint old line number while the
'list' command and gdb when stopping at this breakpoint, refer to the
new line number.
The gdb/mi '-break-list' command also reports the breakpoint old line
number.

=== foo.c ======================
int main(int argc, char ** argv)
{
    return 0;
}
=== gdb session ================
$ gcc -g foo.c
$ gdb-7.3.92/install/bin/gdb a.out
GNU gdb (GDB) 7.3.92
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /path/to/a.out...done.
(gdb) break foo.c:3
Breakpoint 1 at 0x400487: file foo.c, line 3.
(gdb) run
Starting program: /path/to/a.out 

Breakpoint 1, main (argc=1, argv=0x7fffffffe7e8) at foo.c:3
3           return 0;
(gdb) # insert a new line before the breakpoint at line 3
(gdb) shell sed -i -e "s/^\s*\({\)\s*$/\1\n/" foo.c; gcc -g foo.c
(gdb) run
The program being debugged has been started already.
Start it from the beginning? (y or n) yes
`/path/to/a.out' has changed; re-reading symbols.
Starting program: /path/to/a.out 

Breakpoint 1, main (argc=1, argv=0x7fffffffe7e8) at foo.c:4
4           return 0;
(gdb) info breakpoints 
Num     Type           Disp Enb Address            What
1       breakpoint     keep y   0x0000000000400487 in main at foo.c:3
        breakpoint already hit 1 time
(gdb) clear 4
No breakpoint at 4.
(gdb) clear 3
Deleted breakpoint 1 
(gdb) list
1       int main(int argc, char ** argv)
2       {
3
4           return 0;
5       }
(gdb)
===================

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]