DCSIMG
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 » Debugging (RSS)
Obtaining Reliable Thread Call Stacks of 64-bit Processes
The x64 calling convention is a great improvement over the state of affairs in x86. Few would argue about this. After all, remembering the differences between __stdcall and __cdecl , when to use each, which API defaults to which calling convention, and which specific variation of __fastcall JIT compilers use when given the choice -- is not the best use of developer time and not the best in terms of debugging productivity. With that said, the x64 calling convention often makes it very difficult to...
Two More Ways for Diagnosing For Which Synchronization Object Your Thread Is Waiting
It is as though there is an infinite variety of heuristics that you can use to determine which synchronization object your thread is waiting for. In fact, these are heuristics for retrieving fastcall parameters passed in registers that have been clobbered by subsequent method calls. Method 1: Inspect the handle passed to WaitForMultipleObjectsEx The CLR uses an auto-reset event to implement sync block synchronization, which means that every attempt to acquire an owned sync block will result in a...
Wish List for the Visual Studio Editor and Debugger: Drawing Inspiration from Other IDEs
One of the benefits of using more than one development platform, more than one IDE, and more than one debugger is that you gain a better understanding of what your personal ideal development workflow looks like. It might well be the case that no single tool provides every feature you're excited about, which is what I feel these days. Because Visual Studio is my long-time (since 1999) favorite IDE and debugger, here are some features from other tools I'd like to see integrated in Visual Studio...
Identify the User-Mode Drivers Loaded into a WUDFHost.exe Instance
Once upon a time, it was fairly challenging to determine which services were running in an individual svchost.exe process. Today, with Process Explorer, there’s nothing easier – just hover over the svchost.exe process and you get a list of services, or double-click an svchost.exe process and go to the Services tab: A similar problem can arise with user-mode drivers (UMDF). User-mode drivers are COM DLLs loaded into WUDFHost.exe processes, and some WUDFHost.exe processes may contain more than one...
Diagnosing Memory Leaks in Managed Windows Store Apps
There is so much material on the web (and even on this blog) about memory leak diagnostics in managed code, and a considerable number of tools that make diagnostics increasingly easier. Modern memory profilers can open application dumps, attach to live processes, display live memory graphs, compare snapshots, identify problematic retention patterns, and so much more. Unfortunately, these tools presently don’t work with Windows Store apps. Moreover, the UI model of Windows Store apps poses a significant...
Sync Block Diagnostics with PSSCor2 (or PSSCor4)
Alternative title: yet another another another way to determine the sync object for which your thread is waiting . I should make a series out of these posts, as there are at least four distinct approaches now. In case you haven’t seen them, PSSCor2 and PSSCor4 are WinDbg extensions that augment and extend SOS functionality for .NET 2.0 and 4.0 applications, respectively. They don’t ship with the .NET Framework (unlike SOS), but you can find them online. To the case in point, PSSCor2/4 provides a...
Running The Boot Camp Control Panel Applet from Windows 8 on MacBook Pro
As John Robbins repeatedly likes to say , Apple computers are the best hardware for running Windows. To quote, “a Mac Pro […] it's the best Windows machine money can buy”. After yesterday’s release of Windows 8 to MSDN subscribers, I went along and installed it on my new MacBook Pro. Everything went fine—the setup was blazingly fast, all drivers were successfully installed, except for the pesky Apple trackpad settings that were way off what a Windows user comes to expect. In case you don’t know...
Finalization Queue or F-Reachable Queue? SOSEX (Not So) New Commands
As Steve Johnson , the author of the awesome SOSEX debugging extension, pointed out in a comment on my last finalization post , as of SOSEX 4.0 you can use the !finq and !frq commands to inspect separately the finalization queue and the f-reachable queue. As a reminder, objects on the finalization queue are objects that are eligible for finalization but are still referenced by the application. These are objects for which finalizers will run at some point, but the GC has not passed them over to the...
Light Page Heap in Application Verifier
Page Heap is an extremely useful diagnostic option that you can enable for your Windows application using GFlags or Application Verifier . When Page Heap is enabled, each heap allocation is placed on the end of a page boundary, and the subsequent page is marked as PAGE_NOACCESS. Any buffer overruns are therefore immediately caught. While Page Heap is very useful, its cost is often too high for use in production applications. Fortunately, there is a more lightweight option, called (appropriately)...
Obtaining mscordacwks.dll for CLR Versions You Don’t Have
Note: This blog post assumes that you can capture and analyze managed dumps in WinDbg using SOS, and have encountered a bizarre technical problem when using dumps from a production environment. If this assumption is incorrect, feel free to peruse my .NET Debugging Resources link post . When debugging managed dumps in WinDbg, you will need to load the SOS version that is compatible with the CLR version in the dump. SOS, in turn, requires the CLR “data access DLL” (mscordacwks.dll), which is a debugging...
Setting Up an Offline Production Debugging Environment
If you’re doing production debugging in a closed environment—closed-down servers with no Internet access, or if you work at an institution that doesn’t have unrestricted Internet access from developer machines, this post will help you set up an offline production debugging environment. Incidentally, this post will also help if you’re going to host SELA’s .NET Debugging or C++ Debugging courses, and want to make sure your workstations are ready for the numerous hands-on labs. First and foremost, you...
The Case of The Unquoted Command Line: Process Monitor and MPGO.EXE
A few months ago I wrote about MPGO , a new Microsoft tool that ships with .NET 4.5 and enables profile-guided optimization of managed assemblies. Specifically, MPGO optimizes the layout of native images for managed assemblies, which reduces startup times, working set sizes, and page fault costs. Shameless plug: Pro .NET Performance has a large section dedicated to improving startup performance, and I’ve written about this before: Using Prefetch to improve startup performance , Rebasing and compression...
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...
Finalization Queue or F-Reachable Queue? Find Out with SOS
It’s 2012, so time for another post related to finalization. This so-often-abused CLR feature has popped up here in the past. A quick recap: You can’t trust the finalizer to ever execute Finalization order is not guaranteed You can create subtle race conditions by using objects that are simultaneously finalized You can end up with a memory leak if objects are created faster than the finalizer thread can run their finalizers This time, we’ll see how to determine whether a particular object is in the...
How Understanding Assembly Language Helps Debug .NET Applications [CodeProject]
A quick plug to let you know that I published today an article called How Understanding Assembly Language Helps Debug .NET Applications on CodeProject. It contains some scenarios previously covered on this blog and others that I worked on specifically for the article, and strives to explain why assembly language skills are beneficial even if you’re only working on .NET applications. Here’s the TOC: Analyzing a corrupted or incomplete call stack Correlate crash location to source code line Determine...
More Posts Next page »