本文整理汇总了C++中IDebugClient::AttachProcess方法的典型用法代码示例。如果您正苦于以下问题:C++ IDebugClient::AttachProcess方法的具体用法?C++ IDebugClient::AttachProcess怎么用?C++ IDebugClient::AttachProcess使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDebugClient
的用法示例。
在下文中一共展示了IDebugClient::AttachProcess方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: attachToProcess
static bool attachToProcess(JNIEnv* env, jobject obj, jint pid) {
if (setImageAndSymbolPath(env, obj) == false) {
return false;
}
IDebugClient* ptrIDebugClient = (IDebugClient*) env->GetLongField(obj,
ptrIDebugClient_ID);
CHECK_EXCEPTION_(false);
/***********************************************************************************
We are attaching to a process in 'read-only' mode. i.e., we do not want to
put breakpoints, suspend/resume threads etc. For read-only JDI and HSDB kind of
usage this should suffice. We are not intending to use this for full-fledged
ProcessControl implementation to be used with BugSpotAgent.
Please refer to DEBUG_ATTACH_NONINVASIVE mode source comments from dbgeng.h.
In this mode, debug engine does not call DebugActiveProrcess. i.e., we are not
actually debugging at all. We can safely 'detach' from the process anytime
we want and debuggee process is left as is on all Windows variants.
This also makes JDI-on-SA installation/usage simpler because with this we would
not need a tool like ServiceInstaller from http://www.kcmultimedia.com/smaster.
***********************************************************************************/
if (ptrIDebugClient->AttachProcess(0, pid, DEBUG_ATTACH_NONINVASIVE) != S_OK) {
THROW_NEW_DEBUGGER_EXCEPTION_("Windbg Error: AttachProcess failed!", false);
}
IDebugControl* ptrIDebugControl = (IDebugControl*) env->GetLongField(obj,
ptrIDebugControl_ID);
CHECK_EXCEPTION_(false);
if (ptrIDebugControl->WaitForEvent(DEBUG_WAIT_DEFAULT, INFINITE) != S_OK) {
THROW_NEW_DEBUGGER_EXCEPTION_("Windbg Error: WaitForEvent failed!", false);
}
return true;
}