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

Support non-stop #26

Open
tromey opened this issue Dec 21, 2017 · 5 comments
Open

Support non-stop #26

tromey opened this issue Dec 21, 2017 · 5 comments

Comments

@tromey
Copy link
Collaborator

tromey commented Dec 21, 2017

In non-stop mode, the client just replies OK to commands like vCont, and then generates an async notification packet when there is some noteworthy inferior event.

This means that the client would have to have some way to tell process_packets_from that an event like this occurred.

@luser
Copy link
Owner

luser commented Dec 21, 2017

If we're going to wind up having async behavior then we'll either need to split networking and the handler into separate threads and use std::sync::mpsc::{Sender, Receiver} to multiplex messages from both threads to a single place, or go all-in and use tokio and Future.

@tromey
Copy link
Collaborator Author

tromey commented Dec 21, 2017

The server can also send output to gdb while gdb is waiting for a stop reply -- the O packet. In the sync model this would be a callback from a handler back into the I/O loop.

I think it would be best if this code were just always async and then sometimes pretended to be sync for the protocol's sake.

@tromey
Copy link
Collaborator Author

tromey commented Dec 24, 2017

If the server code were always async, then I think QNonStop would be handled entirely by this library and not require a Handler method.

@tromey
Copy link
Collaborator Author

tromey commented Dec 26, 2017

See https://github.com/tromey/rust-gdb-remote-protocol/tree/multi-threaded for a draft of how this could work. So far that just implements the threading bits: the reading is done in one thread, and the handlers and response writing are done in whichever thread called process_packets_from.

After this the idea would be that target-continuing functions (whatever Handler method we call to implement vCont) would get an object which implements Write and which also has some sort of stopped method.

The Write implementation in all-stop would send O packets, but in non-stop would just drop the output (since this isn't defined for non-stop yet)

The stopped method would take a StopReason and would simply post it to the channel, so that the command processor would send it on to the client. Maybe we could make this a bit safer by making each such object single-use, and requiring them to appear in order. That way the server couldn't re-send a stop reason or send stop reasons out of order somehow.

@tromey
Copy link
Collaborator Author

tromey commented Dec 28, 2017

Maybe we could make this a bit safer by making each such object single-use

Actually they can't be single use in non-stop mode. And, in all-stop mode, it's expected that any stop will stop all threads -- so this information has to be exposed.

See https://github.com/tromey/rust-gdb-remote-protocol/tree/client-state for some more work in this area.

Also the % notification / vStopped processing will require a bit more state, namely a vector of pending stops and also a flag indicating whether the initial notification has been sent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants