1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
| gdb通信协议 协议定义 GDB RemoteSerial Protocol(RSP)是一种简单的,通过串口线、网络等至少支持半双工通信的媒介进行ASCII消息传输的协议。
RSP包以$符号作为数据包的开始,后跟一个或多个用于组成要发送的消息的ASCII字节,并以#作为数据包的结束。再#后,还有两个16进制的ASCII字符作为要发送的消息的校验和。一个完整的RSP协议数据包如下:
$m4015bc,2#5a
消息的接收方会立即返回‘+’表示正确接收数据,或‘-’表示没有正确接收数据。当返回‘-’时,GDB会将错误码返回给用户,并无条件挂起GDB进程。
目标机按接收到的指令次序,依次将信息输出在GDB的console中。除非GDB进程中有其他的命令正在执行,否则来自目标机的信息将会在任意时刻输出在console中。
set debug remote 1查看交互信息 Sending packet: $T1#85...Ack Packet received: OK Sending packet: $m5624f000,1#91...Ack Packet received: E14 Sending packet: $me6b53000,1#bf...Ack Packet received: E14 0x00000000 in ?? () Sending packet: $m5624f888,4#ac...Ack Packet received: E14 Sending packet: $me6b5314d,4#fb...Ack Packet received: E14 Sending packet: $me6b5314d,4#fb...Ack Packet received: E14 Sending packet: $m65,4#38...Ack Packet received: 00000000 Sending packet: $m0,4#fd...Ack Packet received: 42000100 Sending packet: $m10042,4#c4...Ack Packet received: E14 Sending packet: $m0,4#fd...Ack Packet received: 42000100 Sending packet: $m10042,4#c4...Ack Packet received: E14 Sending packet: $m0,4#fd...Ack Packet received: 42000100 Sending packet: $m10042,4#c4...Ack Packet received: E14 Sending packet: $m0,4#fd...Ack Packet received: 42000100
|