RunMode EventCallback::OnBreakpoint( DWORD uniquePid, uint32_t threadId, Address64 address, bool embedded ) { OutputDebugStringA( "EventCallback::OnBreakpoint\n" ); RefPtr<Program> prog; RefPtr<Thread> thread; RunMode runMode = RunMode_Break; if ( !mEngine->FindProgram( uniquePid, prog ) ) return RunMode_Run; if ( !prog->FindThread( threadId, thread ) ) return RunMode_Run; runMode = OnBreakpointInternal( prog, thread, address, embedded ); // If we stopped because of a regular BP before reaching the entry point, // then we shouldn't stop at the entry point // Test if we're at the entrypoint, in addition to whether we stopped, because // we could have decided to keep going even though we're at the entry point Address64 entryPoint = prog->GetEntryPoint(); if ( (entryPoint != 0) && ((runMode == RunMode_Break) || (address == entryPoint)) ) { prog->RemoveInternalBreakpoint( entryPoint, EntryPointCookie ); prog->SetEntryPoint( 0 ); } return runMode; }
bool EventCallback::OnBreakpoint( IProcess* process, uint32_t threadId, Address address, Enumerator<BPCookie>* iter ) { OutputDebugStringA( "EventCallback::OnBreakpoint\n" ); RefPtr<Program> prog; RefPtr<Thread> thread; bool stopped = false; if ( !mEngine->FindProgram( process->GetId(), prog ) ) return true; if ( !prog->FindThread( threadId, thread ) ) return true; stopped = !OnBreakpointInternal( prog, thread, address, iter ); // If we stopped because of a regular BP before reaching the entry point, // then we shouldn't stop at the entry point // Test if we're at the entrypoint, in addition to whether we stopped, because // we could have decided to keep going even though we're at the entry point if ( (mEntryPoint != 0) && (stopped || (address == mEntryPoint)) ) { prog->RemoveInternalBreakpoint( mEntryPoint, EntryPointCookie ); mEntryPoint = 0; } return !stopped; }