gdb.info: Packets

Go forward to Stop Reply Packets
Go backward to Overview
Go up to Remote Protocol
Go to the top op gdb

Packets

The following table provides a complete list of all currently defined
COMMANDs and their corresponding response DATA.
`!' -- extended mode
     Enable extended mode.  In extended mode, the remote server is made
     persistent.  The `R' packet is used to restart the program being
     debugged.
     Reply:
    `OK'
          The remote target both supports and has enabled extended mode.
`?' -- last signal
     Indicate the reason the target halted.  The reply is the same as
     for step and continue.
     Reply: *Note Stop Reply Packets::, for the reply specifications.
`a' -- reserved
     Reserved for future use.
`A'ARGLEN`,'ARGNUM`,'ARG`,...' --  set program arguments *(reserved)*
     Initialized `argv[]' array passed into program. ARGLEN specifies
     the number of bytes in the hex encoded byte stream ARG.  See
     `gdbserver' for more details.

Reply: `OK'

`ENN'

`b'BAUD -- set baud *(deprecated)*
     Change the serial line speed to BAUD.
     JTC: _When does the transport layer state change?  When it's
     received, or after the ACK is transmitted.  In either case, there
     are problems if the command or the acknowledgment packet is
     dropped._
     Stan: _If people really wanted to add something like this, and get
     it working for the first time, they ought to modify ser-unix.c to
     send some kind of out-of-band message to a specially-setup stub
     and have the switch happen "in between" packets, so that from
     remote protocol's point of view, nothing actually happened._
`B'ADDR,MODE -- set breakpoint *(deprecated)*
     Set (MODE is `S') or clear (MODE is `C') a breakpoint at ADDR.
     This packet has been replaced by the `Z' and `z' packets (*note
     insert breakpoint or watchpoint packet::).
`c'ADDR -- continue
     ADDR is address to resume.  If ADDR is omitted, resume at current
     address.
     Reply: *Note Stop Reply Packets::, for the reply specifications.
`C'SIG`;'ADDR -- continue with signal
     Continue with signal SIG (hex signal number).  If `;'ADDR is
     omitted, resume at same address.
     Reply: *Note Stop Reply Packets::, for the reply specifications.
`d' -- toggle debug *(deprecated)*
     Toggle debug flag.
`D' -- detach
     Detach GDB from the remote system.  Sent to the remote target
     before GDB disconnects via the `detach' command.
     Reply:
    `_no response_'
          GDB does not check for any response after sending this packet.
`e' -- reserved
     Reserved for future use.
`E' -- reserved
     Reserved for future use.
`f' -- reserved
     Reserved for future use.
`F'RC`,'EE`,'CF`;'XX -- Reply to target's F packet.
     This packet is send by GDB as reply to a `F' request packet sent
     by the target.  This is part of the File-I/O protocol extension.
     *Note File-I/O remote protocol extension::, for the specification.
`g' -- read registers
     Read general registers.
     Reply:
    `XX...'
          Each byte of register data is described by two hex digits.
          The bytes with the register are transmitted in target byte
          order.  The size of each register and their position within
          the `g' PACKET are determined by the GDB internal macros
          DEPRECATED_REGISTER_RAW_SIZE and REGISTER_NAME macros.  The
          specification of several standard `g' packets is specified
          below.

`ENN'
for an error.

`G'XX... -- write regs
     *Note read registers packet::, for a description of the XX...
     data.
     Reply:
    `OK'
          for success
    `ENN'
          for an error
`h' -- reserved
     Reserved for future use.
`H'CT... -- set thread
     Set thread for subsequent operations (`m', `M', `g', `G', et.al.).
     C depends on the operation to be performed: it should be `c' for
     step and continue operations, `g' for other operations.  The
     thread designator T... may be -1, meaning all the threads, a
     thread number, or zero which means pick any thread.
     Reply:
    `OK'
          for success
    `ENN'
          for an error
`i'ADDR`,'NNN -- cycle step *(draft)*
     Step the remote target by a single clock cycle.  If `,'NNN is
     present, cycle step NNN cycles.  If ADDR is present, cycle step
     starting at that address.
`I' -- signal then cycle step *(reserved)*
     *Note step with signal packet::.  *Note cycle step packet::.
`j' -- reserved
     Reserved for future use.
`J' -- reserved
     Reserved for future use.
`k' -- kill request
     FIXME: _There is no description of how to operate when a specific
     thread context has been selected (i.e. does 'k' kill only that
     thread?)_.
`K' -- reserved
     Reserved for future use.
`l' -- reserved
     Reserved for future use.
`L' -- reserved
     Reserved for future use.
`m'ADDR`,'LENGTH -- read memory
     Read LENGTH bytes of memory starting at address ADDR.  Neither GDB
     nor the stub assume that sized memory transfers are assumed using
     word aligned accesses. FIXME: _A word aligned memory transfer
     mechanism is needed._
     Reply:
    `XX...'
          XX... is mem contents. Can be fewer bytes than requested if
          able to read only part of the data.  Neither GDB nor the stub
          assume that sized memory transfers are assumed using word
          aligned accesses. FIXME: _A word aligned memory transfer
          mechanism is needed._

`ENN'
NN is errno

`M'ADDR,LENGTH`:'XX... -- write mem
     Write LENGTH bytes of memory starting at address ADDR.  XX... is
     the data.
     Reply:
    `OK'
          for success
    `ENN'
          for an error (this includes the case where only part of the
          data was written).
`n' -- reserved
     Reserved for future use.
`N' -- reserved
     Reserved for future use.
`o' -- reserved
     Reserved for future use.
`O' -- reserved
     Reserved for future use.
`p'N... -- read reg *(reserved)*
     *Note write register packet::.
     Reply:
    `R....'
          The hex encoded value of the register in target byte order.
`P'N...`='R... -- write register
     Write register N... with value R..., which contains two hex digits
     for each byte in the register (target byte order).
     Reply:
    `OK'
          for success
    `ENN'
          for an error
`q'QUERY -- general query
     Request info about QUERY.  In general GDB queries have a leading
     upper case letter.  Custom vendor queries should use a company
     prefix (in lower case) ex: `qfsf.var'.  QUERY may optionally be
     followed by a `,' or `;' separated list.  Stubs must ensure that
     they match the full QUERY name.
     Reply:
    `XX...'
          Hex encoded data from query.  The reply can not be empty.
    `ENN'
          error reply
    `'
          Indicating an unrecognized QUERY.
`Q'VAR`='VAL -- general set
     Set value of VAR to VAL.
     *Note general query packet::, for a discussion of naming
     conventions.
`r' -- reset *(deprecated)*
     Reset the entire system.
`R'XX -- remote restart
     Restart the program being debugged.  XX, while needed, is ignored.
     This packet is only available in extended mode.
     Reply:
    `_no reply_'
          The `R' packet has no reply.
`s'ADDR -- step
     ADDR is address to resume.  If ADDR is omitted, resume at same
     address.
     Reply: *Note Stop Reply Packets::, for the reply specifications.
`S'SIG`;'ADDR -- step with signal
     Like `C' but step not continue.
     Reply: *Note Stop Reply Packets::, for the reply specifications.
`t'ADDR`:'PP`,'MM -- search
     Search backwards starting at address ADDR for a match with pattern
     PP and mask MM.  PP and MM are 4 bytes.  ADDR must be at least 3
     digits.
`T'XX -- thread alive
     Find out if the thread XX is alive.
     Reply:
    `OK'
          thread is still alive
    `ENN'
          thread is dead
`u' -- reserved
     Reserved for future use.
`U' -- reserved
     Reserved for future use.
`v' -- verbose packet prefix
     Packets starting with `v' are identified by a multi-letter name,
     up to the first `;' or `?' (or the end of the packet).
`vCont'[;ACTION[`:'TID]]... -- extended resume
     Resume the inferior.  Different actions may be specified for each
     thread.  If an action is specified with no TID, then it is applied
     to any threads that don't have a specific action specified; if no
     default action is specified then other threads should remain
     stopped.  Specifying multiple default actions is an error;
     specifying no actions is also an error.  Thread IDs are specified
     in hexadecimal.  Currently supported actions are:

`c'
Continue.

    `CSIG'
          Continue with signal SIG.  SIG should be two hex digits.

`s'
Step.

    `SSIG'
          Step with signal SIG.  SIG should be two hex digits.
     The optional ADDR argument normally associated with these packets
     is not supported in `vCont'.
     Reply: *Note Stop Reply Packets::, for the reply specifications.
`vCont?' -- extended resume query
     Query support for the `vCont' packet.
     Reply:
    ``vCont'[;ACTION]...'
          The `vCont' packet is supported.  Each ACTION is a supported
          command in the `vCont' packet.
    `'
          The `vCont' packet is not supported.
`V' -- reserved
     Reserved for future use.
`w' -- reserved
     Reserved for future use.
`W' -- reserved
     Reserved for future use.
`x' -- reserved
     Reserved for future use.
`X'ADDR`,'LENGTH:XX... -- write mem (binary)
     ADDR is address, LENGTH is number of bytes, XX...  is binary data.
     The characters `$', `#', and `0x7d' are escaped using `0x7d'.
     Reply:
    `OK'
          for success
    `ENN'
          for an error
`y' -- reserved
     Reserved for future use.
`Y' reserved
     Reserved for future use.
`z'TYPE`,'ADDR`,'LENGTH -- remove breakpoint or watchpoint *(draft)*
`Z'TYPE`,'ADDR`,'LENGTH -- insert breakpoint or watchpoint *(draft)*
     Insert (`Z') or remove (`z') a TYPE breakpoint or watchpoint
     starting at address ADDRESS and covering the next LENGTH bytes.
     Each breakpoint and watchpoint packet TYPE is documented
     separately.
     _Implementation notes: A remote target shall return an empty string
     for an unrecognized breakpoint or watchpoint packet TYPE.  A
     remote target shall support either both or neither of a given
     `Z'TYPE... and `z'TYPE... packet pair.  To avoid potential
     problems with duplicate packets, the operations should be
     implemented in an idempotent way._
`z'`0'`,'ADDR`,'LENGTH -- remove memory breakpoint *(draft)*
`Z'`0'`,'ADDR`,'LENGTH -- insert memory breakpoint *(draft)*
     Insert (`Z0') or remove (`z0') a memory breakpoint at address
     `addr' of size `length'.
     A memory breakpoint is implemented by replacing the instruction at
     ADDR with a software breakpoint or trap instruction.  The `length'
     is used by targets that indicates the size of the breakpoint (in
     bytes) that should be inserted (e.g., the ARM and MIPS can insert
     either a 2 or 4 byte breakpoint).
     _Implementation note: It is possible for a target to copy or move
     code that contains memory breakpoints (e.g., when implementing
     overlays).  The behavior of this packet, in the presence of such a
     target, is not defined._

Reply:
`OK'
success

`'
not supported

    `ENN'
          for an error
`z'`1'`,'ADDR`,'LENGTH -- remove hardware breakpoint *(draft)*
`Z'`1'`,'ADDR`,'LENGTH -- insert hardware breakpoint *(draft)*
     Insert (`Z1') or remove (`z1') a hardware breakpoint at address
     `addr' of size `length'.
     A hardware breakpoint is implemented using a mechanism that is not
     dependant on being able to modify the target's memory.
     _Implementation note: A hardware breakpoint is not affected by code
     movement._

Reply:
`OK'
success

`'
not supported

    `ENN'
          for an error
`z'`2'`,'ADDR`,'LENGTH -- remove write watchpoint *(draft)*
`Z'`2'`,'ADDR`,'LENGTH -- insert write watchpoint *(draft)*
     Insert (`Z2') or remove (`z2') a write watchpoint.

Reply:
`OK'
success

`'
not supported

    `ENN'
          for an error
`z'`3'`,'ADDR`,'LENGTH -- remove read watchpoint *(draft)*
`Z'`3'`,'ADDR`,'LENGTH -- insert read watchpoint *(draft)*
     Insert (`Z3') or remove (`z3') a read watchpoint.

Reply:
`OK'
success

`'
not supported

    `ENN'
          for an error
`z'`4'`,'ADDR`,'LENGTH -- remove access watchpoint *(draft)*
`Z'`4'`,'ADDR`,'LENGTH -- insert access watchpoint *(draft)*
     Insert (`Z4') or remove (`z4') an access watchpoint.

Reply:
`OK'
success

`'
not supported

    `ENN'
          for an error