windows-nt/Source/XPSP1/NT/base/boot/debug.txt

58 lines
2.2 KiB
Plaintext
Raw Normal View History

2020-09-26 03:20:57 -05:00
Q: How do i build the boot loader for debugging?
A: There are several things you must do.
First, you must set the ENABLE_LOADER_DEBUG environment variable
in your build window. The var must be set to a string that specifies
the necessary debug settings for the machine that will be debugged.
Example: ENABLE_LOADER_DEBUG=debugport=com1##debugbaudrate=115200
Note the use of the '##' character. The NT make files replace all
spaces in macro definitions with new lines, so you must use the
'##' character to specify that you REALLY want a space. The above
example enables the kernel debugger in the boot loader and sets the
debug port to COM1 and the speed of the debug port to a baud rate
of 115200.
Another thing you must consider is the resulting size of the loader
binary. The file must be kept below the 256k size or the loader will
hang your machine. One may that you can expload the file size is
my disabling optimizations during compilation. When you clean build
the BOOT directory your MSC_OPTIMIZATION variable must be set to
nothing. This enables optimizations and results in the smallest file
size possible. If you need to disable optimizations because of
debugging, you must do it selectivly. This means clean building the
boot loader with optimizations enabled and then set MSC_OPTIMIZATION=/Odi
for the compilation of selective files. Just be caureful to not
build to much of the boot loader this way or it will quickly grow
too large.
If you want to build the loader as a "free" build, but also get full
symbolic information for the debugger then use the following build
settings:
set NTDEBUG=ntsdnodbg
set NTDEBUGTYPE=windbg
set MSC_OPTIMIZATION=
set NTDBGFILES=1
set ENABLE_LOADER_DEBUG=debugport=com1##debugbaudrate=115200
This will result in a free loader, with a dbg file containing full
symbolic information that can be used by i386kd/alphakd or even
by windbg for full source level debugging.
Addendum:
The following setting tells the loader to stop after loading symbols.
set ENABLE_LOADER_DEBUG=debugport=com1##debugbaudrate=115200##DEBUGSTOP
DbgPrint?
To get the loader to link, you need to also build ntos\rtl with the
ENABLE_LOADER_DEBUG flag set, otherwise DbgPrint will be unresolved.