Debug stack overflow on querying COM interface with WinDbg in x64

  atl, c++, com, direct3d, windbg

I have a crash dump and I want to debug it with WinDbg to find out the core issue. I found out that the issue is a stack overflow exception and it was thrown by QueryInterface function somewhere inside DirectX.

This is what WinDbg shows me with !analyze -v command:

SYMBOL_NAME:  d3d11!ATL::AtlInternalQueryInterface+ee
IMAGE_NAME:  d3d11.dll
STACK_COMMAND:  .ecxr ; ~~[0x2b58]s ; .frame 0 ; ~90s ; .ecxr ; kb
FAILURE_BUCKET_ID:  NOSOS_STACK_OVERFLOW_c00000fd_d3d11.dll!ATL::AtlInternalQueryInterface
OS_VERSION:  10.0.19041.1
BUILDLAB_STR:  vb_release
OSNAME:  Windows 10
FAILURE_ID_HASH:  {eb1c8dcd-22f9-5af4-ba70-5a620edef000}
Followup:     MachineOwner

These are the first frames of a thread crashed:

00 d3d11!ATL::AtlInternalQueryInterface+0xee
01 d3d11!CLayeredObject<NDXGI::CResource>::QueryInterface+0x96
02 d3d11!ATL::AtlInternalQueryInterface+0xa3
03 MyModule!GetTextureDesc+0x7e

And this is the source code for MyModule!GetTextureDesc function:

inline D3D11_TEXTURE2D_DESC GetTextureDesc( IUnknown* obj, ID3D11Texture2D** outtex ) {
    D3D11_TEXTURE2D_DESC desc = {};     
>   CComQIPtr<ID3D11Texture2D> tex( obj );

How can I go further with that? I’ve already tried Microsoft’s doc on debugging a stack overflow exception:

But looks like it’s not applicable to x64 and I can’t find something similar for x64 applications.

Source: Windows Questions C++