This repository has been archived by the owner on Apr 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 108
Using the gdb server to debug harvey processes
Graham MacDonald edited this page Mar 21, 2017
·
8 revisions
You can debug processes running harvey using gdb, remotely.
As an example, let's run the command dd
and attach to it.
The GO9PTERM and GO9PCPU scripts in the util folder both specify the -s
option. This is shorthand for -gdb tcp::1234
and will allow us to connect from the host to the guest via port 1234.
-
On the guest (harvey):
- Open 2 rio windows
- In one, run
dd
- In the other run
ps
to get the process ID... - Next, run
gdbserver -p <processid>
-
On the host:
- Run
gdb amd64/bin/dd
- Ensure the architecture is set to
i386:x86-64
. You can check withshow architecture
and set withset architecture i386:x86-64
. (You may not need this step). - In gdb, enter
target remote localhost:1234
- At this point you should have connected. To continue executing, enter
c
.
- Run
-
On the guest again:
- Now you can debug. Interact with the application, e.g. in the window running dd, hit return. Add breakpoints from the gdb command line, etc.
If you have harvey running on real hardware, follow the same process as above, but at (2.3) connect via port 1666 - target remote <machine-ip>:1666