DCSIMG
C++,Debugging - All Your Base Are Belong To Us

All Your Base Are Belong To Us

Mostly .NET internals and other kinds of gory details

Browse by Tags

All Tags » C++ » Debugging (RSS)
Slides from the First Jerusalem .NET/C++ Meeting
Last Tuesday we hosted the first meeting of the Jerusalem .NET/C++ User Group . I forgot to take pictures, but we were a nice group of hardcore C++ developers eager to learn about the new C++ 11 features, debugging C++ code in production, and some memory management tricks relevant for C++ real-time applications. As promised, below are the presentations from the event. My presentation on C++11 covers lambdas, auto variables, rvalue references and even touches briefly on the subject of variadic templates...
Debugging Optimized Code in Visual Studio 11
Executive summary: When using the Windows debugger engine to debug optimized C++ code compiled with Visual Studio 11 you can step into inline functions and see local variables that are stored in CPU registers. The current (Visual Studio 2010 compiler) state of affairs is that compiler optimizations are way smarter than the debugger engine, which lacks the information necessary to map a fully optimized binary back to the source code in a reliable manner. This is why C++ developers don’t like debugging...
SELA Developer Days 2011 - C++ Debugging
I’m keeping up with the updates from the SELA Developer Days conference. Yesterday our classes were full to the brim with attendees – some of the sessions delivered were Parallel Programming in .NET 4.0 , Introduction to Windows Phone 7 , and a feature-packed day on TFS 2010 and Visual Studio 2010 . I delivered yesterday a session on C++ debugging , in which we covered the following topics: How to read x86 and x64 assembly listings created by the C/C++ compilers How to match debugging symbols to...
.NET Debugging and C++ Debugging Resources
The following is a summary of tools and resources that you might be interested in after taking the .NET Debugging and/or C++ Debugging courses we offer at Sela. [Shameless plug: If you haven’t taken these courses yet, I strongly suggest that you check them out. Between the two of them they have more than 20 hands-on debugging exercises which basically guarantee that you’re going to come out a WinDbg expert and be able to analyze dumps, solve problems in production, pinpoint memory leaks, and so on...
Pure Virtual Function Call: Repro Code
A few days ago I demonstrated a debugging scenario where one thread attempts to call a virtual function on an object whose destructor is running on another thread . The base destructor restores the virtual function table to that of the base class, which causes the other thread to call a pure virtual function. The code that I used to reproduce this scenario is really simple, but it’s not (at least for me :-)) immediately evident from reading it that this bug is lurking in the shadows. Here’s the code...
Pure Virtual Function Call (Destructor Madness)
How badly, on a scale of 1 to 10, do you like this error message? Not the friendliest one to see, I bet, when you’re trying to make your way through a day without calling any pure virtual functions… Well, a pure virtual function call is not a rare thing to see in the C++ world, and there are numerous reasons for something like this to happen, not the least of which being calling a pure virtual method from the base class’ constructor . In this post we’re going to see something slightly less traditional...
More on Converting Native Exceptions to Managed Exceptions
Shortly after publishing my last post on converting native (C++ or Win32) exceptions to managed exceptions , I realized that some clarifications are in place. Trapping every Win32 exception and indiscriminately translating it to a managed exception is extremely dangerous.   There are various scenarios in which a native exception is thrown to be caught, processed and handled – interfering with this process through a vectored exception handler might result in disastrous consequences. For example...
Converting Win32 and C++ Exceptions to Managed Exceptions
In a layered application consisting of managed upper layers and unmanaged lower implementation layers, you might frequently encounter the need to call unmanaged code, handle any exceptional conditions and reflect them to the upper layers as managed exceptions. This can be done manually, but fortunately as of Windows XP there is an approach that does not require wrapping every unmanaged call in an exception handler.  This approach is vectored exception handling . A vectored exception handler...
Native Debugging Walk-Through Set
I gave a 3-hour presentation today on C++ debugging techniques, with a focus on production debugging.  I’d like to share with you the demos I’ve shown during the session with a brief walkthrough so that you can repeat what I did in class.  (I have intentionally omitted the debugger spew and any screenshots so that this still remains somewhat of an interesting challenge.) First of all, download the demo solution (30KB), unzip and open with Visual Studio 2008 (the code should work on Visual...