Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
2.3 KiB

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