您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ r_strbuf_init函数代码示例

51自学网 2021-06-02 11:13:17
  C++
这篇教程C++ r_strbuf_init函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中r_strbuf_init函数的典型用法代码示例。如果您正苦于以下问题:C++ r_strbuf_init函数的具体用法?C++ r_strbuf_init怎么用?C++ r_strbuf_init使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了r_strbuf_init函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: analop

static int analop(RAnal *a, RAnalOp *op, ut64 addr, const ut8 *buf, int len) {	csh handle;	cs_insn *insn;	int mode, n, ret;	mode = CS_MODE_BIG_ENDIAN;	if (!strcmp (a->cpu, "v9"))		mode |= CS_MODE_V9;	ret = cs_open (CS_ARCH_XCORE, mode, &handle);	op->type = R_ANAL_OP_TYPE_NULL;	op->size = 0;	op->delay = 0;	r_strbuf_init (&op->esil);	if (ret == CS_ERR_OK) {		cs_option (handle, CS_OPT_DETAIL, CS_OPT_ON);		// capstone-next		n = cs_disasm (handle, (const ut8*)buf, len, addr, 1, &insn);		if (n<1) {			op->type = R_ANAL_OP_TYPE_ILL;		} else {			op->size = insn->size;			switch (insn->id) {			case XCORE_INS_DRET:			case XCORE_INS_KRET:			case XCORE_INS_RETSP:				op->type = R_ANAL_OP_TYPE_RET;				break;			case XCORE_INS_DCALL:			case XCORE_INS_KCALL:			case XCORE_INS_ECALLF:			case XCORE_INS_ECALLT:				op->type = R_ANAL_OP_TYPE_CALL;				op->jump = INSOP(0).imm;				break;			/* ??? */			case XCORE_INS_BL:			case XCORE_INS_BLA:			case XCORE_INS_BLAT:			case XCORE_INS_BT:			case XCORE_INS_BF:			case XCORE_INS_BU:			case XCORE_INS_BRU:				op->type = R_ANAL_OP_TYPE_CALL;				op->jump = INSOP(0).imm;				break;			case XCORE_INS_SUB:			case XCORE_INS_LSUB:				op->type = R_ANAL_OP_TYPE_SUB;				break;			case XCORE_INS_ADD:			case XCORE_INS_LADD:				op->type = R_ANAL_OP_TYPE_ADD;				break;			}		}		cs_free (insn, n);		cs_close (&handle);	}	return op->size;}
开发者ID:raulsiles,项目名称:radare2,代码行数:60,


示例2: bf_op

static int bf_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *buf, int len) {	ut64 dst = 0LL;	if (op == NULL)		return 1;	/* Ayeeee! What's inside op? Do we have an initialized RAnalOp? Are we going to have a leak here? :-( */	memset (op, 0, sizeof (RAnalOp)); /* We need to refactorize this. Something like r_anal_op_init would be more appropiate */	r_strbuf_init (&op->esil);	op->size = 1;	switch (buf[0]) {	case '[': op->type = R_ANAL_OP_TYPE_CJMP;		  op->fail = addr+1;		  {			 const ut8 *p = buf + 1;			 int lev = 0, i = 1;			 while (*p && i<len) {				 if (*p == '[')					 lev++;				 if (*p == ']') {					 lev--;					 if (lev==-1) {						 dst = addr + (size_t)(p-buf);						 op->jump = dst;						 r_strbuf_setf (&op->esil,							"if (!*ptr) pc=0x%"PFMT64x, dst);						 break;					 }				 }				 p++;				i++;			 }		  }	// ?1[ptr],pc=${NEW_PC	break;	case ']': op->type = R_ANAL_OP_TYPE_UJMP; break;	case '>': op->type = R_ANAL_OP_TYPE_ADD;		r_strbuf_set (&op->esil, "ptr++");		break;	case '<': op->type = R_ANAL_OP_TYPE_SUB;		r_strbuf_set (&op->esil, "ptr--");		break;	case '+': op->type = R_ANAL_OP_TYPE_ADD;		r_strbuf_set (&op->esil, "*ptr++");		break;	case '-': op->type = R_ANAL_OP_TYPE_SUB;		r_strbuf_set (&op->esil, "*ptr--");		break;	case '.': op->type = R_ANAL_OP_TYPE_STORE;		r_strbuf_set (&op->esil, "=*ptr");		break;	case ',': op->type = R_ANAL_OP_TYPE_LOAD; break;	case 0x00:	case 0xff:		op->type = R_ANAL_OP_TYPE_TRAP; break;	default: op->type = R_ANAL_OP_TYPE_NOP; break;	}	return op->size;}
开发者ID:yd0str,项目名称:radare2,代码行数:57,


示例3: R_NEW0

R_API RAnalOp *r_anal_op_new () {	RAnalOp *op = R_NEW0 (RAnalOp);	if (!op) return NULL;	op->addr = UT64_MAX;	op->jump = UT64_MAX;	op->fail = UT64_MAX;	op->ptr = UT64_MAX;	op->val = UT64_MAX;	r_strbuf_init (&op->esil);	return op;}
开发者ID:m-emerson,项目名称:radare2,代码行数:11,


示例4: R_NEW

R_API RAnalOp *r_anal_op_copy (RAnalOp *op) {	RAnalOp *nop = R_NEW (RAnalOp);	*nop = *op;	nop->mnemonic = strdup (op->mnemonic);	nop->src[0] = r_anal_value_copy (op->src[0]);	nop->src[1] = r_anal_value_copy (op->src[1]);	nop->src[2] = r_anal_value_copy (op->src[2]);	nop->dst = r_anal_value_copy (op->dst);	r_strbuf_init (&nop->esil);	r_strbuf_set (&nop->esil, r_strbuf_get (&op->esil));	return nop;}
开发者ID:commiebstrd,项目名称:radare2,代码行数:12,


示例5: R_NEW0

R_API RAnalOp *r_anal_op_new () {	RAnalOp *op = R_NEW0 (RAnalOp);	if (op) {		op->addr = -1;		op->jump = -1;		op->fail = -1;		op->ptr = -1;		op->val = -1;		r_strbuf_init (&op->esil);	}	return op;}
开发者ID:commiebstrd,项目名称:radare2,代码行数:12,


示例6: opex

static void opex(RStrBuf *buf, csh handle, cs_insn *insn) {	int i;	r_strbuf_init (buf);	r_strbuf_append (buf, "{");	cs_m68k *x = &insn->detail->m68k;	r_strbuf_append (buf, "/"operands/":[");	for (i = 0; i < x->op_count; i++) {		cs_m68k_op *op = &x->operands[i];		if (i > 0) {			r_strbuf_append (buf, ",");		}		r_strbuf_append (buf, "{");		switch (op->type) {		case M68K_OP_REG:			r_strbuf_append (buf, "/"type/":/"reg/"");			r_strbuf_appendf (buf, ",/"value/":/"%s/"", cs_reg_name (handle, op->reg));			break;		case M68K_OP_IMM:			r_strbuf_append (buf, "/"type/":/"imm/"");			r_strbuf_appendf (buf, ",/"value/":%"PFMT64d, op->imm);			break;		case M68K_OP_MEM:			r_strbuf_append (buf, "/"type/":/"mem/"");			if (op->mem.base_reg != M68K_REG_INVALID) {				r_strbuf_appendf (buf, ",/"base_reg/":/"%s/"", cs_reg_name (handle, op->mem.base_reg));			}			if (op->mem.index_reg != M68K_REG_INVALID) {				r_strbuf_appendf (buf, ",/"base_reg/":/"%s/"", cs_reg_name (handle, op->mem.index_reg));			}			if (op->mem.in_base_reg != M68K_REG_INVALID) {				r_strbuf_appendf (buf, ",/"base_reg/":/"%s/"", cs_reg_name (handle, op->mem.in_base_reg));			}			r_strbuf_appendf (buf, ",/"in_disp/":%"PFMT64d"", op->mem.in_disp);			r_strbuf_appendf (buf, ",/"out_disp/":%"PFMT64d"", op->mem.out_disp);			r_strbuf_appendf (buf, ",/"disp/":%"PFMT64d"", (st64)op->mem.disp);			r_strbuf_appendf (buf, ",/"scale/":%"PFMT64d"", (st64)op->mem.scale);			r_strbuf_appendf (buf, ",/"bitfield/":%"PFMT64d"", (st64)op->mem.bitfield);			r_strbuf_appendf (buf, ",/"width/":%"PFMT64d"", (st64)op->mem.width);			r_strbuf_appendf (buf, ",/"offset/":%"PFMT64d"", (st64)op->mem.offset);			r_strbuf_appendf (buf, ",/"index_size/":%"PFMT64d"", (st64)op->mem.index_size);			break;		default:			r_strbuf_append (buf, "/"type/":/"invalid/"");			break;		}		r_strbuf_append (buf, "}");	}	r_strbuf_append (buf, "]}");}
开发者ID:das-labor,项目名称:radare2,代码行数:49,


示例7: analop

static int analop(RAnal *a, RAnalOp *op, ut64 addr, const ut8 *buf, int len) {	csh handle = 0;	cs_insn *insn = NULL;	int mode = (a->bits==16)? CS_MODE_THUMB: CS_MODE_ARM;	int n, ret;	mode |= (a->big_endian)? CS_MODE_BIG_ENDIAN: CS_MODE_LITTLE_ENDIAN;	ret = (a->bits==64)?		cs_open (CS_ARCH_ARM64, mode, &handle):		cs_open (CS_ARCH_ARM, mode, &handle);	cs_option (handle, CS_OPT_DETAIL, CS_OPT_ON);	op->type = R_ANAL_OP_TYPE_NULL;	op->size = (a->bits==16)? 2: 4;	op->delay = 0;	op->jump = op->fail = -1;	op->addr = addr;	op->ptr = op->val = -1;	op->refptr = 0;	r_strbuf_init (&op->esil);	if (ret == CS_ERR_OK) {		n = cs_disasm (handle, (ut8*)buf, len, addr, 1, &insn);		if (n<1) {			op->type = R_ANAL_OP_TYPE_ILL;		} else {			op->size = insn->size;			if (a->bits == 64) {				anop64 (op, insn);			} else {				anop32 (op, insn);			}			if (a->decode) {				analop_esil (a, op, addr, buf, len, &handle, insn);			}			cs_free (insn, n);		}		cs_close (&handle);	}	return op->size;}
开发者ID:AnwarMohamed,项目名称:radare2,代码行数:39,


示例8: bcl_op

static int bcl_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *buf, int len) {	int i;	char cache[256] = {0};	ut64 dst = 0LL;	if (op == NULL)		return 1;	int base = *buf & 3;	memset (op, 0, sizeof (RAnalOp));	r_strbuf_init (&op->esil);	op->size = 1;	if (*buf == 0) {		op->type = R_ANAL_OP_TYPE_NOP;		return 0;	}	switch (base) {	case 0:		op->type = R_ANAL_OP_TYPE_CJMP;		op->jump = addr + findpair (addr, buf, len, 3);		op->fail = addr + 1;		r_strbuf_setf (&op->esil, "A,++=");		break;	case 1:		op->type = R_ANAL_OP_TYPE_CJMP;		op->jump = addr + findpair(addr, buf, len, 2);		op->fail = addr + 1;		r_strbuf_setf (&op->esil, "C,++=");		break;	case 2:		op->type = R_ANAL_OP_TYPE_CMP;		r_strbuf_setf (&op->esil, "G,++=");		break;	case 3:		op->type = R_ANAL_OP_TYPE_MOV;		r_strbuf_setf (&op->esil, "T,++=");		break;	}	return op->size;}
开发者ID:Maijin,项目名称:radare2-extras,代码行数:38,


示例9: opex

static void opex(RStrBuf *buf, csh handle, cs_insn *insn) {	int i;	r_strbuf_init (buf);	r_strbuf_append (buf, "{");	cs_sysz *x = &insn->detail->sysz;	r_strbuf_append (buf, "/"operands/":[");	for (i = 0; i < x->op_count; i++) {		cs_sysz_op *op = &x->operands[i];		if (i > 0) {			r_strbuf_append (buf, ",");		}		r_strbuf_append (buf, "{");		switch (op->type) {		case SYSZ_OP_REG:			r_strbuf_append (buf, "/"type/":/"reg/"");			r_strbuf_appendf (buf, ",/"value/":/"%s/"", cs_reg_name (handle, op->reg));			break;		case SYSZ_OP_IMM:			r_strbuf_append (buf, "/"type/":/"imm/"");			r_strbuf_appendf (buf, ",/"value/":%"PFMT64d, op->imm);			break;		case SYSZ_OP_MEM:			r_strbuf_append (buf, "/"type/":/"mem/"");			if (op->mem.base != SYSZ_REG_INVALID) {				r_strbuf_appendf (buf, ",/"base/":/"%s/"", cs_reg_name (handle, op->mem.base));			}			r_strbuf_appendf (buf, ",/"index/":%"PFMT64d"", (st64) op->mem.index);			r_strbuf_appendf (buf, ",/"length/":%"PFMT64d"", (st64) op->mem.length);			r_strbuf_appendf (buf, ",/"disp/":%"PFMT64d"", (st64) op->mem.disp);			break;		default:			r_strbuf_append (buf, "/"type/":/"invalid/"");			break;		}		r_strbuf_append (buf, "}");	}	r_strbuf_append (buf, "]}");}
开发者ID:agatti,项目名称:radare2,代码行数:38,


示例10: r_strbuf_set

R_API int r_strbuf_set(RStrBuf *sb, const char *s) {	int l;	if (!sb)		return R_FALSE;	if (!s) {		r_strbuf_init (sb);		return R_TRUE;	}	l = strlen (s);	if (l>=sizeof (sb->buf)) {		char *ptr = malloc (l+1);		if (!ptr)			return R_FALSE;		free (sb->ptr);		sb->ptr = ptr;		memcpy (ptr, s, l+1);	} else {		sb->ptr = NULL;		memcpy (sb->buf, s, l+1);	}	sb->len = l;	return R_TRUE;}
开发者ID:8500616886,项目名称:radare2,代码行数:23,


示例11: r_strbuf_set

R_API bool r_strbuf_set(RStrBuf *sb, const char *s) {	int l;	if (!sb) return false;	if (!s) {		r_strbuf_init (sb);		return true;	}	l = strlen (s);	if (l >= sizeof (sb->buf)) {		char *ptr = sb->ptr;		if (!ptr || l+1 > sb->ptrlen) {			ptr = malloc (l + 1);			if (!ptr) return false;			sb->ptrlen = l + 1;			sb->ptr = ptr;		}		memcpy (ptr, s, l+1);	} else {		sb->ptr = NULL;		memcpy (sb->buf, s, l+1);	}	sb->len = l;	return true;}
开发者ID:13572293130,项目名称:radare2,代码行数:24,


示例12: analop

static int analop(RAnal *a, RAnalOp *op, ut64 addr, const ut8 *buf, int len) {	static int omode = 0;#if USE_ITER_API	static#endif	cs_insn *insn = NULL;	int mode = (a->bits==64)? CS_MODE_64:		(a->bits==32)? CS_MODE_32:		(a->bits==16)? CS_MODE_16: 0;	int n, ret;	int regsz = 4;	if (handle && mode != omode) {		cs_close (&handle);		handle = 0;	}	omode = mode;	if (handle == 0) {		ret = cs_open (CS_ARCH_X86, mode, &handle);		if (ret != CS_ERR_OK) {			handle = 0;			return 0;		}	}#if 0	if (len>3 && !memcmp (buf, "/xff/xff/xff/xff", 4))		return 0;#endif	switch (a->bits) {	case 64: regsz = 8; break;	case 16: regsz = 2; break;	default: regsz = 4; break; // 32	}	memset (op, '/0', sizeof (RAnalOp));	op->cycles = 1; // aprox	op->type = R_ANAL_OP_TYPE_NULL;	op->jump = UT64_MAX;	op->fail = UT64_MAX;	op->ptr = op->val = UT64_MAX;	op->src[0] = NULL;	op->src[1] = NULL;	op->size = 0;	op->delay = 0;	r_strbuf_init (&op->esil);	cs_option (handle, CS_OPT_DETAIL, CS_OPT_ON);	// capstone-next#if USE_ITER_API	{		ut64 naddr = addr;		size_t size = len;		if (insn == NULL)			insn = cs_malloc (handle);		n = cs_disasm_iter (handle, (const uint8_t**)&buf,			&size, (uint64_t*)&naddr, insn);	}#else	n = cs_disasm (handle, (const ut8*)buf, len, addr, 1, &insn);#endif	struct Getarg gop = {		.handle = handle,		.insn = insn,		.bits = a->bits	};	if (n<1) {		op->type = R_ANAL_OP_TYPE_ILL;	} else {		int rs = a->bits/8;		const char *pc = (a->bits==16)?"ip":			(a->bits==32)?"eip":"rip";		const char *sp = (a->bits==16)?"sp":			(a->bits==32)?"esp":"rsp";		const char *bp = (a->bits==16)?"bp":			(a->bits==32)?"ebp":"rbp";		op->size = insn->size;		op->family = R_ANAL_OP_FAMILY_CPU; // almost everything is CPU		op->prefix = 0;		switch (insn->detail->x86.prefix[0]) {		case X86_PREFIX_REPNE:			op->prefix |= R_ANAL_OP_PREFIX_REPNE;			break;		case X86_PREFIX_REP:			op->prefix |= R_ANAL_OP_PREFIX_REP;			break;		case X86_PREFIX_LOCK:			op->prefix |= R_ANAL_OP_PREFIX_LOCK;			break;		}		switch (insn->id) {		case X86_INS_FNOP:			op->family = R_ANAL_OP_FAMILY_FPU;			/* fallthru */		case X86_INS_NOP:		case X86_INS_PAUSE:			op->type = R_ANAL_OP_TYPE_NOP;			if (a->decode)				esilprintf (op, ",");			break;		case X86_INS_HLT:			op->type = R_ANAL_OP_TYPE_TRAP;			break;//.........这里部分代码省略.........
开发者ID:Dev-Tech-Studio,项目名称:radare2,代码行数:101,


示例13: nios2_op

static int nios2_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *b, int len) {	if (op == NULL)		return 1;	/* Ayeeee! What's inside op? Do we have an initialized RAnalOp? Are we going to have a leak here? :-( */	memset (op, 0, sizeof (RAnalOp)); /* We need to refactorize this. Something like r_anal_op_init would be more appropiate */	r_strbuf_init (&op->esil);	op->size = 4;	if ((b[0]&0xff) == 0x3a) {		// XXX		op->type = R_ANAL_OP_TYPE_RET;	} else	if ((b[0]&0xf) == 0xa) {		op->type = R_ANAL_OP_TYPE_JMP;	} else	if ((b[0]&0xf) == 4) {		op->type = R_ANAL_OP_TYPE_ADD;	} else	if ((b[0]&0xf) == 5) {		op->type = R_ANAL_OP_TYPE_STORE;	} else	if ((b[0]&0xf) == 6) {		// blt, r19, r5, 0x8023480		op->type = R_ANAL_OP_TYPE_CJMP;		// TODO: address	} else	if ((b[0]&0xf) == 7) {		// blt, r19, r5, 0x8023480		op->type = R_ANAL_OP_TYPE_LOAD;		// TODO: address	} else	switch (b[0]) {	case 0x3a:		if (b[1]>=0xa0 && b[1]<=0xaf && b[3]==0x3d) {			op->type = R_ANAL_OP_TYPE_TRAP;		} else		if ((b[1]>=0xe0&&b[1]<=0xe7) && b[2]==0x3e && !b[3]) {			// nextpc ra			op->type = R_ANAL_OP_TYPE_RET;		}		break;	case 0x01:		// jmpi		op->type = R_ANAL_OP_TYPE_JMP;		break;	case 0x00:	case 0x20:	case 0x40:	case 0x80:	case 0xc0:		// 		op->type = R_ANAL_OP_TYPE_CALL;		break;	case 0x26:		// beq		break;	case 0x07:	case 0x47:	case 0x87:	case 0xc7:		// ldb		op->type = R_ANAL_OP_TYPE_LOAD;		break;	case 0x0d:	case 0x2d:	case 0x4d:	case 0x8d:	case 0xcd:		// sth && sthio		op->type = R_ANAL_OP_TYPE_LOAD;		break;	case 0x06:	case 0x46:	case 0x86:	case 0xc6:		// br		op->type = R_ANAL_OP_TYPE_CALL;		break;	}	return op->size;}
开发者ID:dialeth,项目名称:radare2,代码行数:81,


示例14: bf_op

static int bf_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *buf, int len) {	ut64 dst = 0LL;	if (op == NULL)		return 1;	/* Ayeeee! What's inside op? Do we have an initialized RAnalOp? Are we going to have a leak here? :-( */	memset (op, 0, sizeof (RAnalOp)); /* We need to refactorize this. Something like r_anal_op_init would be more appropiate */	r_strbuf_init (&op->esil);	op->size = 1;	switch (buf[0]) {	case '[': op->type = R_ANAL_OP_TYPE_CJMP;		  op->fail = addr+1;		  {			 const ut8 *p = buf + 1;			 int lev = 0, i = 1;			 while (*p && i<len) {				 if (*p == '[')					 lev++;				 if (*p == ']') {					 lev--;					 if (lev==-1) {						 dst = addr + (size_t)(p-buf);						 dst ++;						 op->jump = dst;						 r_strbuf_setf (&op->esil,							 "pc,brk,=[1],brk,++=,"							 "ptr,[1],!,?{,0x%"PFMT64x",pc,=,}", dst);						 break;					 }				 }				 p++;				i++;			 }		  }	// ?1[ptr],pc=${NEW_PC	break;	case ']': op->type = R_ANAL_OP_TYPE_UJMP;		// XXX This is wrong esil		r_strbuf_set (&op->esil, "brk,--=,brk,[1],pc,=");		break;	case '>': op->type = R_ANAL_OP_TYPE_ADD;		r_strbuf_set (&op->esil, "ptr,++=");		break;	case '<': op->type = R_ANAL_OP_TYPE_SUB;		r_strbuf_set (&op->esil, "ptr,--=");		break;	case '+':		op->size = countChar (buf, len, '+');		op->type = R_ANAL_OP_TYPE_ADD;		r_strbuf_setf (&op->esil, "ptr,[1],%d,+,ptr,=[1]", op->size);		break;	case '-':		op->type = R_ANAL_OP_TYPE_SUB;		op->size = countChar (buf, len, '-');		r_strbuf_setf (&op->esil, "ptr,[1],%d,-,ptr,=[1]", op->size);		break;	case '.':		// print element in stack to screen		op->type = R_ANAL_OP_TYPE_STORE;		r_strbuf_set (&op->esil, "ptr,[1],scr,=[1],scr,++=");		break;	case ',':		op->type = R_ANAL_OP_TYPE_LOAD;		r_strbuf_set (&op->esil, "kbd,[1],ptr,=[1],kbd,++=");		break;	case 0x00:	case 0xff:		op->type = R_ANAL_OP_TYPE_TRAP;		break;	default:		op->type = R_ANAL_OP_TYPE_NOP;		r_strbuf_set (&op->esil, ",");		break;	}	return op->size;}
开发者ID:jpenalbae,项目名称:radare2,代码行数:75,


示例15: analop

static int analop(RAnal *a, RAnalOp *op, ut64 addr, const ut8 *buf, int len) {	static int omode = 0;#if USE_ITER_API	static#endif	cs_insn *insn = NULL;	int mode = (a->bits==64)? CS_MODE_64:		(a->bits==32)? CS_MODE_32:		(a->bits==16)? CS_MODE_16: 0;	int n, ret;	int regsz = 4;	if (handle && mode != omode) {		cs_close (&handle);		handle = 0;	}	omode = mode;	if (handle == 0) {		ret = cs_open (CS_ARCH_X86, mode, &handle);		if (ret != CS_ERR_OK) {			handle = 0;			return 0;		}	}	switch (a->bits) {	case 64: regsz = 8; break;	case 16: regsz = 2; break;	default:	case 32: regsz = 4; break;	}	memset (op, '/0', sizeof (RAnalOp));	op->cycles = 1; // aprox	op->type = R_ANAL_OP_TYPE_NULL;	op->jump = UT64_MAX;	op->fail = UT64_MAX;	op->ptr = op->val = UT64_MAX;	op->src[0] = NULL;	op->src[1] = NULL;	op->size = 0;	op->delay = 0;	r_strbuf_init (&op->esil);	cs_option (handle, CS_OPT_DETAIL, CS_OPT_ON);	// capstone-next#if USE_ITER_API	{		ut64 naddr = addr;		size_t size = len;		if (insn == NULL)			insn = cs_malloc (handle);		n = cs_disasm_iter (handle, (const uint8_t**)&buf,			&size, (uint64_t*)&naddr, insn);	}#else	n = cs_disasm (handle, (const ut8*)buf, len, addr, 1, &insn);#endif	struct Getarg gop = {		.handle = handle,		.insn = insn,		.bits = a->bits	};	if (n<1) {		op->type = R_ANAL_OP_TYPE_ILL;	} else {		int rs = a->bits/8;		const char *pc = (a->bits==16)?"ip":			(a->bits==32)?"eip":"rip";		const char *sp = (a->bits==16)?"sp":			(a->bits==32)?"esp":"rsp";		const char *bp = (a->bits==16)?"bp":			(a->bits==32)?"ebp":"rbp";		op->size = insn->size;		op->family = 0;		op->prefix = 0;		switch (insn->detail->x86.prefix[0]) {		case X86_PREFIX_REPNE:			op->prefix |= R_ANAL_OP_PREFIX_REPNE;			break;		case X86_PREFIX_REP:			op->prefix |= R_ANAL_OP_PREFIX_REP;			break;		case X86_PREFIX_LOCK:			op->prefix |= R_ANAL_OP_PREFIX_LOCK;			break;		}		switch (insn->id) {		case X86_INS_FNOP:		case X86_INS_NOP:		case X86_INS_PAUSE:			op->type = R_ANAL_OP_TYPE_NOP;			if (a->decode)				esilprintf (op, ",");			break;		case X86_INS_HLT:			op->type = R_ANAL_OP_TYPE_TRAP;			break;		case X86_INS_FBLD:		case X86_INS_FBSTP:		case X86_INS_FCOMPP:		case X86_INS_FDECSTP://.........这里部分代码省略.........
开发者ID:BenGardiner,项目名称:radare2,代码行数:101,


示例16: _6502_op

static int _6502_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data, int len) {	char addrbuf[64];	const int buffsize = sizeof(addrbuf)-1;	memset (op, '/0', sizeof (RAnalOp));	op->size = snes_op[data[0]].len;	//snes-arch is similiar to nes/6502	op->addr = addr;	op->type = R_ANAL_OP_TYPE_UNK;	r_strbuf_init (&op->esil);	switch (data[0]) {	case 0x02:	case 0x03:	case 0x04:	case 0x07:	case 0x0b:	case 0x0c:	case 0x0f:	case 0x12:	case 0x13:	case 0x14:	case 0x17:	case 0x1a:	case 0x1b:	case 0x1c:	case 0x1f:	case 0x22:	case 0x23:	case 0x27:	case 0x2b:	case 0x2f:	case 0x32:	case 0x33:	case 0x34:	case 0x37:	case 0x3a:	case 0x3b:	case 0x3c:	case 0x3f:	case 0x42:	case 0x43:	case 0x44:	case 0x47:	case 0x4b:	case 0x4f:	case 0x52:	case 0x53:	case 0x54:	case 0x57:	case 0x5a:	case 0x5b:	case 0x5c:	case 0x5f:	case 0x62:	case 0x63:	case 0x64:	case 0x67:	case 0x6b:	case 0x6f:	case 0x72:	case 0x73:	case 0x74:	case 0x77:	case 0x7a:	case 0x7b:	case 0x7c:	case 0x7f:	case 0x80:	case 0x82:	case 0x83:	case 0x87:	case 0x89:	case 0x8b:	case 0x8f:	case 0x92:	case 0x93:	case 0x97:	case 0x9b:	case 0x9c:	case 0x9e:	case 0x9f:	case 0xa3:	case 0xa7:	case 0xab:	case 0xaf:	case 0xb2:	case 0xb3:	case 0xb7:	case 0xbb:	case 0xbf:	case 0xc2:	case 0xc3:	case 0xc7:	case 0xcb:	case 0xcf:	case 0xd2:	case 0xd3:	case 0xd4:	case 0xd7:	case 0xda:	case 0xdb://.........这里部分代码省略.........
开发者ID:Dev-Tech-Studio,项目名称:radare2,代码行数:101,


示例17: analop_esil

static int analop_esil(RAnal *a, RAnalOp *op, ut64 addr, const ut8 *buf) {	int ret = -1;	ut8 opcode = buf[0];	if (!op) {		return 2;	}	r_strbuf_init (&op->esil);	r_strbuf_set (&op->esil, "");	switch (opcode >> 4) {	case H8300_CMP_4BIT:		//acc. to manual this is how it's done, could use == in esil		r_strbuf_appendf(&op->esil, "0x%02x,r%u%c,-", imm, rdB(0));		//setZ		setV("%o");		setN;		setHb_B;		setCb_B;		maskB(0);		setZ;		return 0;	case H8300_OR_4BIT:		r_strbuf_appendf(&op->esil, "0x%02x,r%u%c,|=", imm, rdB(0));		//setZ		setV("0");		setN;		maskB(0);		setZ;		return 0;	case H8300_XOR_4BIT:		r_strbuf_appendf(&op->esil, "0x%02x,r%u%c,^=", imm, rdB(0));		//setZ		setN;		setV("0");		maskB(0);		setZ;		return 0;	case H8300_AND_4BIT:		r_strbuf_appendf(&op->esil, "0x%02x,r%u%c,&=", imm, rdB(0));		//setZ		setN;		setV("0");		maskB(0);		setZ;		return 0;	case H8300_ADD_4BIT:		r_strbuf_appendf(&op->esil, "0x%02x,r%u%c,+=", imm, rdB(0));		//setZ		setV("%o");		setN;		setH_B;		setC_B;		maskB(0);		setZ;		return 0;	case H8300_ADDX_4BIT:		r_strbuf_appendf(&op->esil, "0x%02x,C,+,r%u%c,+= ", imm,				rdB(0), rdB(0));		//setZ		setV("%o");		setN;		setH_B;		setC_B;		maskB(0);		setZ;		return 0;	case H8300_SUBX_4BIT:		//Rd 
C++ r_sys_getenv函数代码示例
C++ r_str_newf函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。