void DumpHeap(void) { uint32 free_list_ptr = *(uint32*)(&corehelp->heap_free_list_ptr); uint32 alloc_list_ptr = *(uint32*)(&corehelp->heap_alloc_list_ptr); struct block_t *free_blk = (struct block_t*)ReadDword(free_list_ptr); struct block_t *alloc_blk = (struct block_t*)ReadDword(alloc_list_ptr); printf("free_list = %08x -> %08x\n", free_list_ptr, (uint32)free_blk); printf("alloc_list = %08x -> %08x\n", alloc_list_ptr, (uint32)alloc_blk); while (1) { if (free_blk && (free_blk < alloc_blk)) { DumpBlock("free ", free_blk); free_blk = (struct block_t*)ReadDword((uint32)&free_blk->next); } else if (alloc_blk) { DumpBlock("alloc", alloc_blk); alloc_blk = (struct block_t*)ReadDword((uint32)&alloc_blk->next); } else { break; } } // DumpMemory(0xf1000000, 16384); }
static void DumpCSymbolStruct(csymbol *cs, DumpState *D) { csymbol_struct *csst = csym_struct(cs); DumpBlock(cs, sizeof(csymbol), D); /* dump csymbol index for argument types */ DumpBlock(csst->members, csst->memb_nr*sizeof(struct_member), D); }
static void DumpCSymbolFunc(csymbol *cs, DumpState *D) { csymbol_func *csf = csym_func(cs); DumpBlock(cs, sizeof(csymbol), D); /* dump csymbol index for argument types */ DumpBlock(csf->arg_ids, csf->arg_nr*sizeof(int), D); }
static void DumpCSymbols(DumpState *D) { int i, cs_nr; cp_csymbol_state *cs_state; csymbol *cs, *cs_arr; cs_state = ctype_get_csym_state(); cs_arr = cs_state->cs_arr; cs_nr = cs_state->cs_nr; if (!cs_arr || cs_nr == 0) { DumpInt(0, D); return; } /* dump number of csymbols */ DumpInt(cs_nr, D); /* dump size of csymbol, for safty check in vm */ DumpInt(sizeof(csymbol), D); for (i = 0; i < cs_nr; i++) { cs = &cs_arr[i]; switch (cs->type) { case FFI_FUNC: DumpCSymbolFunc(cs, D); break; case FFI_STRUCT: DumpCSymbolStruct(cs, D); break; default: DumpBlock(cs, sizeof(csymbol), D); break; } } }
void uffs_DumpDevice(struct uffs_DeviceSt *dev, dump_msg_cb *dump) { int i; for (i = dev->par.start; i <= dev->par.end; i++) { DumpBlock(dev, i, dump); } }
static void DumpHeader(DumpState *D) { u8 h[KTAPC_HEADERSIZE]; kp_header(h); DumpBlock(h, KTAPC_HEADERSIZE, D); }
static void DumpCode(TProtoFunc* tf, FILE* D) { int size=CodeSize(tf); if (NotWord(size)) fprintf(stderr,"luac: warning: " "\"%s\":%d code too long for 16-bit machines (%d bytes)\n", fileName(tf),tf->lineDefined,size); DumpLong(size,D); DumpBlock(tf->code,size,D); }
static void DumpHeader(TProtoFunc* Main, FILE* D) { real t=TEST_NUMBER; fputc(ID_CHUNK,D); fputs(SIGNATURE,D); fputc(VERSION,D); fputc(sizeof(t),D); fputc(ID_NUMBER,D); DumpBlock("\x0A\xBF\x17",3,D); //Instead TEST_NUMBER, it dumps the same sequence found in GF scripts }
static void DumpString(TString* s, DumpState* D) { if (s==NULL || getstr(s)==NULL) DumpSize(0,D); else { size_t size=s->tsv.len+1; /* include trailing '\0' */ DumpSize(size,D); DumpBlock(getstr(s),size,D); } }
static void DumpString(const ktap_string *s, DumpState *D) { if (s == NULL) { int size = 0; DumpVar(size, D); } else { int size = s->tsv.len + 1; /* include trailing '\0' */ DumpVar(size, D); DumpBlock(getstr(s), size * sizeof(char), D); } }
static void DumpString(const TString* s, void* D) { if (s==NULL || s->str==NULL) DumpSize(0,D); else { size_t size=s->len+1; /* include trailing '\0' */ DumpSize(size,D); DumpBlock(s->str,size,D); } }
static void DumpString(char* s, FILE* D) { int n=strlen(s)+1; if ((Word)n != n) { fprintf(stderr,"luac: string too long: \"%.32s...\"\n",s); exit(1); } DumpWord(n,D); DumpBlock(s,n,D); }
static void DumpCode(const Proto *f, DumpState* D) { DumpInt(f->sizecode,D); char buf[10]; int i; for (i=0; i<f->sizecode; i++) { memcpy(buf,&f->code[i],sizeof(Instruction)); MaybeByteSwap(buf,sizeof(Instruction),D); DumpBlock(buf,sizeof(Instruction),D); } }
/** * Block Dump (read) * \param iMci Controller number. */ static void BlockDump(uint8_t iMci) { sSdCard *pSd = &sdDrv[iMci]; uint32_t block; DumpSeperator(); printf("-!- Input block:"); if (GetDecInput(5, &block)) { return; } printf("\n\r-I- Dump Block %d: %d\n\r", (int)block, MMCT_ReadFun(pSd, block, 1, pBuffer)); DumpBlock(pBuffer, block); }
static void DumpString(const TString* s, DumpState* D) { if (s==NULL || getstr(s)==NULL) { strsize_t size=0; DumpSize(size,D); } else { strsize_t size=( strsize_t )s->tsv.len+1; /* include trailing '\0' */ DumpSize(size,D); DumpBlock(getstr(s),size,D); } }
static void DumpString(const TString* s, DumpState* D) { if (s==nullptr || getstr(s)==nullptr) { size_t size=0; DumpVar(size,D); } else { size_t size=s->tsv.len+1; /* include trailing '\0' */ DumpVar(size,D); DumpBlock(getstr(s),size,D); } }
static void DumpString(const LuaString* s, DumpState* D) { if (s==NULL) { size_t size=0; DumpVar(size,D); } else { size_t size=s->getLen()+1; /* include trailing '\0' */ DumpVar(size,D); DumpBlock(s->c_str(),size*sizeof(char),D); } }
void DumpFunction(TFunc* tf, FILE* D) { lastF=tf; ThreadCode(tf->code,tf->code+tf->size); fputc(ID_FUN,D); DumpSize(tf->size,D); DumpWord(tf->lineDefined,D); if (IsMain(tf)) DumpString(tf->fileName,D); else DumpWord(tf->marked,D); DumpBlock(tf->code,tf->size,D); DumpStrings(D); }
static void DumpString(const TString* s, DumpState* D) { if (s==NULL) { lu_int32 size=0; DumpUInt(size,D); } else { size_t size=s->tsv.len+1; /* include trailing '\0' */ if (size>0xFFFFFFFFUL) error(D,"string is too long"); DumpUInt((lu_int32)size,D); DumpBlock(getstr(s),size*sizeof(char),D); } }
static void DumpString(const TString* s, DumpState* D) { if (s==NULL || getstr(s)==NULL) { // LOOM: This was using size_t whereas the LoadString in undump is using in32_t, this // will break bytecode compiled under 64 bit int32_t size=0; DumpVar(size,D); } else { // LOOM: This was using size_t whereas the LoadString in undump is using in32_t, this // will break bytecode compiled under 64 bit int32_t size=s->tsv.len+1; /* include trailing '\0' */ DumpVar(size,D); DumpBlock(getstr(s),size,D); } }
static void DumpHeader(DumpState* D) { char buf[LUAC_HEADERSIZE]; char *h=buf; /* This code must be kept in sync wiht luaU_header */ memcpy(h,LUA_SIGNATURE,sizeof(LUA_SIGNATURE)-1); h+=sizeof(LUA_SIGNATURE)-1; *h++=(char)LUAC_VERSION; *h++=(char)LUAC_FORMAT; *h++=(char)D->target.little_endian; *h++=(char)D->target.sizeof_int; *h++=(char)D->target.sizeof_strsize_t; *h++=(char)sizeof(Instruction); *h++=(char)D->target.sizeof_lua_Number; *h++=(char)D->target.lua_Number_integral; DumpBlock(buf,LUAC_HEADERSIZE,D); }
task main() { initializeRobot(); //waitForStart(); MovetoIR(); DumpBlock(); BackToStart(); Turn90(Left); GoInches(InchesToTape, DRIVE_SPEED); Turn90(Right); GoInches(InchesToRamp, DRIVE_SPEED); StopMotors(); // Wait for FCS to stop us. while (true) { } }
static void DumpHeader(DumpState* D) { char h[LUAC_HEADERSIZE]; luaU_header(h); DumpBlock(h,LUAC_HEADERSIZE,D); }
static void DumpNumber(lua_Number x, DumpState* D) { DumpBlock(&x,sizeof(x),D); }
static void DumpSize(size_t x, DumpState* D) { DumpBlock(&x,sizeof(x),D); }
static void DumpInt(int x, DumpState* D) { DumpBlock(&x,sizeof(x),D); }
static void DumpByte(int y, DumpState* D) { char x=(char)y; DumpBlock(&x,sizeof(x),D); }
static void DumpNumber(Number x, void* D) { DumpBlock(&x,sizeof(x),D); }
static void DumpWord(int i, FILE* D) { byte out[2]; WRITE_BE_UINT16(out, i); DumpBlock(out,2,D); }
static void DumpLong(long i, FILE* D) { byte out[4]; WRITE_BE_UINT32(out, i); DumpBlock(out,4,D); }