llvm-project/lldb/tools/debugserver/source
Jason Molenda 7e9bd599a2 Add a new "thread-pcs" key-value pair to the T packet response from
debugserver.  thread-pcs has a comma separated list of base 16
addresses - the current pc value for every thread in the process.
It is a partner of the "threads:" key where a list of thread IDs
is given.  The pc values in thread-pcs correspond one-to-one with
the thread IDs in the threads list.

This is a part of performance work.  When lldb is instruction
stepping / fast stepping over a range of addresses for e.g. a "next"
command, and it steps in to another function, lldb will put a
breakpoint on the return address and continue the process.  Before
it calls continue, it calls Thread::SetupForResume on all the
threads, and SetupForResume needs to get the current pc value for
every thread to see if any are at a breakpoint site.

The result is that issuing a "c" continue requires that we send
"read pc register" packets for every thread.

We may do this sequence of step-into-function / continue-to-get-out
many times for a single user-visible "next" or "step" command, and
with highly multithreaded programs, we are sending many extra
packets to get all the thread values.

I looked at including this data in the "jstopinfo" JSON that
we already have in the T packet.  But there are three problems that
would make this increase the size of the T packet significantly.
First, numbers in JSON are base 10.  Second, a proper JSON would
have something like "thread_pcs": { "34224331112":383772734222, ...}
for thread-id 34224331112 and pc 383772734222 - so we're including
a whole extra copy of the thread id in addition to the pc.  Third,
the JSON text is hex-ascii'fied so the size of it is doubled.
In one example, 

threads:585db8,585dc7,585dc8,585dc9,585dca,585dce;thread-pcs:100001400,7fff8badc6de,7fff8badcff6,7fff8badc6de,7fff8badc6de,7fff8badc6de;

The "thread-pcs" adds 86 characters - 136 characters for both 
threads and thread-pcs.  Doing this in JSON would look like

threads={"5791160":4294972416,"5791175":140735536809694,"5791176":140735536812022,"5791177":140735536809694,"5791178":140735536809694,"5791182":140735536809694}

or 160 characters -- or 320 characters once it is hex-asciified.

Given that it's 86 characters vrs 320, I went with the old style
approach.  I've seen real world programs that have up to 60 threads
in them, so this could result in vastly larger packets if it
was all done in the JSON with hex-ascii expansion.

If we had an all-JSON T packet, where we didn't need to hex-ascii
encode anything, that would have been the better approach.  But
we'd already have a list of threads in JSON at that point so
the additional text wouldn't be too bad.

I'm working on finishing the patches to lldb to use this data;
will commit those once I've had a chance to test them more.  But
I wanted to commit the debugserver bits which are more
straightforward.


<rdar://problem/21963031> 

llvm-svn: 255711
2015-12-15 23:47:44 +00:00
..
MacOSX Upstreaming the apple internal changes that accumulated during the 2015-10-23 02:49:51 +00:00
ARM_DWARF_Registers.h Various fixes for armv7 floating point/vector register support. 2013-03-13 00:14:30 +00:00
ARM_ehframe_Registers.h A partner to the cleanup in r247741, change the variables names in 2015-09-15 23:49:57 +00:00
CMakeLists.txt [cmake] Remove LLVM_NO_RTTI. 2015-09-03 08:46:55 +00:00
ChangeLog Fix typos. 2014-07-01 21:22:11 +00:00
DNB.cpp Upstreaming the apple internal changes that accumulated during the 2015-10-23 02:49:51 +00:00
DNB.h Have debugserver send the OS version string plus 2015-08-12 03:27:33 +00:00
DNBArch.cpp Fix warnings. 2015-07-22 17:31:44 +00:00
DNBArch.h Fix warnings. 2015-07-22 17:31:44 +00:00
DNBBreakpoint.cpp Fix debugserver warnings on MacOSX. 2015-03-09 19:45:23 +00:00
DNBBreakpoint.h Huge performance improvements when one breakpoint contains many locations. 2013-06-12 00:46:38 +00:00
DNBDataRef.cpp Fix warnings. 2015-07-22 17:31:44 +00:00
DNBDataRef.h Fix debugserver warnings on MacOSX. 2015-03-09 19:45:23 +00:00
DNBDefs.h Upstreaming the apple internal changes that accumulated during the 2015-10-23 02:49:51 +00:00
DNBError.cpp Upstreaming the apple internal changes that accumulated during the 2015-10-23 02:49:51 +00:00
DNBError.h Upstreaming the apple internal changes that accumulated during the 2015-10-23 02:49:51 +00:00
DNBLog.cpp
DNBLog.h <rdar://problem/15172417> 2013-11-13 23:28:31 +00:00
DNBRegisterInfo.cpp Fix warnings. 2015-07-22 17:31:44 +00:00
DNBRegisterInfo.h
DNBRuntimeAction.h
DNBThreadResumeActions.cpp
DNBThreadResumeActions.h
DNBTimer.h Fix debugserver warnings on MacOSX. 2015-03-09 19:45:23 +00:00
JSONGenerator.h Commit file that was missing 240466. 2015-06-25 22:34:08 +00:00
Makefile Make lldb build with Makefiles on OS X. 2014-01-18 08:05:32 +00:00
PThreadCondition.h
PThreadEvent.cpp
PThreadEvent.h Fix a few typos. 2014-06-27 02:42:12 +00:00
PThreadMutex.cpp
PThreadMutex.h
PseudoTerminal.cpp
PseudoTerminal.h
RNBContext.cpp Fix debugserver warnings on MacOSX. 2015-03-09 19:45:23 +00:00
RNBContext.h Fix debugserver warnings on MacOSX. 2015-03-09 19:45:23 +00:00
RNBDefs.h __arm64__ and __aarch64__ #ifdef adjustments 2014-07-09 01:29:05 +00:00
RNBRemote.cpp Add a new "thread-pcs" key-value pair to the T packet response from 2015-12-15 23:47:44 +00:00
RNBRemote.h Fix warnings. 2015-07-22 17:31:44 +00:00
RNBServices.cpp Fix warnings. 2015-07-22 17:31:44 +00:00
RNBServices.h lldb arm64 import. 2014-03-29 18:54:20 +00:00
RNBSocket.cpp Fix warnings. 2015-07-22 17:31:44 +00:00
RNBSocket.h Replace all in_port_t with uint16_t to avoid compilation issues on different systems. 2013-12-06 17:46:35 +00:00
SysSignal.cpp
SysSignal.h
TTYState.cpp
TTYState.h Revert the debugserver part of r211868. While formally a fine change, debugserver 2014-06-27 16:02:55 +00:00
com.apple.debugserver.applist.internal.plist Upstreaming the apple internal changes that accumulated during the 2015-10-23 02:49:51 +00:00
com.apple.debugserver.applist.plist Upstreaming the apple internal changes that accumulated during the 2015-10-23 02:49:51 +00:00
com.apple.debugserver.internal.plist Upstreaming the apple internal changes that accumulated during the 2015-10-23 02:49:51 +00:00
com.apple.debugserver.plist Upstreaming the apple internal changes that accumulated during the 2015-10-23 02:49:51 +00:00
com.apple.debugserver.posix.plist Upstreaming the apple internal changes that accumulated during the 2015-10-23 02:49:51 +00:00
debugserver-entitlements.plist Remove some tabs that snuck into debugserver-entitlements.plist, etc. 2015-10-23 02:54:21 +00:00
debugserver-macosx-entitlements.plist Initial merge of some of the iOS 8 / Mac OS X Yosemite specific 2014-06-13 02:37:02 +00:00
debugserver.cpp Squelch a silly warning regarding an extra 'default' in 'case' 2015-11-03 21:29:52 +00:00
libdebugserver.cpp Fix warnings. 2015-07-22 17:31:44 +00:00
libdebugserver.h Add the standard LLVM copyright notice to the top of 2013-03-01 00:11:36 +00:00