MCPcopy Create free account
hub / github.com/qilingframework/qiling / SimpleGdbClient

Class SimpleGdbClient

tests/test_windows_debugger.py:12–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10from qiling.const import QL_VERBOSE
11
12class SimpleGdbClient:
13 DELAY = 0.6
14
15 def __init__(self, host: str, port: int):
16 sock = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
17 txtf = sock.makefile('w')
18
19 sock.connect((host, port))
20
21 self.__sock = sock
22 self.__file = txtf
23
24 def __enter__(self):
25 return self
26
27 def __exit__(self, ex_type, ex_value, ex_traceback):
28 self.__sock.close()
29
30 @staticmethod
31 def checksum(data: str) -> int:
32 return sum(ord(c) for c in data) & 0xff
33
34 def send(self, msg: str):
35 time.sleep(SimpleGdbClient.DELAY)
36
37 self.__file.write(f'${msg}#{SimpleGdbClient.checksum(msg):02x}')
38 self.__file.flush()
39
40class DebuggerTest(unittest.TestCase):
41

Callers 1

gdb_test_clientMethod · 0.70

Calls

no outgoing calls

Tested by 1

gdb_test_clientMethod · 0.56