gdb server protocol

The gdb server protocol is used in a debug setup between gdb and the gdbserver. The gdbserver is the driver/software interface of the JATG/SWD probe. This allows the user to use an(optional) IDE with gdb to debug firmware running on a MCU.

+------------------+
| User |
+------------------+
|
+------------------+
| IDE |
+------------------+
|
+------------------+
| gdb |
+------------------+
|
| <-- gdb server protocol is used here
|
+------------------+
| gdb server |
+------------------+
|
+------------------+
| JTAG / SWD probe |
+------------------+
|
+------------------+
| MCU |
+------------------+

The remote protocol is specified in Appendix E of the gdb documentation. Wherever appropriate large parts of that documentation have been copied here.

The protocol is used over a serial byte data stream. Examples are a serial port (UART/COM Port) or a TCP port. The data is exchanged over this channel in packets. In this communication the gdb sends commands and the gdb server sends replies.

In the documentation format strings everything [inside of square brackets] is optional and can be missing.

signals

include/gdb/signals.h

commands

'!' Enable extended mode must be supported

'?' question mark

'A' A

'b' set baur rate don't use

'B' set or clear breakpoint don't use

'bc' backward continue

'bs' backward single step

'c' continue must be supported

'C' continue with signal

'd' toggle debug flag don't use

'D' detach

'F' file i/o

'g' read general register must be supported

'G' write general register must be supported

'H' select thread

'i' single clock step

'I' signal cycle step

'k' kill

'm' read memory must be supported

'M' write memory must be supported

'p' read register

'P' write register

'QAgent' agent on/off

'QAllow' allow operations

'qC' read current tread id

'qCRC' CRC of memory region

'QDisableRandomization' disable randomization of virtual addresses

'QStartupWithShell' use shell

'QEnvironmentHexEncoded' environment variables

'QEnvironmentUnset' unset environment variable

'QEnvironmentReset' reset environment

'QSetWorkingDir' set working directory

'qfThreadInfo' get active theads

'qsThreadInfo' get active theads

'qGetTLSAddr' get address of thread local storage

'qGetTIBAddr' get the Windows OS specific thread information block

'qL' get thread infromation from RTOS

'qMemTags' get memory tags

'qIsAddressTagged' check if address is tagged

'QMemTags' store memory tags

'qOffsets' get section offsets

'qP' read thread id don't use

'QNonStop' switch non stop mode

'QCatchSyscalls' switch catching syscalls

'QPassSignals' which signals to pass

'QProgramSignals' signals to target

'QThreadEvents' switch reporting of thread events

'QThreadOptions' apply options

'qRcmd' run command

'qSearch' search memory

'QStartNoAckMode' stop sending acks

'qSupported' tell gdbserver which features gdb supports

'qSymbol' tell gdb server that gdb can answere symbol requests

'qTBuffer' trace

'QTBuffer' trace

'QTDisconnected' trace

'QTDP' trace

'QTDPsrc' trace

'QTDV' trace

'qTfP' trace

'qTfV' trace

'QTFrame' trace

'qTMinFTPILen' trace

'qThreadExtraInfo' os decription for thread

‘QTNotes’ trace

'qTP' trace

'QTSave' trace

'qTsP' trace

'qTsV' trace

'QTStart' trace

'QTStop' trace

'QTEnable' trace

'QTDisable' trace

'QTinit' trace

'QTro' trace

'qTStatus' trace

'qTV' trace

'qTfSTM' trace

'qTsSTM' trace

'qTSTMat' trace

'qXfer' read special area

'qAttached' is attached?

'Qbtrace' enable branch tracing

'Qbtrace-conf' configure branch trace

'r' reset don't use

'R' restart program being debugged

's' single step must be supported

'S' signal single step

't' search backwards

'T' is thread alive

'vAttach' attach to a new process

'vCont' continue trhead must be supported

'vCont?' request supported actions of 'vCont'

'vCtrlC' interrupt remote target

'vFile' file operation on target file system

'vFlashErase' erase flash

'vFlashWrite' write flash

'vFlashDone' flash operations done

'vKill' kill process

'vMustReplyEmpty' test unknown command reply

'vRun' run program

'vStopped' stopped

'x' read memory

'X' write data to memory

'z' remove breakpoint

'Z' insert breakpoint

replies

“” empty

“E” Error Hex

“E” Error text

“S” stopped because of Signal

“T” stopped because of Signal + infos

“w” thread exited

“W” process exited

“X” process terminated

“N” no more threads

“O” console output

“F” host function call

notification stop

dictionary

Word / Abbreviation	Explanation
IDE	Integrated Development environment
MCU	Micro Controller Unit
addressable memory units	TODO