| parrotcode: Debugging Parrot with Microsoft | |
| Contents | Documentation |

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.
/WallListen to your compiler.
/RTCcsu - Enables run-time error checkingThis 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 - Buffers security checkDetect some buffer overruns. See http://msdn2.microsoft.com/en-us/library/8dbf701c(VS.80).aspx.
/Wp64 - Detect 64-bit compatability problemsDon't use this one. Leave 64-bit checking to the real 64-bit compilers.
/D_DEBUG vs.
/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!
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.
/analyzeMicrosoft 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
TODO

TODO
http://www.microsoft.com/technet/prodtechnol/windows/appcompatibility/appverifier.mspx
TODO

TODO


Ronald Blaschke <ron@rblasch.org>
|
|
|