gdbstub: Optimize kgdb's "thread:" response for the gdb serial protocol
commit84a0bd5b2830722cf80ff6ad33ef98101a947e14
authorJason Wessel <jason.wessel@windriver.com>
Thu, 5 Aug 2010 14:22:19 +0000 (5 09:22 -0500)
committerJason Wessel <jason.wessel@windriver.com>
Thu, 5 Aug 2010 14:22:19 +0000 (5 09:22 -0500)
tree942f596d5a6b48bde181ed2ab063d697a0f2e73d
parenta9fa20a7af1f152d2d89c44c274a310ac654e3ad
gdbstub: Optimize kgdb's "thread:" response for the gdb serial protocol

The gdb debugger understands how to parse short versions of the thread
reference string as long as the bytes are paired in sets of two
characters.  The kgdb implementation was always sending 8 leading
zeros which could be omitted, and further optimized in the case of
non-negative thread numbers.  The negative numbers are used to
reference a specific cpu in the case of kgdb.

An example of the previous i386 stop packet looks like:
    T05thread:00000000000003bb;

New stop packet response:
    T05thread:03bb;

The previous ThreadInfo response looks like:
    m00000000fffffffe,0000000000000001,0000000000000002,0000000000000003,0000000000000004,0000000000000005,0000000000000006,0000000000000007,000000000000000c,0000000000000088,000000000000008a,000000000000008b,000000000000008c,000000000000008d,000000000000008e,00000000000000d4,00000000000000d5,00000000000000dd

New ThreadInfo response:
    mfffffffe,01,02,03,04,05,06,07,0c,88,8a,8b,8c,8d,8e,d4,d5,dd

A few bytes saved means better response time when using kgdb over a
serial line.

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
kernel/debug/gdbstub.c