void updateSegRegs(RegisterViewModel& model, const State& state) { static const QString sregs[]={"es","cs","ss","ds","fs","gs"}; for(std::size_t i=0;i<sizeof(sregs)/sizeof(sregs[0]);++i) { QString sreg(sregs[i]); const auto sregValue=state[sreg].value<edb::seg_reg_t>(); const Register base=state[sregs[i]+"_base"]; QString comment; if(edb::v1::debuggeeIs32Bit() || i>=FS) { if(base) comment=QString("(%1)").arg(base.valueAsAddress().toHexString()); else if(edb::v1::debuggeeIs32Bit() && sregValue==0) comment="NULL"; else comment="(?)"; } model.updateSegReg(i,sregValue,comment); } }
static int cmd_info(char*args){ unsigned char*res=NULL; char *arg=strtok(NULL," "); if(arg==NULL){ printf("No Argument!\n"); } if(strcmp(arg,"r")==0) { int i; /*output eip*/ res = (unsigned char*)(&cpu.eip); printf("eip:%02x %02x %02x %02x\n",*(res+3),*(res+2),*(res+1),*res); for(i=R_EAX;i<=R_EDI;i++) { res =(unsigned char*)(®_l(i)); printf("%s:%02x %02x %02x %02x\n",regsl[i],*(res+3),*(res+2),*(res+1),*res); } res = (unsigned char*)(&cpu.GDTR.base); printf("%s:%02x %02x %02x %02x","GDTR",*(res+3),*(res+2),*(res+1),*res); res = (unsigned char*)(&cpu.GDTR.limit); printf(" %02x %02x\n",*(res+1),*res); res = (unsigned char*)(&cpu.cr0.val); printf("%s:%02x %02x %02x %02x\n","CR0",*(res+3),*(res+2),*(res+1),*res); for(i = R_ES; i <= R_DS; i ++){ res = (unsigned char*)(&sreg(i)); printf("%s:%02x %02x\n",sregs[i],*(res + 1),*res); } printf("%s %s %s %s %s %s\n","OF","SF","ZF","AF","PF","CF"); printf("%2d %2d %2d %2d %2d %2d\n",cpu.OF,cpu.SF,cpu.ZF,cpu.AF,cpu.PF,cpu.CF); } else if(strcmp(arg,"w")==0) print_wp(); else printf("No Such Command!\n"); return 0; }
void init_spec(Environment env) { csreg("BLOCK", lt_block, req1rest); csreg("CATCH", lt_catch, req1rest); sreg("FSET", pkg_lt, lt_fset, req2); csreg("FUNCTION", lt_function, req1); csreg("GO", lt_go, req1); csreg("IF", lt_if, req2opt1); reg_inits(lt_if, "(nil)", NULL); csreg("LAMBDA", lt_lambda, req1rest); csreg("MK-MACRO", lt_mk_macro, req1rest); csreg("MULTIPLE-VALUE-CALL", lt_multiple_value_call, req1rest); csreg("MULTIPLE-VALUE-LIST", lt_multiple_value_list, req1); csreg("PROGN", lt_progn, rest); csreg("PROGV", lt_progv, req2rest); csreg("QUOTE", lt_quote, req1); csreg("RETURN-FROM", lt_return_from, req2); csreg("SETQ", lt_setq, rest); csreg("TAGBODY", lt_tagbody, rest); csreg("THROW", lt_throw, req2); }