Lines Matching refs:pSet
41 static void dvmBreakpointSetFree(BreakpointSet* pSet);
107 BreakpointSet* pSet = (BreakpointSet*) calloc(1, sizeof(*pSet));
109 dvmInitMutex(&pSet->lock);
112 return pSet;
118 static void dvmBreakpointSetFree(BreakpointSet* pSet)
120 if (pSet == NULL)
123 free(pSet->breakpoints);
124 free(pSet);
135 static void dvmBreakpointSetLock(BreakpointSet* pSet)
137 if (dvmTryLockMutex(&pSet->lock) != 0) {
140 dvmLockMutex(&pSet->lock);
148 static void dvmBreakpointSetUnlock(BreakpointSet* pSet)
150 dvmUnlockMutex(&pSet->lock);
156 static int dvmBreakpointSetCount(const BreakpointSet* pSet)
158 return pSet->count;
168 static int dvmBreakpointSetFind(const BreakpointSet* pSet, const u2* addr)
172 for (i = 0; i < pSet->count; i++) {
173 Breakpoint* pBreak = &pSet->breakpoints[i];
188 static bool dvmBreakpointSetOriginalOpcode(const BreakpointSet* pSet,
191 int idx = dvmBreakpointSetFind(pSet, addr);
195 *pOrig = pSet->breakpoints[idx].originalOpcode;
233 static bool dvmBreakpointSetAdd(BreakpointSet* pSet, Method* method,
238 int idx = dvmBreakpointSetFind(pSet, addr);
242 if (pSet->count == pSet->alloc) {
243 int newSize = pSet->alloc + kBreakpointGrowth;
248 /* pSet->breakpoints will be NULL on first entry */
249 newVec = (Breakpoint*)realloc(pSet->breakpoints, newSize * sizeof(Breakpoint));
253 pSet->breakpoints = newVec;
254 pSet->alloc = newSize;
257 pBreak = &pSet->breakpoints[pSet->count++];
297 pBreak = &pSet->breakpoints[idx];
311 static void dvmBreakpointSetRemove(BreakpointSet* pSet, Method* method,
315 int idx = dvmBreakpointSetFind(pSet, addr);
328 Breakpoint* pBreak = &pSet->breakpoints[idx];
342 if (idx != pSet->count-1) {
344 memmove(&pSet->breakpoints[idx], &pSet->breakpoints[idx+1],
345 (pSet->count-1 - idx) * sizeof(pSet->breakpoints[0]));
347 pSet->count--;
348 pSet->breakpoints[pSet->count].addr = (u2*) 0xdecadead; // debug
364 static void dvmBreakpointSetFlush(BreakpointSet* pSet, ClassObject* clazz)
367 for (i = 0; i < pSet->count; i++) {
368 Breakpoint* pBreak = &pSet->breakpoints[i];
396 BreakpointSet* pSet = gDvm.breakpointSet;
397 dvmBreakpointSetLock(pSet);
398 if (dvmBreakpointSetCount(pSet) != 0) {
399 ALOGW("WARNING: %d leftover breakpoints", dvmBreakpointSetCount(pSet));
402 dvmBreakpointSetUnlock(pSet);
421 BreakpointSet* pSet = gDvm.breakpointSet;
422 dvmBreakpointSetLock(pSet);
423 dvmBreakpointSetAdd(pSet, method, instrOffset);
424 dvmBreakpointSetUnlock(pSet);
439 BreakpointSet* pSet = gDvm.breakpointSet;
440 dvmBreakpointSetLock(pSet);
441 dvmBreakpointSetRemove(pSet, method, instrOffset);
442 dvmBreakpointSetUnlock(pSet);
458 BreakpointSet* pSet = gDvm.breakpointSet;
461 dvmBreakpointSetLock(pSet);
462 if (!dvmBreakpointSetOriginalOpcode(pSet, addr, &orig)) {
469 dvmBreakpointSetUnlock(pSet);
483 BreakpointSet* pSet = gDvm.breakpointSet;
485 if (pSet == NULL)
489 dvmBreakpointSetLock(pSet);
490 dvmBreakpointSetFlush(pSet, clazz);
491 dvmBreakpointSetUnlock(pSet);