You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This example shows how to partially debug an elf file. First let the program run, hook at the main address and take a snapshot. Then resume the snapshot to construct a reasonable call_state (registers, memory mapping, dynamic library loading, etc) for our target piece of code, and directly assign the pc pointer to the beginning of the part you want to simulate.
37
+
38
+
Run it with:
39
+
$ python3 hello_x8664_linux_part_debug.py
40
+
41
+
Then in a new terminal start gdb remote debug:
42
+
$ gdb -q
43
+
(gdb) target remote localhost:9999
44
+
Remote debugging using localhost:9999
45
+
Reading /home/qiling/examples/rootfs/x8664_linux/bin/sleep_hello from remote target...
46
+
warning: File transfers from remote targets can be slow. Use "set sysroot" to access files locally instead.
47
+
Reading /home/qiling/examples/rootfs/x8664_linux/bin/sleep_hello from remote target...
48
+
Reading symbols from target:/home/qiling/examples/rootfs/x8664_linux/bin/sleep_hello...(no debugging symbols found)...done.
49
+
warning: unable to open /proc file '/proc/42000/task/42000/maps'
50
+
Reading /lib64/ld-linux-x86-64.so.2 from remote target...
51
+
Reading /lib64/ld-linux-x86-64.so.2 from remote target...
52
+
Reading symbols from target:/lib64/ld-linux-x86-64.so.2...Reading /lib64/ld-2.27.so from remote target...
53
+
Reading /lib64/.debug/ld-2.27.so from remote target...
The source code of sleep_hello can be found at qiling/examples/src/linux/sleep_hello.c. As the above gdb output shows, we skipped the sleep function to directly debug the code afterwards.
0 commit comments