generating tracebacks for first chance exceptions

Recently I was debugging some workflow where it appeared quite slow. As part of debugging i saw it Visual Studio printed debugging information about first chance exceptions thrown.

Now that David Kline from MS has made it ample clear that FirstChance exceptions are normal exceptions just that debugger gets first chance at them- thus first chance. If debugger chooses not to do anything then application gets a chance to do something about it. If application does not handle it then debugger gets a second chance, thus second chance exceptions. you get the idea.

Now an application can throw as many exceptions it wants and catch it later. This is fine but exceptions are supposed to exceptional and cost quite a bit. (link1 & link2)

I have seen lexical_cast being the one that throws exceptions just to parse strings, with xml parsing this could be a big source of exceptions. One of the ways to speed up applications is now to fix or atleast reason about these exceptions being thrown, and having tracebacks makes life lot easier.

[Read More]

memory corruption WideCharToMultiByte

Recently I have been debugging some memory corruption that happened only after something executed 64 times, free complained that memory has been corrupted. Thus started the usual process of debugging. I started ApplicationVerifier and set the application and enabled the basic checks.

Application Verifier- Basic Checks

Application Verifier- Basic Checks

Soon my application started failing with access violation during startup, this happened even before I reached the code where memory was corrupted. Now I have two problems to investigate. This time I was crashing with call to WideCharToMultiByte. Started debugging to see exactly where it was failing:

  ntdll.dll!RtlUnicodeToUTF8N() Unknown
  KernelBase.dll!WideCharToMultiByte() Unknown
  vfbasics.dll!000007fef081cd0c() Unknown
> heapcorruption.exe!dllNotificationFunction(unsigned long NotificationReason, const _LDR_DLL_NOTIFICATION_DATA * NotificationData, void * Context) Line 64 C++
  ntdll.dll!string "Enabling heap debug options\n"() Unknown
  ntdll.dll!LdrpFindOrMapDll() Unknown
  ntdll.dll!LdrpLoadDll() Unknown
  ntdll.dll!LdrLoadDll() Unknown
  vfbasics.dll!000007fef08074de() Unknown
  KernelBase.dll!LoadLibraryExW() Unknown
  heapcorruption.exe!main() Line 94 C++
  heapcorruption.exe!invoke_main() Line 75 C++

[Read More]

over to hugo

Have been using octopress for a while now, but one thing i dont like is it’s reliance on ruby and time it takes to regenerate. Found that hugo is much better at these. Earlier site regeneration used to take ~5 minutes now happens in ~.2 seconds! Thus came the attraction of moving over- but as i found i am not the first to do so. I have read various posts and these are my steps to port it over:

The best part is no more rubydevkit and gem/bundler installs, what a big relief

[Read More]

C# yaml config

yaml is pretty good way to define config for an application rather than xml file. There are many libraries available for parsing yaml in C#. Two of the libraries i tried are: yamlconfig and sharpyaml. I liked the general concept behind yamlconfig but it wasn’t that good to just integrate and get started, so I chose sharpyaml over it. The thing I liked about sharpyaml is how easy it is to get it going, I did not had much success with yamlconfig. [Read More]