[lldb-dev] Question about remote debugging protocol setup

Greg Clayton gclayton at apple.com
Fri Apr 11 09:43:11 PDT 2014


All debugging on MacOSX uses the GDB remote protocol a Mac specific GDB server binary called "debugserver". So the GDB remote protocol is very well supported and quite mature.

The GDB remote protocol, as GDB implements it, lacks key features required to support good multi-threaded debugging. As Jim stated, we fix this by adding LLDB specific additions:

svn cat http://llvm.org/svn/llvm-project/lldb/trunk/docs/lldb-gdb-remote.txt

The main issue with the standard GDB remote protocol is it likes to think only one thread stops for a reason. So if you run a multi-threaded program and more than one thread stops at a breakpoint, the standard GDB server will tell you about one of them only. Then when you continue, it won't actually continue, it will immediately stop at one of the other threads. This means stepping through multi-threaded code is quite painful as you ping pong between threads. So if you will only have 1 thread, you won't need to worry about this. If you have multiple threads, you should. We specify which packets are important to implement and classify them by which ones you should implement first.

Greg Clayton

On Apr 11, 2014, at 2:01 AM, Matthew Gardiner <mg11 at csr.com> wrote:

> Hi All,
> 
> I'm trying to understand how to write a gdbserver for one of our chips, which we are planning to attach lldb to.
> 
> First off, I started doing a sniff of protocol between debugger and gdbserver with local debug of an linux intel 64-bit process.
> 
> I then compared the traces between the debugger being gdb and lldb.
> 
> Using gdb:
> 
> CLIENT SENDS: +
> CLIENT SENDS: $qSupported:multiprocess+;xmlRegisters=i386;qRelocInsn+#b5
> SERVER SENDS: +
> SERVER SENDS: $PacketSize=3fff;QPassSignals+;QProgramSignals+;qXfer:libraries-svr4:read+;augmented-libraries-svr4-read+;qXfer:auxv:read+;qXfer:spu:read+;qXfer:spu:write+;qXfer:siginfo:read+;qXfer:siginfo:write+;qXfer:features:read+;QStartNoAckMode+;qXfer:osdata:read+;multiprocess+;QNonStop+;QDisableRandomization+;qXfer:threads:read+;ConditionalTracepoints+;TraceStateVariables+;TracepointSource+;DisconnectedTracing+;FastTracepoints+;StaticTracepoints+;InstallInTrace+;qXfer:statictrace:read+;qXfer:traceframe-info:read+;EnableDisableTracepoints+;QTBuffer:size+;tracenz+;ConditionalBreakpoints+;BreakpointCommands+;QAgent+;Qbtrace:bts+;Qbtrace:off+;qXfer:btrace:read+#ad
> SERVER SENDS: +
> CLIENT SENDS: $QStartNoAckMode#b0
> SERVER SENDS: +
> SERVER SENDS: $OK#9a
> CLIENT SENDS: +
> 
> Using lldb:
> 
> CLIENT SENDS: +
> CLIENT SENDS: $QStartNoAckMode#b0
> SERVER SENDS: +
> CLIENT SENDS: $OK#9a
> SERVER SENDS: +
> 
> So I'm wondering why does lldb not send the qSupported request? Is it a deliberate omission or is this still a work in progress?
> 
> All viewpoints appreciated,
> thanks Matt
> 
> 
> 
> 
> Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
> More information can be found at www.csr.com. Keep up to date with CSR on our technical blog, www.csr.com/blog, CSR people blog, www.csr.com/people, YouTube, www.youtube.com/user/CSRplc, Facebook, www.facebook.com/pages/CSR/191038434253534, or follow us on Twitter at www.twitter.com/CSR_plc.
> New for 2014, you can now access the wide range of products powered by aptX at www.aptx.com.
> _______________________________________________
> lldb-dev mailing list
> lldb-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev




More information about the lldb-dev mailing list