Introduction to the protected mode debugger
Capabilities and Salient Features
Starting up the debugger
Compiling it from the source
This is a bootable protected mode debugger for intel 386 class of processors, meaning that it can boot off a floppy into a protected mode environment and provide the user with a setup where he can debug his own code and also learn about the machine. It was made as a part of CSD course project .It can also be used as an educational demo for an operating system , since most of it is designed as a mini kernel.
Here are some of the salient features and capabilities it offers :
- Is bootable from a floppy into protected mode.
- The user can load his program from a floppy or can directly key in the hex code.
- It allows one to trace or run a program.
- It catches exceptions and faults thrown by the processor while running the user code, this helps in debugging greatly.A register dump is provided telling the user where exactly the fault occured.
- It provides a person with an interface similar to the debug dos program and has similar commands like to change registers,dump them,dump or fill memory , trace and run till a specified instruction.For a detailed listing , click here
- Implements scrolling , ie a person can scroll the screen to know past history.
The debugger shall work off a standard PC and doesn't need a color monitor.By a standard PC , I mean , a system having an intel 386 or higher processor ,a PS/2 keyboard,a 1.44 inch floppy drive.
It was tested on Pentium 4,on Bochs and on a real PC.
Since the debugger is deisgned to boot from a floppy , the first thing you have to do is to get the provided disk image on the downloads page. And then burn it onto a floppy , since this is a disk image unlike an ordinary file, you need to transfer to a floppy like this :
- In Linux dd if=<pathToImage> of=/dev/fd0 bs=1.
- In Windows: You can use the freely available RawWrite program to do this.(More instructions on how to use it can be found on its site.)
So far , so good, now you need to boot up your machine with this floppy you just created.The way to do this is to restart your machine.When the computer boots up , it will ask you to press F2 or Del key to enter setup , do so . Now in setup (this depends on which bios you have) choose the floppy to be the highest priority boot device.The PC will boot up again, this time from a floppy.
The debugger prompt shall then come up on the screen: (for screenshots ,click here).
Currently the source can be compiled only in linux , although since I have used pure ansi C and intel standard asm , it should theoretically compile even in windows.(Yes I am a linux freak!).
The entire source code can be found at the downloads page.Please take the latest version if you want the least no. of bugs and the maximum features. The source is in form of tar.gz archieve (tarball). To compile do the following:
. This will create the floppy image called prodebug.img in the prodebug directory. Note that you need nasm and gcc to compile the sources.Burn it onto the disk as detailed above
- tar zxf vXX.tar.gz : where vXX.tar.gz is the name of the downloaded archieve.This would create a directory called prodebug in your current directory.
- cd prodebug:Enter the prodebug directory