Dear Héctor Orón Martínez My problem is that the breakpoint set at the first time do noting if I compile the code again.
The test code is //test.c 1 #include <stdlib.h> 2 #include <stdio.h> 3 4 int main() 5 { 6 int a=1, b=2, c=3; 7 int s; 8 s=a+b; 9 s+=c; 10 printf("%d+%d+%d = %d\n", a, b, c, s); 11 12 return 0; 13 } I compile the code with $ gcc -Wall -g test.c -o test Then I run gdb $ gdb test I set a breakpoint at line 8 (gdb) :break 8 And run the program in gdb (gdb) :run Then I compile the same code at the second time with the same command $ gcc -Wall -g test.c -o test And run the probram in gdb again. The breakpoint do nothing. If I check the status of the breakpoint with (gdb) :info breakpoints the output is Num Type Disp Enb Address What 1 breakpoint keep n 0x00005555555546cd in main at test.c:8 The output means the breakpoint is NOT enabled. I think the status of the breakpoint should NOT be changed. Best Regards Lu Wang ________________________________ From: Héctor Orón Martínez <hector.o...@gmail.com> Sent: Monday, May 29, 2017 11:04 PM To: Lu Wang; 863...@bugs.debian.org Subject: Re: Bug#863620: gdb: breakpoints disappear after recompiling Hello, 2017-05-29 13:02 GMT+02:00 Lu Wang <wanglus...@hotmail.com>: > I have set some breakpoints. If I recompile the code for debugging. > Then I execute the program using the command > run and the breakpoints disappear. This ought to work, but doesn't > restore my breakpoints. > > the output is > > `/home/tw/Documents/test1/xxx' has changed; re-reading symbols. > Error in re-setting breakpoint 1: Cannot access memory at address > 0x5555555546f0 > Starting program: /home/tw/Documents/test1/xxx > [Switching to thread 1 (process 11336)](running) > [Inferior 1 (process 11336) exited normally] Not sure if I understand correctly, but break points work for me... /tmp/hello-2.10$ gdb hello GNU gdb (Debian 7.12-6) 7.12.0.20161007-git Copyright (C) 2016 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-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from hello...done. (gdb) b main Breakpoint 1 at 0x15f0: file src/hello.c, line 41. (gdb) run Starting program: /tmp/hello-2.10/hello Breakpoint 1, main (argc=1, argv=0x7fffffffe0a8) at src/hello.c:41 41 { (gdb) However, what do you mean with you recompile the code for debugging? Can you show a reproducible testcase? Regards -- Héctor Orón -.. . -... .. .- -. -.. . ...- . .-.. --- .--. . .-.