previous page
next page

Debugging

COM_INTERFACE_ENTRY_BREAK

Sometimes you need to debug your QueryInterface implementation. Maybe you're building a custom COM_MAP macro. Maybe you're seeing weird behavior on some interfaces. Sometimes the easiest way to track down a problem is in the debugger. This is where COM_INTERFACE_ENTRY_BREAK comes in:

#define COM_INTERFACE_ENTRY_BREAK(x) \
  { &_ATL_IIDOF(x), NULL, _Break },   

The _Break function outputs some helpful debugging information and calls DebugBreak:

static HRESULT WINAPI                                         
CComObjectRootbase::_Break(void*, REFIID iid, void**, DWORD) {
  (iid);                                                      
_ATLDUMPIID(iid, _T("Break due to QI for interface "), S_OK); 
  DebugBreak();                                               
  return S_FALSE;                                             
}                                                             

The call to DebugBreak is just like a breakpoint set in your debugger. It gives the active debugger the chance to take control of the process. When you're debugging, you can set other breakpoints and continue executing.


previous page
next page
Converted from CHM to HTML with chm2web Pro 2.75 (unicode)