Commit e270ac42 authored by ussrhero's avatar ussrhero

fixed attachProcess

parent b1f6cdbe
......@@ -19,7 +19,7 @@ void uninitialize();
// manage debug target
PROCESS_DEBUG_ID startProcess(const std::wstring &processName, const ProcessDebugFlags& flags = ProcessDebugDefault);
PROCESS_DEBUG_ID attachProcess(PROCESS_ID pid);
PROCESS_DEBUG_ID attachProcess(PROCESS_ID pid, const ProcessDebugFlags& flags = ProcessDebugDefault);
void detachProcess( PROCESS_DEBUG_ID processId = -1);
void terminateProcess( PROCESS_DEBUG_ID processId = -1);
void detachAllProcesses();
......
......@@ -272,11 +272,13 @@ void terminateProcess( PROCESS_DEBUG_ID processId )
///////////////////////////////////////////////////////////////////////////////
PROCESS_DEBUG_ID attachProcess(PROCESS_ID pid)
PROCESS_DEBUG_ID attachProcess(PROCESS_ID pid, const ProcessDebugFlags& flags)
{
if ( !isInintilized() )
initialize();
setEngBreakOption(flags);
HRESULT hres;
hres = g_dbgMgr->client->AttachProcess( 0, pid, DEBUG_ATTACH_DEFAULT );
......
......@@ -46,12 +46,11 @@ public:
CloseHandle( processInfo.hProcess );
CloseHandle( processInfo.hThread );
Sleep(100);
return processInfo.dwProcessId;
}
virtual void TearDown() {
try {
kdlib::terminateAllProcesses();
......
......@@ -36,9 +36,11 @@ TEST_F( ProcessTest, StartProcess )
TEST_F( ProcessTest, AttachProcess )
{
PROCESS_ID pid = StartTargetappWithParam(L"processtest");
ASSERT_NE(0, pid);
PROCESS_DEBUG_ID id;
ASSERT_NO_THROW( id = attachProcess(pid) );
EXPECT_EQ(DebugStatusBreak, targetExecutionStatus());
EXPECT_NO_THROW( terminateProcess(id) );
EXPECT_EQ( 0, kdlib::getNumberProcesses() );
}
......@@ -46,9 +48,11 @@ TEST_F( ProcessTest, AttachProcess )
//TEST_F(ProcessTest, AttachProcessNoBreak)
//{
// PROCESS_ID pid = StartTargetappWithParam(L"processtest");
// ASSERT_NE(0, pid);
//
// PROCESS_DEBUG_ID id;
// ASSERT_NO_THROW(id = attachProcess(pid, ProcessDebugDefault & ~(ProcessBreakOnStart)));
// EXPECT_EQ(DebugStatusGo, targetExecutionStatus());
// EXPECT_NO_THROW(terminateProcess(id));
// EXPECT_EQ(0, kdlib::getNumberProcesses());
//}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment