docs/dev/debugging_with_msvc.pod - Debugging Parrot with Microsoft Visual C++


This document describes how to get started with debugging on Microsoft Windows using Visual C++ 7 and later.

Compiler Options

Probably the easiest way to get going with debugging is to add some compiler options. One way to go about this is to run perl, look at the CFLAGS in Makefile and then run perl --ccflags="..." with the new flags. Once done, consider saving your Configure call in a batch file so you have it available the next time.


Listen to your compiler.

/RTCcsu - Enables run-time error checking

This enables three different runtime checks: Conversion to smaller type, stacke frame and use of uninitialized local variable. See

/GS - Buffers security check

Detect some buffer overruns. See

/Wp64 - Detect 64-bit compatibility problems

Don't use this one. Leave 64-bit checking to the real 64-bit compilers.


_DEBUG enables the use of the debugging versions of the runtime functions. NDEBUG disables the debug function assert. Beware that the Visual C++ specific assertion macro _ASSERT is only enabled if _DEBUG is defined!

It's probably best to start with making sure that NDEBUG is not defined and enable the debugging C runtime later.

Debugging C runtime

Two steps are necessary to use the debugging C runtime. First change the -MD flag to -MDd. This will implicitly define _DEBUG. Often this is enough, but Parrot lists the libraries explicitly, so you'd need to replace MSVCRT.lib with MSVCRTd.lib. For this, run perl, look at C_LIBS in the Makefile and run perl --libs="..." with the new libs.


Microsoft added more static source code analysis to the their compiler, but this is only available with certain editions. If not supported you'll see the following warning.

  cl : Command line warning D9040 : ignoring option '/analyze'; Code
  Analysis warnings are not available in this edition of the compiler 


Here's an example how the new Configure call might look like.

  perl ^
      --ccflags="-nologo -Wall -MDd -Zi -Od -GS -RTCcsu -DWIN32 -D_CONSOLE" ^
      --linkflags="-nologo -nodefaultlib -machine:x86 -debug -incremental:no" ^
      --ldflags="-nologo -nodefaultlib -machine:x86 -debug -incremental:no" ^
      --libs="kernel32.lib ws2_32.lib msvcrtd.lib oldnames.lib" ^

Debugging Tools for Windows




Microsoft Application Verifier




Frequently Asked Questions



Debugging Native Code


Ronald Blaschke <>