How to use AfxDumpStack ?

Posted on 1999-12-20
Medium Priority
Last Modified: 2010-05-18
I would like to use the new stack tracing function. However when calling
the AfxDumpStack function, I only receive some "useless" information:

=== begin AfxDumpStack output ===
Loaded 'F:\Win32sdk\bin\MSPDB41.DLL', no matching symbolic information found.
Loaded 'C:\WINNT\system32\msvcrt40.dll', no matching symbolic information found.
Loaded symbols for 'C:\WINNT\system32\MSVCRT.DLL'
Loaded symbols for 'C:\WINNT\system32\MSVCIRT.DLL'
Error: 87
Error: 6 (MANY TIMES....)
77F67A6B: WINNT\System32\ntdll.dll! _NtOpenFile@24 + 15 bytes
00402C24: AES Prodata Projecten\Metrovias\logtest\Debug\logtest.exe! <no symbol>
00401948: AES Prodata Projecten\Metrovias\logtest\Debug\logtest.exe! <no symbol>
5F4374FC: WINNT\System32\MFC42D.DLL! Ordinal563 + 307 bytes
5F437C2B: WINNT\System32\MFC42D.DLL! Ordinal3657 + 628 bytes
5F43384B: WINNT\System32\MFC42D.DLL! Ordinal3658 + 36 bytes
5F42FB63: WINNT\System32\MFC42D.DLL! Ordinal3670 + 312 bytes
5F42ED65: WINNT\System32\MFC42D.DLL! Ordinal4118 + 83 bytes
5F42ECE8: WINNT\System32\MFC42D.DLL! Ordinal5076 + 46 bytes
5F42C889: WINNT\System32\MFC42D.DLL! Ordinal1045 + 237 bytes
5F42CD25: WINNT\System32\MFC42D.DLL! Ordinal1192 + 129 bytes
5F4905FD: WINNT\System32\MFC42D.DLL! Ordinal1193 + 74 bytes
77E72211: WINNT\system32\USER32.dll! _SendMessageWorker@20 + 157 bytes
77E7356C: WINNT\system32\USER32.dll! _ClientDrawState@40_684_5659@8_86alW@16 + 565 bytes
77E86E01: WINNT\system32\USER32.dll! _MDISetMenu@16 + 20 bytes
77E85F71: WINNT\system32\USER32.dll! _WaitForInputIdle@8 + 34 bytes
77E7124C: WINNT\system32\USER32.dll! _DispatchMessageWorker@8 + 115 bytes
77E754C9: WINNT\system32\USER32.dll! _CallNextHookEx@16 + 351 bytes
77E85FC2: WINNT\system32\USER32.dll! _GdiValidateHandle@4 + 2 bytes
5F432094: WINNT\System32\MFC42D.DLL! Ordinal4206 + 117 bytes
5F43381E: WINNT\System32\MFC42D.DLL! Ordinal4208 + 248 bytes
5F430C48: WINNT\System32\MFC42D.DLL! Ordinal5070 + 152 bytes
5F439343: WINNT\System32\MFC42D.DLL! Ordinal4215 + 85 bytes
5F4397AA: WINNT\System32\MFC42D.DLL! Ordinal4239 + 226 bytes
5F43229F: WINNT\System32\MFC42D.DLL! Ordinal4410 + 514 bytes
5F43469F: WINNT\System32\MFC42D.DLL! Ordinal1862 + 401 bytes
004013FA: AES Prodata Projecten\Metrovias\logtest\Debug\logtest.exe! <no symbol>
5F433623: WINNT\System32\MFC42D.DLL! Ordinal1190 + 131 bytes
004035A8: AES Prodata Projecten\Metrovias\logtest\Debug\logtest.exe! <no symbol>
004033B3: AES Prodata Projecten\Metrovias\logtest\Debug\logtest.exe! <no symbol>
77F1B9EA: WINNT\system32\KERNEL32.dll! _BasepAcquirePrivilege@8 + 310 bytes
00000000: WINNT\System32\ntdll.dll! <no symbol>
=== end AfxDumpStack() output ===

What does error 87 and the many errors 6 mean ? How can I become an interesting trace of my call stack ?
Question by:Gregory_seifert
  • 2
  • 2

Expert Comment

ID: 2295345
>>How can I become an interesting trace of my call stack ?

I think you want the Meta-Physics section of experts exchange
LVL 11

Accepted Solution

mikeblas earned 200 total points
ID: 2295470
1) You need symbols.

2) You need the Windows NT 4.0 version of IMAGEHLP.DLL. You can copy it to Win98 and Win95 machines, if you want.

AfxDumpStack() has never been tested for backward compatibility like that; if you have an old symbol format lying around, IMAGEHLP.DLL and MSPDB60.DLL must both be capable of talking with eachother and handling the symbol format you're throwing at 'em.  That's certainly not the case for MSPDB41.DLL; that's an ancient version of the PDB helper library--but it's the one you're loading.

"Error 87" indicates that SymLoadModule() failed with an invalid parameter. "Error 6" indicates that the file SymLoadModule() tried to find couldn't be found.

Undoubtedly, these failures are at least partially because you're using the wrong version of MSPDB*.DLL.

..B ekiM

Author Comment

ID: 2297088
After testing I do have different results (error 998) so I suppose you're way is the correct to follow.

However,Thanks to Microsofts great version control in Windows NT (...) I just can't find the matching files needed.

Can you tell me where you've found the information above ? Where do the error code explenations come from ? What is the complete list of DLLs, ... needed to become the correct symbolic information ?

Gregory Seifert

LVL 11

Expert Comment

ID: 2298408
> However,Thanks to Microsofts great version control
 > in Windows NT (...) I just can't find the matching files needed.

Huh?  What version control is involved here? The MSPDB60.DLL file doesn't need much version control, since the version number is baked into the file name!

Also, I don't see how disdainful comments help anybody.

 > Can you tell me where you've found the information above ?

The compatibility of AfxDumpStack is discussed in the READMEVC.HTM file that's on your product CD.

 > Where do the error code explenations come from ?

You can look for them manually in the WINERROR.H header file. Or, you can use the ErrorLook tool in the Tools menu of the Visual C++ IDE.

 > What is the complete list of DLLs, ... needed
 > to become the correct symbolic information ?

MSPDB60.DLL and IMAGEHLP.DLL from Windows NT.

..B ekiM

Author Comment

ID: 2299821
It seems the explanation of my problem can be found in Microsoft documents indeed:

"AfxDumpStack Does Not Dump Readable Symbols from an MFC Application
If you issue the AfxDumpStack(AFX_STACK_DUMP_TARGET_DEFAULT) function from an MFC application and then run the debug version of the program in the debugger, you will see symbols such as:
      5F43729C: WINNT\System32\MFC42D.DLL! Ordinal563 + 307 bytes
rather than a stack trace, which is what you would expect. This will be fixed in the next version of Visual C++."

and :

"AfxDumpStack API Will Not Work until NT 5.0 Beta 2
The MFC function AfxDumpStack will work correctly only on Windows NT 5.0 Beta 2 or later. Once this OS version is released, you can get imagehlp.dll from your NT installation and use it on other OS installations to get the functionality of AfxDumpStack to work correctly."

As it concerns visual C++6 with service pack 3 already installed, I suppose I'll just have to wait (and use my own old stackdump object) ?

Featured Post

[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

601 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question