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
Rework the entire logic of the GDB stub #10142
Conversation
This is how gdbserver feature of gdb work when used for remote debugging, if this functionality is not in the way it might be a good idea to keep, as it will work like most gdb users expect out of the box. |
The idea that me and @phire were talking about were you would start the emu normally WITHOUT the stub, but have the port in the settings and you would use some sort of menu option to start it so it would effectively stall AFTER the emulation started. This is actually how mgba works: you can start and stop it on demand. It's fine for now if it only works on boot, but I was just saying we might improve it in another pr to not force it on boot. |
9ac58d6
to
23507d1
Compare
|
Ok I addressed the review, fixed compilation and also added a race condition fix I found while testing on windows. |
23507d1
to
a0692f2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not seeing any flaws in the multi-threading logic.
But there are a few minor fixes.
a0692f2
to
bbc5569
Compare
|
Does this PR make #6325 obsolete? |
Looks like it mostly obsoletes it, and does so with much less code and without an entire thread. |
bbc5569
to
d2de6ba
Compare
d2de6ba
to
9301045
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few of your commit messages need cleaning up (Code Review Code Review)
other than that and the missing comment in CPU.h, I think it's ready.
This is needed to send ctrl+C signals while the CPU thread is running.
9301045
to
6a4d607
Compare
The GDB stub is an old and very unmaintained feature that can be very useful when paired with reversing tools like ghidra, but being unmaintained, it didn't worked very well (and only worked on the interpreter).
This PR does the ground work to rework it entirely to at least a usable state. Here's a summary of the changes:
To note: the hardest part was figuring out how to coordinate this with the core safely: I am not experienced with multithreading stuff so when reviewing, I recommend to pay close attention to how this interacts with the core and to make sure there's no race or anything unsafe I am doing here. This pr is mostly to make sure the approach done here is correct for potential further improvements.
For now, I can vouch for a gdb shell to work (mostly tested on the one provided by devkitppc, but gdb-multiarch seemed to work well), but ghidra seems to have issues of its own that doesn't seem to be in the scope of Dolphin.