[Lldb-commits] [PATCH] D27289: Return "thread-pcs" in jstopinfo on Linux/Android.
Jason Molenda via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Wed Nov 30 17:43:41 PST 2016
jasonmolenda added a comment.
For what it's worth, this change was part of the changes we made to reduce packet traffic for "private stops". When a high-level "step" or "next" command is done, we instruction step (or fast-step with Jim's fast-step code when it sees a sequence of instructions that cannot branch - we set a breakpoint and continue instead of instruction stepping) until we reach the end of the stepping range and then we do a "public stop". Given that the private stops are more numerous, we spent a bunch of time looking at everything we could eliminate for those private stops. Getting all the pc values into the stop packet (aka T or ? packet) was a big one. For multi-threaded programs we also added a "jstopinfo" which gives the stop reasons for all threads that had a stop reason, e.g.
(I elided the expedited registers)
The jstopinfo above is ascii-hex encoding of the JSON,
else lldb would iterate over all the threads to see if any of them stopped for some reason (e.g. hitting a breakpoint) while we were instruction stepping. If you don't see lldb doing that thread-stop-reason checking for your platform, it won't be needed.
(and looking at this, it's giving the stop reasoon for the thread that hit a breakpoint -- which we already get from the T packet. Hmmm, I see another tiny perf win in the near future! ;)
We're also sending up 4 words of stack memory which might be the start of this function's stack frame and it's caller's stack frame. For a simple "find the pc of the caller stack frame" in lldb, this can remove a couple of memory reads as the thread stepping logic needs to know who the caller stack frame is.
We also did some work on the public stop side, adding a jThreadsInfo packet which gives us all the information about all of the threads. We get all the expedited registers, the thread name, the stop reasons, information about the darwin libdispatch queues, and expedited stack memory to help speed up a stack walk (I don't remember offhand if debugserver tries to walk the entire stack using the simple follow-the-frame-chain-in-stack-memory technique or if it caps the stack walk. but our main IDE, Xcode, needs the full stack for its UI so we wanted to fetch that in one big packet so we can give the pc and function names without any additional packet traffic.)
More information about the lldb-commits