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
realgud:gdb breakpoints out of sync after edit and recompile #268
Comments
Sure, this sounds reasonable. Want to implement it yourself?
There may be some confusion about what realgud currently does. So let me explain. In contrast to gdb, when last I looked implemented locations as a cons node whose car was a filename and cdr a line number, realgud in fact uses Elisp marks to mark a position. That has implications. In particular if you insert/delete/modify text that doesn't encompass the marked position, the marked position stays contextually the same. And this is often what you want, unless this change has been coordinated with the debugger underneath and often it is not. realgud uses a package called When realgud terminates or notices debugger termination it issues this Elisp command to all the buffers attached from a central command buffer for that debugger session via the Elisp command I am not sure how breakpoints are handled in this process and probably there are bugs here. There is a place to associate additional commands to perform on a gdb
I reread what you wrote, and I misunderstood. I had thought that the synchronization was to go from gdb to the realgud rather than the other way around. Synchronizing gdb from realgud as you suggest does indeed seem often times what you would prefer to do. Especially in the situation you describe.
Sure that makes sense.
Yes, I was unsatisfied enough with gdb and gdb-mi to undertake writing a replacement. With all of its warts and believe me I've been working around a number of them, it still is pretty cool after all of these years. That said, I've been pretty much footing this activity all by myself. It is time to either get funding for this (fat chance) or get more people to help out. So thanks in advance. |
I just googled Ken McMillan - Wow! Z3 is way way way cool and has changed the landscape!. We used that in the Ethereum Mythril and Ethereum Solidity folks use that as well. Many many many thanks for your work on this! (I'm surprised you even took notice of this project because personally, I've been thinking about and moving towards VSCode, and LSP, and Debug protocols). |
Well, I added a couple of features in Z3, but's it's really Leo DeMoura and Nikolaj Bjorner who are responsible for Z3. I'm just as in awe of them as you are! I can try coding the 'adjust-breakpoints' feature if you can give me a few pointers. Looking at the code it seems that I'm not ready to switch to VSCode yet! |
I'm In New York, have to go to sleep now, but we will get this done. |
I looked again at the issue and I think I understand better the request. So I've modified what I wrote — see the crossed-out part and part after that. I was a bit tired and edgy yesterday and probably shouldn't have written anything in that state.
This is in fact already there in the command buffer. If you run Here is an extract from a session I just tried: Breakpoint list (bp-list)Breakpoint 2
Breakpoint 1
The actual field in the debugger structure
There is a realgud debugger remap command set aside called
If it helps, when (About the longer name
No problem, no bother. Thanks again for offering to work on this! As in any open-source project, if it is to be successful and survive it has to rely on the help of more than primarily one person. And the project is definitely has already been made much better as a result of the suggestions and work of other people. |
It occurs to me that this is easy enough to change in the debuggers I control. Also, this could be suggested and changed in And in my opinion it after this is in place these other gdb-like debuggers, would I'd attempt to change it in gdb. |
This is something that was always annoying about gdb mode and seems to happen also in realgud. If you edit the source and then recompile and restart the program in gdb, the breakpoint marks in the source files are out of sync with the breakpoints in gdb. That is, the the gdb breakpoints remain at the old line numbers, while the marks move with the edited text. What you really want is for the breakpoints to follow the source text, as they do in a typical IDE.
How about a command 'adjust-breakpoints' that moves the breakpoints in gdb to their current locations in the source files? This could be implemented by issuing a command to save the breakpoints in a file, modifying the file to reflect the line numbers of the marks, and then sourcing the file. For bonus points, when the 'run' command is issued, detect that the binary file has changed and call adjust-breakpoints automatically.
By the way, I just discovered realgud and am very happy to see that there is a replacement for the completely broken gdb-mi. Many thanks for that!
The text was updated successfully, but these errors were encountered: