# Copyright (C) 2007, The Perl Foundation. # $Id: debugging_with_msvc.pod 20626 2007-08-14 20:59:42Z coke $ =head1 NAME docs/dev/debugging_with_msvc.pod - Debugging Parrot with Microsoft Visual C++ =head1 ABSTRACT This document describes how to get started with debugging on Microsoft Windows using Visual C++ 7 and later. =head1 DESCRIPTION =head2 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 C, look at the C in F and then run C with the new flags. Once done, consider saving your Configure call in a batch file so you have it available the next time. =head3 C Listen to your compiler. =head3 C - Enables run-time error checking This enables three different runtime checks: Conversion to smaller type, stacke frame and use of uninitialized local variable. See L. =head3 C - Buffers security check Detect some buffer overruns. See L. =head3 C - Detect 64-bit compatability problems I use this one. Leave 64-bit checking to the real 64-bit compilers. =head3 C vs. C C<_DEBUG> enables the use of the debugging versions of the runtime functions. C disables the debug function C. Beware that the Visual C++ specific assertion macro C<_ASSERT> is only enabled if C<_DEBUG> is defined! It's probably best to start with making sure that C is not defined and enable the debugging C runtime later. =head3 Debugging C runtime Two steps are necessary to use the debugging C runtime. First change the C<-MD> flag to C<-MDd>. This will implicitly define C<_DEBUG>. Often this is enough, but Parrot lists the libraries explicitly, so you'd need to replace F with F. For this, run C, look at C in the F and run C with the new libs. =head3 C 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 =head3 Examples 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" ^ %* =head2 Debugging Tools for Windows TODO L =head3 Examples TODO =head2 Microsoft Application Verifier TODO L =head3 Examples TODO =head2 Frequently Asked Questions TODO =head1 SEE ALSO =over =item Debugging Native Code L =back =head1 AUTHOR Ronald Blaschke =cut # vim: expandtab shiftwidth=2 textwidth=70: