Debugging with SmartInspect
Finding a bug frequently resembles the "needle in a haystack" drill. Multithreaded programs simply add more haystacks that you have to look in. The SmartInspect product provides several tools that let you quickly find where programs are having trouble.
|Figure 2. The Navigate Menu: The Navigate menu lets you jump right to an item of interest such as an error.|
Using the SmartInspect console is similar to the Visual Studio debugger but with some added features to help with tracking things down in multiple threads. Creating different views with filters makes it possible to examine just the information you need to see. A Navigate menu item lets you select from a list of possible log items to search for, as shown in Figure 2
. Stepping through these items happens by either clicking on a small icon that resembles a play button or by pressing the Ctrl and Right arrow buttons at the same time.
It can be useful to examine some piece of data as it passes through your program, depending on the nature of the bug you're trying to track down. You can log values at any point by sending a packet of information to either a log file or to the SmartInspect console for viewing.
SmartInspect divides program information into categories represented by classes. For example, the Session class contains a number of different methods including the generic Session.LogMessage, Session.LogObject and Session.LogSQL for logging generic information. Session is fully thread safe and returns data only when there is an active session.
|Figure 3. Data Viewer: The Data Viewer displays almost any type of logged information.|
The product also includes a host of more specific methods such as LogDecimal
and others for logging specific types of data. One thing that's a little lacking from a documentation perspective at this point is a good set of examples showing how each of the different methods could be used. There are some examples but just not enough.
After logging some data, you use the Data Viewer (see Figure 3
) from the console application to view it. The Data Viewer tool lets you examine any type of data your program has sent to the logger. There's also a floppy disk icon in the viewer that lets you save a copy of the data to disk should you need to.
When you try to evaluate whether a product is worth the cost, it's important to consider not just the price tag but how much your time is worth. A single-user license copy of SmartInspect will set you back $229. If you are writing software with multithreading, you will no doubt have to debug it at some point. Saving a few hours over the course of a week with this product will justify the cost in a short period of time.
An added benefit to this product is the ability to embed logging capabilities that can be enabled with a configuration change or by setting an option on a menu. Very few complex programs are 100% error free. Having the ability to turn on a logging feature with deployed software will make tracking those bugs you didn't catch during development and testing a whole lot easier.
SmartInspect isn't limited to .NET debugging; it also ships with libraries that work with Java or Delphi. You can try a fully-functional time-limited (45 days) trial version of SmartInspectto help you decide whether to buy.