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
pkg/proc/gdbserial: optimize gdbwire backend #3715
Conversation
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.
Did you test these changes with rr? If not I will.
There's some failures on the rr backend, I'm working to address those now. |
I'm actually seeing failures already with RR on our latest tagged version with the latest RR: RR failure
We should create a separate issue to track this. In the meantime I can restrict my changes to only run when we have a debugserver backend (non-rr). We really need a builder for RR but that is kind of difficult due to limitations around RR in virtualized environments. |
Created #3717 for RR failures not related to this PR. |
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 have run the tests with rr and they pass.
pkg/proc/gdbserial/gdbserver.go
Outdated
if jstopInfo != nil { | ||
_, shouldQueryStopInfo = jstopInfo[th.ID] | ||
} | ||
if shouldQueryStopInfo { |
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 don't get this change. If we have a jsonstop record for the thread we do a second query to get a stock packet for the thread? We do this regardless of whether we know if the backend supports the qThreadStopInfo packet?
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.
Yeah, as of now I'm only limiting the number of stopInfo packets we send to the threads listed in jstopinfo. That way we don't issue stop info packets for every thread, every time, only the ones we know are in some interesting state.
There is a further optimization which I've noted in the TODO comment where we use only the jstopinfo packet when present and avoid sending any stopInfo packets at all. I've held off on doing that in this PR as the change will be more involved and I didn't want to add too much noise to this patch, so I'm going to send that in as a follow up.
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.
However I did fix the issue with not taking support of qThreadStopInfo
into account.
This change optimizes the gdbwire backend by reducing the number of round trips we have to make to debugserver. It does this by using the jstopinfo packet to only query threads which we know to have a stop reason, and it also uses the registers returned by the 'T' packet to avoid issuing a bunch of 'p' packets to get the register values.
07f217f
to
a73e62d
Compare
This change optimizes the gdbwire backend by reducing the number of
round trips we have to make to debugserver. It does this by using the
jstopinfo packet to only query threads which we know to have a stop
reason, and it also uses the registers returned by the 'T' packet
to avoid issuing a bunch of 'p' packets to get the register values.