我试图通过Windows调试器CDB在我附加的进程中调用C ++函数。
该功能定义为:
void LockerImpl<IsForMMAPV1>::dump() const { ... }
使用CDB命令
在CDB中找到符号如下x mongod!*dump
00007ff6`2d006be0 mongod!mongo::LockerImpl<0>::dump (void)
00007ff6`2d006640 mongod!mongo::LockerImpl<1>::dump (void)
x /v mongod!mongo::LockerImpl<0>::dump
prv func 00007ff6`cfcf6be0 597 mongod!mongo::LockerImpl<0>::dump (void)
x /v mongod!mongo::LockerImpl<1>::dump
prv func 00007ff6`cfcf6640 597 mongod!mongo::LockerImpl<1>::dump (void)
调用这些符号会产生错误:
.call /v mongod!mongo::LockerImpl<0>::dump()
无法解决错误!mongod!mongo :: LockerImpl&lt; 0&gt; :: dump()&#39;
我也尝试使用&#34;装饰名称&#34;来调用它,但结果相同。其他变化也失败了:
.call /v @!("mongod!mongo::LockerImpl<1>::dump()")
.call /v mongod!mongo::LockerImpl<0>::dump(mongod!mongo::`anonymous namespace'::globalLockManager)
无法解决“mongod!mongo :: LockerImpl&lt; 0&gt; :: dump(mongod!mongo ::`anonymous namespace&#39; :: globalLockManager)&#39;
我还试图传递globalLockManager实例的地址,即
u mongod!mongo::getGlobalLockManager
mongod!mongo::getGlobalLockManager [c:\data\mci\c286593757a3793e6b070bc761c736b0\src\src\mongo\db\concurrency\lock_state.cpp @ 940]:
00007ff6`cfcf76a0 488d0539b0e301 lea rax,[mongod!mongo::`anonymous namespace'::globalLockManager (00007ff6`d1b326e0)]
ln 0x00007ff6d1b326e0
(00007ff6`d1b326e0) mongod!mongo::`anonymous namespace'::globalLockManager | (00007ff6`d1b326f0) mongod!mongo::`anonymous namespace'::unusedLockCleaner
Exact matches:
使用globalLockManager实例地址调用它:
.call /v mongod!mongo::LockerImpl<0>::dump(0x00007ff6d1b326e0)
无法解决“mongod!mongo :: LockerImpl&lt; 0&gt; :: dump(0x00007ff6d1b326e0)&#39;
中的错误
其他类型的注释是:
typedef LockerImpl<false> DefaultLockerImpl;
typedef LockerImpl<true> MMAPV1LockerImpl;
注意,可以从Linux / GDB调用该函数,如下所示:
call ('mongo::(anonymous namespace)::globalLockManager').dump()