Design overview of Prodebug

Development Environment and Languages Used
Concepts Involved
Module Description
Details on the debugger implementation

Development Environment and Languages Used

The code was developed on an intel 386 linux PC . Linux is a free OS , any one can download it off the web and use it . What's more it can run on the barest of hardware. Hence I chose linux over developing in dos and windows. (which require extensive support).
I have used C and assembly to code this. Assembly language is used primarily in the boot sector code ,interrupt handlers ,accessing the i386 structures like GDT , LDT etc. However a large part of the debugger is written in C.Because of the following reasons :
I have used nasm( a 32 bit freely available assembler ) and gcc (The infamous gnu C compiler ) to compile the code . Also sed is used to find some addresses of symbols in the kernel. These are standard tools that can be found on any linux distribution , and are downloadable from the net. To test the code , I have used a real PC and and an IA32 emulator called bochs.
All the tools used are public domain tools as they are freely available to anyone.More information abouthow to install them (if you don't already have them) and the forms they are available in (tarball archieve, rpm etc ) can be found from their respective home pages.

Concepts involved

To undersand the code , you need to understand a bit of the following :

Module Description

The debugger is chiefly composed of three main modules , namely
  1. Boot Up Module
  2. Kernel Proper
  3. Device Drivers
  4. Debugger Module
Their details are given below .

Bootup Module details

This resides in boot subdirectory. The bootup module composes of the following files :

Kernel Proper module details

This resides in kernel subdirectory. The kernel proper is incharge of initization and providing useful routines to the rest of the system. The following files are there in this modules :

Device drivers module

This is contained in the files like keyboard.cxx, floppy.cxx,timer.cxx in the kernel subdirectory. The int.s file in the same directory has the interrupt routines for floppy,timer,keyboard,debugger . All the interrupt routines do the following : These interrupts are initialized in initIDT() in idt.cxx.Note that the debugger interrupt is explained below.

Details on the debugger implementation

It consists of the debugger.c file in the kernel subdirectory and the int 1 handler in int.s.The debugger essentially consists of three peices of code , Launching of a user program :
When the user does a load program , the following things happen : Handling of a debugger interrupt in detail :
The doDebugerRoutine simply does a task switch to the saved kernel tss, this way the kernel resumes exactly where it left off , and later when the program eventually has to be run again , we just do task switch to the program TSS . Hence the program starts off by returning from the DoDebuggerInt routine , and the proceeds to complete the interrupt 1 . Note that the earlier saved context saved on the context may have been changed before it does an iret. (this is described above).