Duane,

We disable optimization for debugging frequently.  In your project's DSC file, 
add /Od to the [BuildOptions] for Microsoft compilers or the appropriate option 
for GCC.  It will cause problems if you put it in individual INF files.

The libraries built as part of StdLib require different build options because 
many of them are defining functions that the compilers "know" about and provide 
"intrinsic" replacements for.  This "knowledge" has to be disabled, with /Oi-, 
before the functions can actually be defined.  Also, some libraries must be 
built with LTCG turned off.

Applications, in AppPkg, should not have to specify special build options.  
Some demo or test applications turn off intrinsics to be sure that the 
functions defined in StdLIb are being used instead of the compiler intrinsics.

There are NO functions specified by ISO/IEC 9899:199409 that are not 
implemented in StdLib.  This includes abs() and memcpy().

A typical way of debugging (albeit IA32 only) is to build your application as 
part of the NT32 emulation.  Then run the emulation, and run the Visual Studio 
IDE.  Set any initial breakpoints then use the Debug->Attach to process option 
to attach to SecMain.exe.  You can then run your application which will stop at 
the first breakpoint you set.  Debugging from there on is fairly straight 
forward.

Make sure that you define EMULATION.  This is part of the StdLib boilerplate 
code that you appended to your Nt32Pkg.dsc file.

Also, add /Od to the compiler flags and you will be set to go.

Daryl McDaniel


From: Duane Voth [mailto:[email protected]]
Sent: Thursday, March 07, 2013 3:16 PM
To: [email protected]
Subject: [edk2] can we disable optimizations?

Tried today to change the VS2008 compile options from the variety of values 
(/Oi- /O1bi2s etc.) to /Od and ran into several issues.  (1) is that there 
isn't one place where we can set a single optimization value.  But it looks 
like StdLib libs and AppPkg apps actually require different levels of 
optimizations as various intrinsic functions (like abs and memcpy) are not 
implemented - thus requiring the compiler to provide them.  Has anyone managed 
to disable VS2008 optimizations in EDK2?

Why would I try this?  Various stack dump utilities I have claim to be able to 
understand un-optimized MSC++ stack frames and they arn't working.  The 
suggestion was made to try to disable optimization.

So I reverted all my .inf file changes and then got this:

c:\.....\edk2\stdlib\libc\gdtoa\strtodg.c(628) : warning C4700:
uninitialized local variable 'rv' used

which is treated as an error and causes the build to fail.  So, (2) has anyone 
seen this problem in strtodg?

------------------------------------------------------------------------------
Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester  
Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the  
endpoint security space. For insight on selecting the right partner to 
tackle endpoint security challenges, access the full report. 
http://p.sf.net/sfu/symantec-dev2dev
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to