Lines Matching refs:ctx
188 static void flush_hpsg_chunk(HeapChunkContext *ctx)
192 assert(ctx->buf <= ctx->pieceLenField &&
193 ctx->pieceLenField <= ctx->p);
194 set4BE(ctx->pieceLenField, ctx->totalAllocationUnits);
198 dvmDbgDdmSendChunk(ctx->type, ctx->p - ctx->buf, ctx->buf);
202 ctx->p = ctx->buf;
203 ctx->totalAllocationUnits = 0;
204 ctx->needHeader = true;
205 ctx->pieceLenField = NULL;
211 HeapChunkContext *ctx = (HeapChunkContext *)arg;
224 size_t bytesLeft = ctx->bufLen - (size_t)(ctx->p - ctx->buf);
226 flush_hpsg_chunk(ctx);
229 bytesLeft = ctx->bufLen - (size_t)(ctx->p - ctx->buf);
238 if (ctx->needHeader) {
244 set4BE(ctx->p, DEFAULT_HEAP_ID); ctx->p += 4;
247 *ctx->p++ = 8;
250 set4BE(ctx->p, (uintptr_t)chunkptr); ctx->p += 4;
253 set4BE(ctx->p, 0); ctx->p += 4;
259 ctx->pieceLenField = ctx->p;
260 set4BE(ctx->p, 0x55555555); ctx->p += 4;
262 ctx->needHeader = false;
276 bool native = ctx->type == CHUNK_TYPE("NHSG");
280 //TODO: if ctx.merge, see if this chunk is different from the last chunk.
330 ctx->totalAllocationUnits += chunklen;
332 *ctx->p++ = state | HPSG_PARTIAL;
333 *ctx->p++ = 255; // length - 1
336 *ctx->p++ = state;
337 *ctx->p++ = chunklen - 1;
360 HeapChunkContext ctx;
362 memset(&ctx, 0, sizeof(ctx));
363 ctx.bufLen = HPSx_CHUNK_SIZE;
364 ctx.buf = (u1 *)malloc(ctx.bufLen);
365 if (ctx.buf == NULL) {
369 ctx.merge = merge;
371 ctx.type = CHUNK_TYPE("NHSG");
373 if (ctx.merge) {
374 ctx.type = CHUNK_TYPE("HPSG");
376 ctx.type = CHUNK_TYPE("HPSO");
380 ctx.p = ctx.buf;
381 ctx.needHeader = true;
383 dlmalloc_walk_heap(heap_chunk_callback, (void *)&ctx);
385 dvmHeapSourceWalk(heap_chunk_callback, (void *)&ctx);
387 if (ctx.p > ctx.buf) {
388 flush_hpsg_chunk(&ctx);
391 free(ctx.buf);