version 1.8, 2015/02/19 08:32:23
|
version 1.9, 2015/02/19 09:37:14
|
Line 61 Install the system in a virtual machine,
|
Line 61 Install the system in a virtual machine,
|
## Booting the VMs |
## Booting the VMs |
|
|
Next, start two qemu virtual machines, one to run the kernel being |
Next, start two qemu virtual machines, one to run the kernel being |
debugged (the "kgdb target") and another to run gdb (the "kgdb host"). |
debugged (the "target VM") and another to run gdb (the "gdb VM"). |
|
|
The two VMs could be run on separate physical machines, but in this |
The two VMs could be run on separate physical machines, but in this |
example, they are run on the same physical machine and share the same |
example, they are run on the same physical machine and share the same |
Line 69 hard disk image. This sharing is made p
|
Line 69 hard disk image. This sharing is made p
|
option to qemu, which ensures that the disk image is not written to by |
option to qemu, which ensures that the disk image is not written to by |
either VM. |
either VM. |
|
|
First start the kgdb target, enabling qemu's built-in GDB target stub |
First start the target VM, enabling qemu's built-in GDB target stub |
on TCP port 1234: |
on TCP port 1234: |
|
|
[[!template id=programlisting text=""" |
[[!template id=programlisting text=""" |
Line 80 If you don't want everyone on the Intern
|
Line 80 If you don't want everyone on the Intern
|
target, make sure incoming connections on port 1234 are blocked in |
target, make sure incoming connections on port 1234 are blocked in |
your firewall. |
your firewall. |
|
|
In a second terminal window, start the kgdb host: |
In a second terminal window, start the gdb VM: |
|
|
[[!template id=programlisting text=""" |
[[!template id=programlisting text=""" |
$ qemu-system-i386 -nographic -snapshot -hda work/wd0.img |
$ qemu-system-i386 -nographic -snapshot -hda work/wd0.img |
"""]] |
"""]] |
|
|
Log in to the kgdb host as root and set up the network: |
Log in to the gdb VM as root and set up the network: |
|
|
[[!template id=programlisting text=""" |
[[!template id=programlisting text=""" |
login: root |
login: root |
# dhcpcd |
# dhcpcd |
"""]] |
"""]] |
|
|
Start gdb on the kgdb host and connect to the target: |
Start gdb on the gdb VM and connect to the target: |
|
|
[[!template id=programlisting text=""" |
[[!template id=programlisting text=""" |
# gdb /netbsd |
# gdb /netbsd |
Line 101 Start gdb on the kgdb host and connect t
|
Line 101 Start gdb on the kgdb host and connect t
|
"""]] |
"""]] |
|
|
where my.host.name is the domain name or IP address of the |
where my.host.name is the domain name or IP address of the |
physical machine running the kgdb target qemu VM. |
host system. |
|
|
Now you should be able to get a stack trace and start debugging |
Now you should be able to get a stack trace and start debugging |
with full debug symbols and access to the source code: |
with full debug symbols and access to the source code: |