Lines Matching refs:state
119 u4 dvmJdwpNextRequestSerial(JdwpState* state) in dvmJdwpNextRequestSerial() argument
121 dvmDbgLockMutex(&state->serialLock); in dvmJdwpNextRequestSerial()
122 u4 result = state->requestSerial++; in dvmJdwpNextRequestSerial()
123 dvmDbgUnlockMutex(&state->serialLock); in dvmJdwpNextRequestSerial()
132 u4 dvmJdwpNextEventSerial(JdwpState* state) in dvmJdwpNextEventSerial() argument
134 dvmDbgLockMutex(&state->serialLock); in dvmJdwpNextEventSerial()
135 u4 result = state->eventSerial++; in dvmJdwpNextEventSerial()
136 dvmDbgUnlockMutex(&state->serialLock); in dvmJdwpNextEventSerial()
144 static void lockEventMutex(JdwpState* state) in lockEventMutex() argument
147 dvmDbgLockMutex(&state->eventLock); in lockEventMutex()
154 static void unlockEventMutex(JdwpState* state) in unlockEventMutex() argument
156 dvmDbgUnlockMutex(&state->eventLock); in unlockEventMutex()
186 JdwpError dvmJdwpRegisterEvent(JdwpState* state, JdwpEvent* pEvent) in dvmJdwpRegisterEvent() argument
188 lockEventMutex(state); in dvmJdwpRegisterEvent()
190 assert(state != NULL); in dvmJdwpRegisterEvent()
218 if (state->eventList != NULL) { in dvmJdwpRegisterEvent()
219 pEvent->next = state->eventList; in dvmJdwpRegisterEvent()
220 state->eventList->prev = pEvent; in dvmJdwpRegisterEvent()
222 state->eventList = pEvent; in dvmJdwpRegisterEvent()
223 state->numEvents++; in dvmJdwpRegisterEvent()
225 unlockEventMutex(state); in dvmJdwpRegisterEvent()
238 static void unregisterEvent(JdwpState* state, JdwpEvent* pEvent) in unregisterEvent() argument
242 assert(state->eventList == pEvent); in unregisterEvent()
244 state->eventList = pEvent->next; in unregisterEvent()
270 state->numEvents--; in unregisterEvent()
271 assert(state->numEvents != 0 || state->eventList == NULL); in unregisterEvent()
281 void dvmJdwpUnregisterEventById(JdwpState* state, u4 requestId) in dvmJdwpUnregisterEventById() argument
283 lockEventMutex(state); in dvmJdwpUnregisterEventById()
285 JdwpEvent* pEvent = state->eventList; in dvmJdwpUnregisterEventById()
288 unregisterEvent(state, pEvent); in dvmJdwpUnregisterEventById()
299 unlockEventMutex(state); in dvmJdwpUnregisterEventById()
305 void dvmJdwpUnregisterAll(JdwpState* state) in dvmJdwpUnregisterAll() argument
307 lockEventMutex(state); in dvmJdwpUnregisterAll()
309 JdwpEvent* pEvent = state->eventList; in dvmJdwpUnregisterAll()
313 unregisterEvent(state, pEvent); in dvmJdwpUnregisterAll()
318 state->eventList = NULL; in dvmJdwpUnregisterAll()
320 unlockEventMutex(state); in dvmJdwpUnregisterAll()
377 static JdwpEvent** allocMatchList(JdwpState* state) in allocMatchList() argument
379 return (JdwpEvent**) malloc(sizeof(JdwpEvent*) * state->numEvents); in allocMatchList()
386 static void cleanupMatchList(JdwpState* state, JdwpEvent** matchList, in cleanupMatchList() argument
399 unregisterEvent(state, pEvent); in cleanupMatchList()
461 static bool modsMatch(JdwpState* state, JdwpEvent* pEvent, ModBasket* basket) in modsMatch() argument
538 static void findMatchingEvents(JdwpState* state, JdwpEventKind eventKind, in findMatchingEvents() argument
544 JdwpEvent* pEvent = state->eventList; in findMatchingEvents()
546 if (pEvent->eventKind == eventKind && modsMatch(state, pEvent, basket)) in findMatchingEvents()
580 static void suspendByPolicy(JdwpState* state, JdwpSuspendPolicy suspendPolicy) in suspendByPolicy() argument
592 if (dvmDbgGetThreadSelfId() == state->debugThreadId) { in suspendByPolicy()
613 dvmJdwpSetWaitForEventThread(state, dvmDbgGetThreadSelfId()); in suspendByPolicy()
638 static bool invokeInProgress(JdwpState* state) in invokeInProgress() argument
654 void dvmJdwpSetWaitForEventThread(JdwpState* state, ObjectId threadId) in dvmJdwpSetWaitForEventThread() argument
659 dvmDbgLockMutex(&state->eventThreadLock); in dvmJdwpSetWaitForEventThread()
665 while (state->eventThreadId != 0) { in dvmJdwpSetWaitForEventThread()
667 state->eventThreadId, threadId); in dvmJdwpSetWaitForEventThread()
669 dvmDbgCondWait(&state->eventThreadCond, &state->eventThreadLock); in dvmJdwpSetWaitForEventThread()
675 state->eventThreadId = threadId; in dvmJdwpSetWaitForEventThread()
677 dvmDbgUnlockMutex(&state->eventThreadLock); in dvmJdwpSetWaitForEventThread()
683 void dvmJdwpClearWaitForEventThread(JdwpState* state) in dvmJdwpClearWaitForEventThread() argument
690 dvmDbgLockMutex(&state->eventThreadLock); in dvmJdwpClearWaitForEventThread()
692 assert(state->eventThreadId != 0); in dvmJdwpClearWaitForEventThread()
693 ALOGV("cleared event token (0x%llx)", state->eventThreadId); in dvmJdwpClearWaitForEventThread()
695 state->eventThreadId = 0; in dvmJdwpClearWaitForEventThread()
697 dvmDbgCondSignal(&state->eventThreadCond); in dvmJdwpClearWaitForEventThread()
699 dvmDbgUnlockMutex(&state->eventThreadLock); in dvmJdwpClearWaitForEventThread()
720 static void eventFinish(JdwpState* state, ExpandBuf* pReq) in eventFinish() argument
725 set4BE(buf+4, dvmJdwpNextRequestSerial(state)); in eventFinish()
730 dvmJdwpSendRequest(state, pReq); in eventFinish()
744 bool dvmJdwpPostVMStart(JdwpState* state, bool suspend) in dvmJdwpPostVMStart() argument
755 lockEventMutex(state); in dvmJdwpPostVMStart()
771 unlockEventMutex(state); in dvmJdwpPostVMStart()
777 dvmJdwpSetWaitForEventThread(state, threadId); in dvmJdwpPostVMStart()
779 eventFinish(state, pReq); in dvmJdwpPostVMStart()
781 suspendByPolicy(state, suspendPolicy); in dvmJdwpPostVMStart()
809 bool dvmJdwpPostLocationEvent(JdwpState* state, const JdwpLocation* pLoc, in dvmJdwpPostLocationEvent() argument
830 if (basket.threadId == state->debugThreadId) { in dvmJdwpPostLocationEvent()
845 if (invokeInProgress(state)) { in dvmJdwpPostLocationEvent()
852 lockEventMutex(state); in dvmJdwpPostLocationEvent()
854 JdwpEvent** matchList = allocMatchList(state); in dvmJdwpPostLocationEvent()
858 findMatchingEvents(state, EK_BREAKPOINT, &basket, matchList, in dvmJdwpPostLocationEvent()
861 findMatchingEvents(state, EK_SINGLE_STEP, &basket, matchList, in dvmJdwpPostLocationEvent()
864 findMatchingEvents(state, EK_METHOD_ENTRY, &basket, matchList, in dvmJdwpPostLocationEvent()
867 findMatchingEvents(state, EK_METHOD_EXIT, &basket, matchList, in dvmJdwpPostLocationEvent()
894 cleanupMatchList(state, matchList, matchCount); in dvmJdwpPostLocationEvent()
895 unlockEventMutex(state); in dvmJdwpPostLocationEvent()
901 dvmJdwpSetWaitForEventThread(state, basket.threadId); in dvmJdwpPostLocationEvent()
903 eventFinish(state, pReq); in dvmJdwpPostLocationEvent()
905 suspendByPolicy(state, suspendPolicy); in dvmJdwpPostLocationEvent()
919 bool dvmJdwpPostThreadChange(JdwpState* state, ObjectId threadId, bool start) in dvmJdwpPostThreadChange() argument
928 if (invokeInProgress(state)) { in dvmJdwpPostThreadChange()
938 lockEventMutex(state); in dvmJdwpPostThreadChange()
940 JdwpEvent** matchList = allocMatchList(state); in dvmJdwpPostThreadChange()
944 findMatchingEvents(state, EK_THREAD_START, &basket, matchList, in dvmJdwpPostThreadChange()
947 findMatchingEvents(state, EK_THREAD_DEATH, &basket, matchList, in dvmJdwpPostThreadChange()
972 cleanupMatchList(state, matchList, matchCount); in dvmJdwpPostThreadChange()
973 unlockEventMutex(state); in dvmJdwpPostThreadChange()
979 dvmJdwpSetWaitForEventThread(state, basket.threadId); in dvmJdwpPostThreadChange()
981 eventFinish(state, pReq); in dvmJdwpPostThreadChange()
983 suspendByPolicy(state, suspendPolicy); in dvmJdwpPostThreadChange()
995 bool dvmJdwpPostVMDeath(JdwpState* state) in dvmJdwpPostVMDeath() argument
1005 eventFinish(state, pReq); in dvmJdwpPostVMDeath()
1021 bool dvmJdwpPostException(JdwpState* state, const JdwpLocation* pThrowLoc, in dvmJdwpPostException() argument
1040 if (invokeInProgress(state)) { in dvmJdwpPostException()
1047 lockEventMutex(state); in dvmJdwpPostException()
1049 JdwpEvent** matchList = allocMatchList(state); in dvmJdwpPostException()
1052 findMatchingEvents(state, EK_EXCEPTION, &basket, matchList, &matchCount); in dvmJdwpPostException()
1095 cleanupMatchList(state, matchList, matchCount); in dvmJdwpPostException()
1096 unlockEventMutex(state); in dvmJdwpPostException()
1102 dvmJdwpSetWaitForEventThread(state, basket.threadId); in dvmJdwpPostException()
1104 eventFinish(state, pReq); in dvmJdwpPostException()
1106 suspendByPolicy(state, suspendPolicy); in dvmJdwpPostException()
1120 bool dvmJdwpPostClassPrepare(JdwpState* state, int tag, RefTypeId refTypeId, in dvmJdwpPostClassPrepare() argument
1134 if (invokeInProgress(state)) { in dvmJdwpPostClassPrepare()
1141 lockEventMutex(state); in dvmJdwpPostClassPrepare()
1143 JdwpEvent** matchList = allocMatchList(state); in dvmJdwpPostClassPrepare()
1146 findMatchingEvents(state, EK_CLASS_PREPARE, &basket, matchList, in dvmJdwpPostClassPrepare()
1159 if (basket.threadId == state->debugThreadId) { in dvmJdwpPostClassPrepare()
1187 cleanupMatchList(state, matchList, matchCount); in dvmJdwpPostClassPrepare()
1189 unlockEventMutex(state); in dvmJdwpPostClassPrepare()
1195 dvmJdwpSetWaitForEventThread(state, basket.threadId); in dvmJdwpPostClassPrepare()
1197 eventFinish(state, pReq); in dvmJdwpPostClassPrepare()
1199 suspendByPolicy(state, suspendPolicy); in dvmJdwpPostClassPrepare()
1213 bool dvmJdwpPostClassUnload(JdwpState* state, RefTypeId refTypeId) in dvmJdwpPostClassUnload() argument
1226 bool dvmJdwpPostFieldAccess(JdwpState* state, int STUFF, ObjectId thisPtr, in dvmJdwpPostFieldAccess() argument
1240 void dvmJdwpDdmSendChunkV(JdwpState* state, int type, const struct iovec* iov, in dvmJdwpDdmSendChunkV() argument
1262 set4BE(header+4, dvmJdwpNextRequestSerial(state)); in dvmJdwpDdmSendChunkV()
1276 dvmJdwpSendBufferedRequest(state, wrapiov, iovcnt+1); in dvmJdwpDdmSendChunkV()