CMP EMBEDDED.COM

Login | Register     Welcome Guest RFID World  esc india  TeardownTV
 

The GDB Remote Serial Protocol

The GDB Remote Serial Protocol (RSP) is the lingua franca between gdb and a remote target. It defines messages for reading and writing data, controlling the application being debugged, and reporting application status. The host side is implemented in gdb's remote.c source file.

The following are short descriptions of the RSP's most important commands. A complete summary of each command is available on the ESP Web site, www.embedded.com/code.htm.

Data exchanged between gdb and a remote target with the GDB Remote Serial Protocol uses plain ASCII characters. Messages begin with a dollar sign ($) and end with a gridlet (#) and eight-bit checksum. In other words, each message looks like this:

$ <data> # CKSUM_MSN CKSUM_LSN

where <data> is typically a string of ASCII hex [0-9,a-f,A-F] characters. CKSUM_MSN and CKSUM_LSN are ASCII hex representations of an eight-bit checksum of <data>. Only the hex digits 0 to 9 and a to f are allowed. When a message is sent, the receiver responds with either:

+ if the received checksum was correct, and the receiver is ready for the next packet

- the received checksum was incorrect, and the message needs to be retransmitted

A target can respond to a message from gdb with either data or an OK (depending on the message), or a target-defined error code. When gdb receives an error code, it reports the number to the user via the gdb console.

Definitions for <data> are shown below.



Table A: Register-related commands
Command name <data> definition Description
read registers g Return the values of all registers
write registers GXX..XX Set registers to XX..XX
write register nn Pnn=XX..XX Set the value of register NN
Table B: Memory-related commands
Command name <data> definition Description
read memory mAA..AA,LL..LL Read values from memory
write memory MAA..AA,LL..LL:XX..XX Write values to memory
Table C: Target infromation commands
Command name <data> definition Description
query section offsets qOffsets Return section offset information
Table D: Program control commands
Command name <data> definition Description
set thread Hc Set current program thread
step sAA..AA Execute one assembly instruction
continue cAA..AA Resume application execution
last signal ? Report last signal
kill k Terminate application
Table E: Target Status messages (responses from the target)
Message name <data> definition Description
last signal response Snn Minimal reply to the last signal command
expected response Tnnr...:v...r...:v...; The last signal reported, plus key register values
console output Ovvvvvvvv... sends text from the target to gdb’s console


Back
Embedded.com Career Center
Ready to take that job and shove it?
SEARCH JOBS

Browse all jobs

SPONSOR
RECENT JOB POSTINGS


 :