简体   繁体   中英

How to watch a CMap (CArray) object, based on its memory address

I'm still working with the same script, I mentioned in this other StackOverflow post .
General idea:

  • open a dumpfile, using a script
  • view the memory addresses of all variables
  • try to get some information

This time the dt function seems to be failing on a CMap object:

dt <application_name>!CMap<int,int,CUIntArray * __ptr64,CUIntArray * __ptr64> m_nCount 000000eab8748430
Ambiguous matches found for <application_name>!CMap<int,int,CUIntArray * __ptr64,CUIntArray * __ptr64> (dumping largest sized):
<application_name>!CMap<int,int,CUIntArray * __ptr64,CUIntArray * __ptr64>::~CMap<int,int,CUIntArray * __ptr64,CUIntArray * __ptr64>
<application_name>!CMap<int,int,CUIntArray * __ptr64,CUIntArray * __ptr64>::CMap<int,int,CUIntArray * __ptr64,CUIntArray * __ptr64> {0x02b bytes}

In order to solve this, I tried to open the object in Visual Studio watch-window, but this seems to be failing, regardless of what I try:

(CMap<int,int,CUIntArray * __ptr64,CUIntArray * __ptr64>)0x000000eab8748430 => identifier "sCMap..." is undefined
(CMap)0x000000eab8748430 => identifier "CMap" is undefined
(<application_name>!CMap<int,int,CUIntArray * __ptr64,CUIntArray * __ptr64>)0x000000eab8748430 => identifier "<application_name>" is undefined
(mfc110u!CMap<int,int,CUIntArray * __ptr64,CUIntArray * __ptr64>)0x000000eab8748430 => identifier "mfc110u" is undefined
...

However this way of working seems to be working for other MFC classes, like CStringArray :

(CStringArray*)0x000000eab87c6d10 => this is giving good results

Does anybody know how I can show a CMap (or CArray ) object in Visual Studio's watch-window, based on its memory address?

It seems that the debugger has problems with the CMap definition, and by removing the __ptr64 entries from the type definition (mind the space at the beginning of __ptr64 ), I can see the content of the variable:

(CMap<int,int,CUIntArray *,CUIntArray *>*) 0x000000eab8748430

I believe there is a bug in the debugger :-)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM