debugging library load issues on windows

gflags is quite a versatile tool for debugging all low level things. I have been using it in particular to debug heap and library load issues.

one can launch the gui, however i have preferred cmd line usage more often.

to enable library load debugging:

gflags -i <your-app.exe> +sls

[Read More]


Last time I coded peinfo, to get information from a PE file. It listed the guid for pdb file generated alongwith. This is helpful as it is, but at times you have pdb file and want to query it’s guid.

I did not find anything handy for it, thus ended up coding one myself. Here the Debug Interface Access SDK is of great help.

The idea is pretty simple and straight foward:

  1. Load PDB as DataSource, IDiaDataSource::LoadDataFromPdb (Line#72)
  2. Open Session, IDiaDataSource::openSession (Line#76)
  3. Get GlobalScope, IDiaSession::get_global_scope (Line#80)
  4. Get GUID, IDiaSymbol::get_guid (Line#84)

[Read More]

adding cmd in visual studio

One of the handy commands with VS IDE is to launch cmd, it was provided by default earlier but lately i have been missing it with VS 2015 & onwards.

While poking around i found that you could launch cmd as external tool:

[Read More]

github multiple accounts setup notes

key generation and registration

The way github identifies you is thru your ssh keys (public keys need to be registered at github & private keys live on your machine). The way to generate keys is to find ssh-keygen, it comes handy with git bash

[Read More]

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]