Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clear in GDB does not remove breakpoints marks in the code buffer #278

Open
novakboskov opened this issue Aug 1, 2020 · 9 comments · May be fixed by #303
Open

clear in GDB does not remove breakpoints marks in the code buffer #278

novakboskov opened this issue Aug 1, 2020 · 9 comments · May be fixed by #303

Comments

@novakboskov
Copy link

I use r to run the program in GDB and kill and clear to clear all the breakpoints and stop the program. Normally, I do not kill GDB but just use r again to run the program again when recompiled.
Is there a realgud command that would clear my code buffer from the breakpoint markings?

@rocky
Copy link
Collaborator

rocky commented Aug 1, 2020

I don't understand exactly what you mean. When you restart gdb, doesn't it keep the same breakpoints?

@novakboskov
Copy link
Author

novakboskov commented Aug 3, 2020

@rocky

  1. I run the program with r,
  2. stop the program with kill,
  3. delete all the breakpoints using d

The lines where the breakpoints were are still marked in the buffer that holds code. The lines should not be highlighted because the breakpoints do not exist anymore.

The only way to get rid of those wrong highlights is to kill the buffer and reopen the code file.

@rocky
Copy link
Collaborator

rocky commented Aug 3, 2020

Ok. I guess then that kill when it succeeds should clear breakpoints assocated with the killed program.

In the forseeable future I'm not going to have any time to look at. You up for investigating how to add?

@rocky
Copy link
Collaborator

rocky commented Aug 3, 2020

No change that part about chainging the realgud kill:

(gdb) break main
Breakpoint 1 at 0x80484a0: file ctest4.c, line 7.
(gdb) run
Starting program: /home/rocky/c/ctest4 

Breakpoint 1, main (argc=1, argv=0xffffc964) at ctest4.c:7
warning: Source file is more recent than executable.
7	  const char p[]="TRACK 1 MODE2/2336";
(gdb) kill
Kill the program being debugged? (y or n) y
[Inferior 1 (process 23414) killed]
(gdb) info break
Num     Type           Disp Enb Address    What
1       breakpoint     keep y   0x080484a0 in main at ctest4.c:7
	breakpoint already hit 1 time
(gdb) run
Starting program: /home/rocky/c/ctest4 

Breakpoint 1, main (argc=1, argv=0xffffc964) at ctest4.c:7
7	  const char p[]="TRACK 1 MODE2/2336";

Maybe you can be as detailed as the above about specifiying the problem.

@novakboskov
Copy link
Author

novakboskov commented Aug 3, 2020

@rocky Not sure that we understood each other. :)

GDB's kill should not delete the breakpoints. delete should.

And there is nothing wrong with GDB. It does delete all my breakpoints when I call delete. The problem is that those breakpoints that do not exist anymore still appear as highlighted lines in the code buffer (the C code buffer that is in realgud-short-key-mode)

In other words, info break does not show any breakpoints while the buffer with the code still keeps lines highlighted.

@rocky
Copy link
Collaborator

rocky commented Aug 3, 2020

Not sure that we understood each other. :)

Yeah, I have that feeling too.

Since you

  • understand the problem in great detail
  • know how to replicate it,
  • know when it the problem is fixed, and
  • encounter it enough to mention it,

why don't you take a stab at fixing and put in a PR?

@novakboskov
Copy link
Author

@rocky Because I thought that there are people more familiar with the Realgud codebase than I am. :)

The other reason why I'm writing an issue is to make sure that the problem exists in general and is not only due to my own configuration.

But I got you, will look at this as soon as I find time for it.

@813gan
Copy link
Collaborator

813gan commented Aug 6, 2020

Related: #180

@813gan
Copy link
Collaborator

813gan commented Aug 6, 2020

@novakboskov You may be interested particularly in realgud:cmd-kill from cmds.el, realgud:terminate-srcbuf from core.el and realgud-bp-remove-icons form bp.el.

lrittel added a commit to lrittel/realgud that referenced this issue Jul 12, 2022
Added a python event listener that prints a message whenever a
breakpoint is deleted.

The regexp for detecting deleted breakpoints is now applied repeatedly
as long as there are additional matches as the gdb listener writes
one message for each deleted breakpoint.

This should fix realgud#278, realgud#180 and realgud#61.
@lrittel lrittel linked a pull request Jul 12, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants