| 46 | |
| 47 | class DebuggerTest(unittest.TestCase): |
| 48 | def test_gdbdebug_file_server(self): |
| 49 | ql = Qiling(["../examples/rootfs/x8664_linux/bin/x8664_hello"], "../examples/rootfs/x8664_linux", verbose=QL_VERBOSE.DEBUG) |
| 50 | ql.debugger = True |
| 51 | |
| 52 | # some random command test just to make sure we covered most of the command |
| 53 | def gdb_test_client(): |
| 54 | # yield to allow ql to launch its gdbserver |
| 55 | time.sleep(1.337 * 2) |
| 56 | |
| 57 | with SimpleGdbClient('127.0.0.1', 9999) as client: |
| 58 | client.send('qSupported:multiprocess+;swbreak+;hwbreak+;qRelocInsn+;fork-events+;vfork-events+;exec-events+;vContSupported+;QThreadEvents+;no-resumed+;xmlRegisters=i386') |
| 59 | client.send('vMustReplyEmpty') |
| 60 | client.send('QStartNoAckMode') |
| 61 | client.send('Hgp0.0') |
| 62 | client.send('qXfer:auxv:read::0, 1000') |
| 63 | client.send('?') |
| 64 | client.send('qXfer:threads:read::0,fff') |
| 65 | client.send(f'qAttached:{ql.os.pid}') |
| 66 | client.send('qC') |
| 67 | client.send('g') |
| 68 | client.send('m555555554040, 1f8') |
| 69 | client.send('m555555554000, 100') |
| 70 | client.send('m200, 100') |
| 71 | client.send('p10') |
| 72 | client.send('Z0,555555554ada, 1') |
| 73 | client.send('c') |
| 74 | client.send('k') |
| 75 | |
| 76 | # yield to make sure ql gdbserver has enough time to receive our last command |
| 77 | time.sleep(1.337) |
| 78 | |
| 79 | threading.Thread(target=gdb_test_client, daemon=True).start() |
| 80 | |
| 81 | ql.run() |
| 82 | del ql |
| 83 | |
| 84 | def test_gdbdebug_mips32(self): |
| 85 | ql = Qiling(["../examples/rootfs/mips32_linux/bin/mips32_hello"], "../examples/rootfs/mips32_linux", verbose=QL_VERBOSE.DEBUG) |