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.
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 Configure.pl, look at the CFLAGS in Makefile and then run perl Configure.pl --ccflags="..." with the new flags. Once done, consider saving your Configure call in a batch file so you have it available the next time.
perl Configure.pl
CFLAGS
perl Configure.pl --ccflags="..."
/Wall
Listen to your compiler.
/RTCcsu
This enables three different runtime checks: Conversion to smaller type, stacke frame and use of uninitialized local variable. See http://msdn2.microsoft.com/en-us/library/8wtf2dfz(VS.80).aspx.
/GS
Detect some buffer overruns. See http://msdn2.microsoft.com/en-us/library/8dbf701c(VS.80).aspx.
/Wp64
Don't use this one. Leave 64-bit checking to the real 64-bit compilers.
/D_DEBUG
/DNDEBUG
_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!
_DEBUG
NDEBUG
assert
_ASSERT
It's probably best to start with making sure that NDEBUG is not defined and enable the debugging C runtime later.
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 Configure.pl, look at C_LIBS in the Makefile and run perl Configure.pl --libs="..." with the new libs.
-MD
-MDd
C_LIBS
perl Configure.pl --libs="..."
/analyze
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 Configure.pl ^ --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" ^ %*
TODO
http://www.microsoft.com/whdc/devtools/debugging/default.mspx
http://www.microsoft.com/technet/prodtechnol/windows/appcompatibility/appverifier.mspx
http://msdn2.microsoft.com/en-us/library/k70yt3e2(VS.80).aspx
Ronald Blaschke <ron@rblasch.org>
To install Parrot::Op, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Parrot::Op
CPAN shell
perl -MCPAN -e shell install Parrot::Op
For more information on module installation, please visit the detailed CPAN module installation guide.