ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

ReactOS Community > ReactOS Wiki

WinDbg Tutorial

From ReactOS

Jump to: navigation, search

WinDbg Quick-Start Guide

This is work in progress and probably has a lot of rough edges. Feel free to phrase more clearly or explain in more detail (preferably by linking to the appropriate pages)

Prerequisites

Steps

  1. build the kernel: nmake/nologo ntoskrnl
  2. build kdcom.dll: nmake/nologo kdcom -- preferably use the one from Windows 2003
  3. build any other modules you want to work on. I prefer having at least ntdll, and kernel32. nmake/nologo ntdll kernel32
  4. grab a trunk build. Usually the latest from http://www.reactos.org/getbuilds/ - or build one yourself
    • if you can mount or otherwise access your target machine's file system, you can simply run first (and second, if you don't want to do any debugging there) stage setup, then replace the files on the target disk with the ones you built above
    • alternatively, replace the corresponding files in the ISO
  5. now start WinDbg, and choose File->Kernel Debug (Ctrl+K)
  6. set up WinDbg according to how your target outputs its debug messages
    • to use a Pipe, check the Pipe option, set Port to \\.\Pipe\TheNameOfYourPipe
    • to use a com0com serial port, set Port to the name of the port, such as \\.\CNCA0
    • to use a physical serial port, set Baud Rate to 115200 and Port to the name of the port, such as \\.\COM1
  7. boot up the target, and select the ReactOS (Debug) boot menu entry
  8. enjoy debugging with WinDbg. Some tips:
    • break in with Tab+K works, just like with kdbg. This is useful since ROS sometimes doesn't react to WinDbg's break-in
    • kernel breakpoints mostly work. In userspace they're not always too reliable. Adding __debugbreak(); in the source makes sure you'll break in
    • with an MSVC-built ntdll and an MSVC-built xxx.dll, you should get complete backtraces from the kernel back to xxx.dll
    • check out the WinDbg page for some useful commands. The help is also really good