2

Short and concise:

What are the actual differences between DIA (Debug Interface Access) and the DBGHELP libraries? I know that DIA is COM based and seems to be extremely powerful (as well as able to be used with managed and unmanaged processes), whereas the DBGHELP seems to be very convenient to use but offers less possibilites.

Can any one explain where these two have their differences and what can be done with the one but not with the other? I am really struggling with finding some full conclusive information on the internet :(

Sorry if this seems to be a dull question, and thanks to any answers you have for me! :)

Regards PuerNoctis

PuerNoctis
  • 1,364
  • 1
  • 15
  • 34

2 Answers2

2

DIA has consistent COM based interface. DbgHelp consist of a set of standard C functions.

Here two aricles I have written about DIA (with C++ Samples), that shows the power of DIA:

  1. Symbols File Locator
  2. How to Inspect the Content of a Program Database (PDB) File

When possible, use DIA and not DbgHelp, since DIA can be used by any COM-aware program.

mox
  • 6,084
  • 2
  • 23
  • 35
  • Thank you for the links! Funny thing: I have already had a glimpse at your articles just a few minutes ago ;) Another question: Is it true that DIA can be used to debug unmanaged as well as managed applications? – PuerNoctis Jun 11 '12 at 18:48
  • You are welcome! As mentioned, DIA is based on COM, that means unmanaged code. You can of course use bridges to consume DIA from a managed application. Since managed code includes full source code and does not use PDB symbols, I don't think that it fits to debug managed applications. – mox Jun 11 '12 at 18:55
  • Oh okay. I also found the "CLR Debugging API" in the meantime, which also provides COM interfaces to debug managed application (around the ICorDebug interfaces). Again thanks for your expertise so far! Now I know how DIA and DBGHELP correlate :) – PuerNoctis Jun 11 '12 at 19:02
0

It is the same thing. DbgHelp is the core api, it is usable from C. DIA is a COM object model on top of it that just makes it easier to use and makes it accessible from most any language. It is an acronym for Debug Interface Access, emphasis on "Access". The MSDN documentation for it starts here.

Hans Passant
  • 922,412
  • 146
  • 1,693
  • 2,536
  • Thanks! Are there "major" drawbacks from one to another that are worth mentioning? – PuerNoctis Jun 11 '12 at 18:41
  • You'll perceive whatever problem you'll run into first as a major drawback. I cannot guess what that will be. – Hans Passant Jun 11 '12 at 18:48
  • Okay, fair enough, I think that makes sense :) – PuerNoctis Jun 11 '12 at 18:49
  • "DIA is a COM object model on top of it that just makes it easier to use and makes it accessible from most any language" - Is this really true? So if I'm reading pdb files from C I might as well use DbgHelp? I was using DIA because I thought it was more powerful, but I would prefer not to have to use COM. – Stewart Lynch Nov 06 '12 at 13:15
  • 1
    I've checked this out, and it is the opposite, DbgHelp is actually a wrapper for DIA. see http://msdn.microsoft.com/en-us/magazine/cc301692.aspx – Stewart Lynch Nov 06 '12 at 21:27
  • No, you got that really backwards. As documented in the article, DbgHelp.dll is the core deliverable. Easy to see for yourself, run dumpbin.exe /exports on dbghelp.dll. – Hans Passant Nov 06 '12 at 21:43
  • a COM wrapper does not make things easier than a bundle of C functions! This kind of thinking is why post-mortem debugging of managed code is such a PitA! – gbjbaanb Jul 10 '14 at 15:12
  • Very strange rant. If you like a C interface better then just use that. Not that this does anything at all for managed code, DbgHelp and DIA are for native code. Managed code has its own interface, IDebugClient et al. No, not C functions :) – Hans Passant Jul 10 '14 at 15:30
  • This article also suggests that DbgHelp is implemented on top of DIA: https://blogs.msdn.microsoft.com/jmstall/2005/10/08/big-picture-on-symbol-apis/ – rpjohnst Sep 29 '16 at 22:13