"""Capture full state after reproduction of CROSS-on-COPY-modal bug.""" import socket, json, struct s = socket.create_connection(('127.0.0.1', 4370), timeout=30) def send(p): s.sendall((json.dumps(p) + '\n').encode()) buf = b'' while True: c = s.recv(1 << 20) if not c: break buf += c if buf.strip().endswith(b'}'): try: return json.loads(buf.decode()) except: continue return json.loads(buf.decode()) def read_words(addr, length, label=''): r = send({'id':1,'cmd':'read_ram','addr':f'0x{addr:08X}','len':length}) hx = r.get('hex', '') b = bytes.fromhex(hx) if hx else b'' print(f"\n--- {label or hex(addr)} (0x{addr:08X}, {length}B) ---") for i in range(0, len(b), 4): if i+4 > len(b): break w = struct.unpack("4} func={e['func']} ra={e['ra']} " f"a0={e['a0']} a1={e.get('a1','?')} a2={e.get('a2','?')} " f"frame={e['frame']} depth={e.get('depth','?')}") s.close()