Kernel Debugging: Difference between revisions

Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content deleted Content added
Combuster (talk | contribs)
Rough import from osfaq
 
Frank (talk | contribs)
Line 29: Line 29:
There are a number of virtual machines that can simulate x86 machines, my favorite is Bochs
There are a number of virtual machines that can simulate x86 machines, my favorite is Bochs
(http://bochs.sourceforge.net). Bochs is capable of setting breakpoints in any kind of software
(http://bochs.sourceforge.net). Bochs is capable of setting breakpoints in any kind of software
(even if it is compiled without debugging info!), and provides an additional "debugging =out=
(even if it is compiled without debugging info!), and provides an additional "debugging <tt>out</tt>
port" you can easily access from within your kernel code to print debug messages.
port" you can easily access from within your kernel code to print debug messages.


Line 40: Line 40:
For example, you don't have to reboot to test your new OS, you just start the VM.
For example, you don't have to reboot to test your new OS, you just start the VM.


Another virtual machine called Simics (https://www.simics.net) is capable not only of breakpoints and displaying register information, but it is also capable of opening a port for use with debugging with DDD (the simics command is 'gdb-remote'). Using this combination, it is possible to see your C source code as you step through the OS! However, the Bochs virtual machine is much faster at executing the OS than Simics and thus serves as a better virtual machine to _run_ the OS, while Simics is the better _debugger_ for those hard to find problems.
Another virtual machine called Simics (https://www.simics.net) is capable not only of breakpoints and displaying register information, but it is also capable of opening a port for use with debugging with DDD (the simics command is 'gdb-remote'). Using this combination, it is possible to see your C source code as you step through the OS! However, the Bochs virtual machine is much faster at executing the OS than Simics and thus serves as a better virtual machine to ''run'' the OS, while Simics is the better ''debugger'' for those hard to find problems.


== Using a serial null-modem between GDB and your OS ==
== Using a serial null-modem between GDB and your OS ==