Monday, February 9, 2009

Testing Google Code Prettyfier

I'm testing using Google's code syntax highlighter. So here's a simple C++ function to see the results.

int fact(int n)
    // quickly return the simple terminal case
    if (n <= 1)
        return 1.0;

    return n * fact(n - 1);

Microsoft Visual C++ 2008 Redistributable

The KioskCrash executable in my last post was created using Microsoft Visual C++ 2008. I forgot to include links to the redistributable which needs to be installed on systems without VC++ 2008.

Sorry about that folks.

Wednesday, February 4, 2009

KioskCrash In the Wild!

I'm pleased to announced the release of KioskCrash v1.0.0. This is the sample application that crashes in a variety of repeatable and predictable ways. From this base I will be demonstrating how to capture diagnostic information from a crash and how to use that information to find and fix problems.

You can download the binary and source code at my Google Code project site. There is also a Subversion repository if you would rather use that. The most current source can be retrieved from:

You can see a screenshot of KioskCrash running above. Just type the number of the crash you wish to create and watch the fireworks. Below is the function that generates a read access violation. I create an invalid pointer to an integer and then try to read the value. The last three lines just display a message in the event our crash doesn't occur. It’s simple but my goal here isn’t to write pretty code to crash your system.

void generate_read_access_violation()
   int *bad = 0;
   int value = *bad;

   TCHAR msg[1024];
   StringCbPrintf(msg, sizeof(msg),
                  _T("The integer at address 0 is %d"), value);
   MessageBox(GetDesktopWindow(), msg, _T(__FUNCTION__),
              MB_OK | MB_ICONINFORMATION);

That’s all I have for this post. Next time I'll talk about what happens when an application crashes and what information we can gather to help with diagnosis.

Oh, tonight's beer is Bete Noel from Elysian Brewing. A very tasty Belgian style ale. The description from Elysian is:

The dark side of the holidays, as treacherous as its paler sister. Brewed with Maris-Otter pale, Weyermann Munich, Castle Aromatic and roasted barley and black malts, with amber Belgian candi sugar added to the kettle. Bittered with German Northern Brewer, finished with Czech Saaz hops and fermented with Belgian Golden Ale yeast.