Skip to content

Instantly share code, notes, and snippets.

@gabonator
Created February 29, 2024 14:50
Show Gist options
  • Save gabonator/174e84d4b55329354ec1ae10ed59b707 to your computer and use it in GitHub Desktop.
Save gabonator/174e84d4b55329354ec1ae10ed59b707 to your computer and use it in GitHub Desktop.
open ocd protocol sniffer
ide->ocd+$qSupported:multiprocess+;swbreak+;hwbreak+;qRelocInsn+;fork-events+;vfork-events+;exec-events+;vContSupported+;QThreadEvents+;no-resumed+;memory-tagging+#ec
ocd->ide+
ocd->ide+
ocd->ide$PacketSize=4000;qXfer:memory-map:read+;qXfer:features:read+;qXfer:threads:read+;QStartNoAckMode+;vContSupported+#02
ide->ocd+
ide->ocd$vMustReplyEmpty#3a
ocd->ide+$#00
ide->ocd+
ide->ocd$QStartNoAckMode#b0
ocd->ide+
ocd->ide$OK#9a
ide->ocd+$!#21
ocd->ide$OK#9a
ide->ocd$Hg0#df
ocd->ide$OK#9a
ide->ocd$qXfer:features:read:target.xml:0,1000#0c
ocd->ide$
ocd->idel<?xml version="1.0"?>
<!DOCTYPE target SYSTEM "gdb-target.dtd">
<target version="1.0">
<architecture>arm</architecture>
<feature name="org.gnu.gdb.arm.m-profile">
<reg name="r0" bitsize="32" regnum="0" save-restore="yes" type="int" group="general"/>
<reg name="r1" bitsize="32" regnum="1" save-restore="yes" type="int" group="general"/>
<reg name="r2" bitsize="32" regnum="2" save-restore="yes" type="int" group="general"/>
<reg name="r3" bitsize="32" regnum="3" save-restore="yes" type="int" group="general"/>
<reg name="r4" bitsize="32" regnum="4" save-restore="yes" type="int" group="general"/>
<reg name="r5" bitsize="32" regnum="5" save-restore="yes" type="int" group="general"/>
<reg name="r6" bitsize="32" regnum="6" save-restore="yes" type="int" group="general"/>
<reg name="r7" bitsize="32" regnum="7" save-restore="yes" type="int" group="general"/>
<reg name="r8" bitsize="32" regnum="8" save-restore="yes" type="int" group="general"/>
<reg name="r9" bitsize="32" regnum="9" save-restore="yes" type="int" group="general"/>
<reg name="r10" bitsize="32" regnum="10" save-restore="yes" type="int" group="general"/>
<reg name="r11" bitsize="32" regnum="11" save-restore="yes" type="int" group="general"/>
<reg name="r12" bitsize="32" regnum="12" save-restore="yes" type="int" group="general"/>
<reg name="sp" bitsize="32" regnum="13" save-restore="yes" type="data_ptr" group="general"/>
<reg name="lr" bitsize="32" regnum="14" save-restore="yes" type="int" group="general"/>
<reg name="pc" bitsize="32" regnum="15" save-restore="yes" type="code_ptr" group="general"/>
<reg name="xPSR" bitsize="32" regnum="16" save-restore="yes" type="int" group="general"/>
</feature>
<feature name="org.gnu.gdb.arm.m-system">
<reg name="msp" bitsize="32" regnum="17" save-restore="yes" type="data_ptr" group="system"/>
<reg name="psp" bitsize="32" regnum="18" save-restore="yes" type="data_ptr" group="system"/>
<reg name="primask" bitsize="1" regnum="20" save-restore="yes" type="int8" group="system"/>
<reg name="basepri" bitsize="8" regnum="21" save-restore="yes" type="int8" group="system"/>
<reg name="faultmask" bitsize="1" regnum="22" save-restore="yes" type="int8" group="system"/>
<reg name="control" bitsize="3" regnum="23" save-restore="yes" type="int8" group="system"/>
</feature>
<feature name="org.gnu.gdb.arm.vfp">
<reg name="d0" bitsize="64" regnum="42" save-restore="yes" type="ieee_double" group="float"/>
<reg name="d1" bitsize="64" regnum="43" save-restore="yes" type="ieee_double" group="float"/>
<reg name="d2" bitsize="64" regnum="44" save-restore="yes" type="ieee_double" group="float"/>
<reg name="d3" bitsize="64" regnum="45" save-restore="yes" type="ieee_double" group="float"/>
<reg name="d4" bitsize="64" regnum="46" save-restore="yes" type="ieee_double" group="float"/>
<reg name="d5" bitsize="64" regnum="47" save-restore="yes" type="ieee_double" group="float"/>
<reg name="d6" bitsize="64" regnum="48" save-restore="yes" type="ieee_double" group="float"/>
<reg name="d7" bitsize="64" regnum="49" save-restore="yes" type="ieee_double" group="float"/>
<reg name="d8" bitsize="64" regnum="50" save-restore="yes" type="ieee_double" group="float"/>
<reg name="d9" bitsize="64" regnum="51" save-restore="yes" type="ieee_double" group="float"/>
<reg name="d10" bitsize="64" regnum="52" save-restore="yes" type="ieee_double" group="float"/>
<reg name="d11" bitsize="64" regnum="53" save-restore="yes" type="ieee_double" group="float"/>
<reg name="d12" bitsize="64" regnum="54" save-restore="yes" type="ieee_double" group="float"/>
<reg name="d13" bitsize="64" regnum="55" save-restore="yes" type="ieee_double" group="float"/>
<reg name="d14" bitsize="64" regnum="56" save-restore="yes" type="ieee_double" group="float"/>
<reg name="d15" bitsize="64" regnum="57" save-restore="yes" type="ieee_double" group="float"/>
<reg name="fpscr" bitsize="32" regnum="58" save-restore="yes" type="int" group="float"/>
</feature>
</target>
#d1
ide->ocd$qTStatus#49
ocd->ide$#00
ide->ocd$?#3f
ocd->ide$S02#b5
ide->ocd$qXfer:threads:read::0,1000#92
ocd->ide$l<?xml version="1.0"?>
<threads>
</threads>
#02
ide->ocd$Hc-1#09
ocd->ide$OK#9a
ide->ocd$qC#b4
ocd->ide$QC0#c4
ide->ocd$qAttached#8f
ocd->ide$1#31
ide->ocd$qOffsets#4b
ocd->ide$Text=0;Data=0;Bss=0#04
ide->ocd$g#67
ocd->ide$0000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffffffffffffffffffff00000a20ffffffff8c020008000000f9#57
ide->ocd$qXfer:threads:read::0,1000#92
ocd->ide$l<?xml version="1.0"?>
<threads>
</threads>
#02
ide->ocd$qXfer:memory-map:read::0,1000#ab
ocd->ide$l<memory-map>
<memory type="ram" start="0x00000000" length="0x08000000"/>
<memory type="flash" start="0x08000000" length="0x200000">
<property name="blocksize">0x2000</property>
</memory>
<memory type="ram" start="0x08200000" length="0x03e00000"/>
<memory type="flash" start="0x0c000000" length="0x200000">
<property name="blocksize">0x2000</property>
</memory>
<memory type="ram" start="0x0c200000" length="0xf3e00000"/>
</memory-map>
#34
ide->ocd$m800028c,4#62
ocd->ide$0d488546#d7
ide->ocd$m800028c,2#60
ocd->ide$0d48#00
ide->ocd$qSymbol::#5b
ocd->ide$OK#9a
ide->ocd$me000ee08,4#f4
ocd->ide$00000000#80
ide->ocd$qRcmd,5265616441504578203078313030303030302030784638#5b
ocd->ide$4f2e4b2e3a307865303066653030330a#89
ide->ocd$qRcmd,526561644d656d41502030783130303030303020307845303046454644302030783820307830#b8
ocd->ide$4f2e4b2e3a307830303030303030302c307830303030303030302c307830303030303030302c307830303030303030302c307830303030303038342c307830303030303030342c307830303030303031612c307830303030303030300a#fb
ide->ocd+$qSupported:multiprocess+;swbreak+;hwbreak+;qRelocInsn+;fork-events+;vfork-events+;exec-events+;vContSupported+;QThreadEvents+;no-resumed+;memory-tagging+#ec
ocd->ide+
ocd->ide+
ocd->ide$PacketSize=4000;qXfer:memory-map:read+;qXfer:features:read+;qXfer:threads:read+;QStartNoAckMode+;vContSupported+#02
ide->ocd+
ide->ocd$vMustReplyEmpty#3a
ocd->ide+
ocd->ide$#00
ide->ocd+$QStartNoAckMode#b0
ocd->ide+
ocd->ide$OK#9a
ide->ocd+$!#21
ocd->ide$OK#9a
ide->ocd$Hg0#df
ocd->ide$OK#9a
ide->ocd$qXfer:features:read:target.xml:0,1000#0c
ocd->ide$l<?xml version="1.0"?>
<!DOCTYPE target SYSTEM "gdb-target.dtd">
<target version="1.0">
<architecture>arm</architecture>
<feature name="org.gnu.gdb.arm.m-profile">
<reg name="r0" bitsize="32" regnum="0" save-restore="yes" type="int" group="general"/>
<reg name="r1" bitsize="32" regnum="1" save-restore="yes" type="int" group="general"/>
<reg name="r2" bitsize="32" regnum="2" save-restore="yes" type="int" group="general"/>
<reg name="r3" bitsize="32" regnum="3" save-restore="yes" type="int" group="general"/>
<reg name="r4" bitsize="32" regnum="4" save-restore="yes" type="int" group="general"/>
<reg name="r5" bitsize="32" regnum="5" save-restore="yes" type="int" group="general"/>
<reg name="r6" bitsize="32" regnum="6" save-restore="yes" type="int" group="general"/>
<reg name="r7" bitsize="32" regnum="7" save-restore="yes" type="int" group="general"/>
<reg name="r8" bitsize="32" regnum="8" save-restore="yes" type="int" group="general"/>
<reg name="r9" bitsize="32" regnum="9" save-restore="yes" type="int" group="general"/>
<reg name="r10" bitsize="32" regnum="10" save-restore="yes" type="int" group="general"/>
<reg name="r11" bitsize="32" regnum="11" save-restore="yes" type="int" group="general"/>
<reg name="r12" bitsize="32" regnum="12" save-restore="yes" type="int" group="general"/>
<reg name="sp" bitsize="32" regnum="13" save-restore="yes" type="data_ptr" group="general"/>
<reg name="lr" bitsize="32" regnum="14" save-restore="yes" type="int" group="general"/>
<reg name="pc" bitsize="32" regnum="15" save-restore="yes" type="code_ptr" group="general"/>
<reg name="xPSR" bitsize="32" regnum="16" save-restore="yes" type="int" group="general"/>
</feature>
<feature name="org.gnu.gdb.arm.m-system">
<reg name="msp" bitsize="32" regnum="17" save-restore="yes" type="data_ptr" group="system"/>
<reg name="psp" bitsize="32" regnum="18" save-restore="yes" type="data_ptr" group="system"/>
<reg name="primask" bitsize="1" regnum="20" save-restore="yes" type="int8" group="system"/>
<reg name="basepri" bitsize="8" regnum="21" save-restore="yes" type="int8" group="system"/>
<reg name="faultmask" bitsize="1" regnum="22" save-restore="yes" type="int8" group="system"/>
<reg name="control" bitsize="3" regnum="23" save-restore="yes" type="int8" group="system"/>
</feature>
<feature name="org.gnu.gdb.arm.vfp">
<reg name="d0" bitsize="64" regnum="42" save-restore="yes" type="ieee_double" group="float"/>
<reg name="d1" bitsize="64" regnum="43" save-restore="yes" type="ieee_double" group="float"/>
<reg name="d2" bitsize="64" regnum="44" save-restore="yes" type="ieee_double" group="float"/>
<reg name="d3" bitsize="64" regnum="45" save-restore="yes" type="ieee_double" group="float"/>
<reg name="d4" bitsize="64" regnum="46" save-restore="yes" type="ieee_double" group="float"/>
<reg name="d5" bitsize="64" regnum="47" save-restore="yes" type="ieee_double" group="float"/>
<reg name="d6" bitsize="64" regnum="48" save-restore="yes" type="ieee_double" group="float"/>
<reg name="d7" bitsize="64" regnum="49" save-restore="yes" type="ieee_double" group="float"/>
<reg name="d8" bitsize="64" regnum="50" save-restore="yes" type="ieee_double" group="float"/>
<reg name="d9" bitsize="64" regnum="51" save-restore="yes" type="ieee_double" group="float"/>
<reg name="d10" bitsize="64" regnum="52" save-restore="yes" type="ieee_double" group="float"/>
<reg name="d11" bitsize="64" regnum="53" save-restore="yes" type="ieee_double" group="float"/>
<reg name="d12" bitsize="64" regnum="54" save-restore="yes" type="ieee_double" group="float"/>
<reg name="d13" bitsize="64" regnum="55" save-restore="yes" type="ieee_double" group="float"/>
<reg name="d14" bitsize="64" regnum="56" save-restore="yes" type="ieee_double" group="float"/>
<reg name="d15" bitsize="64" regnum="57" save-restore="yes" type="ieee_double" group="float"/>
<reg name="fpscr" bitsize="32" regnum="58" save-restore="yes" type="int" group="float"/>
</feature>
</target>
ocd->ide#d1
ide->ocd$qTStatus#49
ocd->ide$#00
ide->ocd$?#3f
ocd->ide$S02#b5
ide->ocd$qXfer:threads:read::0,1000#92
ocd->ide$l<?xml version="1.0"?>
<threads>
</threads>
#02
ide->ocd$Hc-1#09
ocd->ide$OK#9a
ide->ocd$qC#b4
ocd->ide$QC0#c4
ide->ocd$qAttached#8f
ocd->ide$1#31
ide->ocd$qOffsets#4b
ocd->ide$Text=0;Data=0;Bss=0#04
ide->ocd$g#67
ocd->ide$0000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffffffffffffffffffff00000a20ffffffff8c020008000000f9#57
ide->ocd$qXfer:threads:read::0,1000#92
ocd->ide$l<?xml version="1.0"?>
<threads>
</threads>
#02
ide->ocd$qXfer:memory-map:read::0,1000#ab
ocd->ide$l<memory-map>
<memory type="ram" start="0x00000000" length="0x08000000"/>
<memory type="flash" start="0x08000000" length="0x200000">
<property name="blocksize">0x2000</property>
</memory>
<memory type="ram" start="0x08200000" length="0x03e00000"/>
<memory type="flash" start="0x0c000000" length="0x200000">
<property name="blocksize">0x2000</property>
</memory>
<memory type="ram" start="0x0c200000" length="0xf3e00000"/>
</memory-map>
#34
ide->ocd$m800028c,4#62
ocd->ide$0d488546#d7
ide->ocd$m800028c,2#60
ocd->ide$0d48#00
ide->ocd$qSymbol::#5b
ocd->ide$OK#9a
ide->ocd$vFlashErase:08000000,00006000#c8
ocd->ide$OK#9a
ide->ocd$vFlashWrite:8000000:
var net = require('net');
var fs = require("fs");
var server = net.createServer(function(socket) {
console.log("ide connected")
var client = new net.Socket();
client.connect(3333, '127.0.0.1', function() {
console.log('ocd connected');
});
client.on('data', function(data) {
fs.appendFileSync("ocdlog.txt", "\nocd->ide")
fs.appendFileSync("ocdlog.txt", data, null)
console.log('ocd->ide ' + data);
socket.write(data);
});
socket.on('data', function(data) {
fs.appendFileSync("ocdlog.txt", "\nide->ocd")
fs.appendFileSync("ocdlog.txt", data, null)
console.log('ide->ocd ' + data);
client.write(data);
});
_h = socket;
});
server.listen(3344, '127.0.0.1');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment