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.

No comments:

Post a Comment