예제 #1
0
R_API RSyscallItem *r_syscall_get(RSyscall *s, int num, int swi) {
	const char *ret, *ret2, *key;
	if (!s || !s->db) {
		eprintf ("Syscall database not loaded\n");
		return NULL;
	}
	swi = getswi (s, swi);
	if (swi < 16) {
		key = sdb_fmt (0, "%d.%d", swi, num);
	} else {
		key = sdb_fmt (0, "0x%02x.%d", swi, num);
	}
	ret = sdb_const_get (s->db, key, 0);
	if (!ret) {
		key = sdb_fmt (0, "0x%02x.0x%02x", swi, num); // Workaround until Syscall SDB is fixed 
		ret = sdb_const_get (s->db, key, 0);
		if (!ret) {
			return NULL;
		}	
	}
	ret2 = sdb_const_get (s->db, ret, 0);
	if (!ret2) {
		return NULL;
	}
	return r_syscall_item_new_from_string (ret, ret2);
}
예제 #2
0
R_API const char *r_syscall_get_i(RSyscall *s, int num, int swi) {
	char foo[32];
	if (!s || !s->db)
		return NULL;
	swi = getswi (s->db, swi);
	snprintf (foo, sizeof (foo), "0x%x.%d", swi, num);
	return sdb_const_get (s->db, foo, 0);
}
예제 #3
0
파일: syscall.c 프로젝트: 0xroot/radare2
R_API char *r_syscall_get_i(RSyscall *ctx, int num, int swi) {
	char *ret, foo[32];
	if (!ctx->syspair)
		return NULL;
	swi = getswi (ctx->syspair, swi);
	snprintf (foo, sizeof (foo), "0x%x.%d", swi, num);
	ret = r_pair_get (ctx->syspair, foo);
	return ret;
}
예제 #4
0
파일: syscall.c 프로젝트: 0xroot/radare2
R_API RSyscallItem *r_syscall_get(RSyscall *ctx, int num, int swi) {
	char *ret, *ret2, foo[32];
	RSyscallItem *si;
	if (!ctx->syspair)
		return NULL;
	swi = getswi (ctx->syspair, swi);
	snprintf (foo, sizeof (foo), "0x%02x.%d", swi, num);
	ret = r_pair_get (ctx->syspair, foo);
	if (ret == NULL)
		return NULL;
	ret2 = r_pair_get (ctx->syspair, ret);
	if (ret2 == NULL)
		return NULL;
	si = r_syscall_item_new_from_string (ret, ret2);
	free (ret);
	free (ret2);
	return si;
}
예제 #5
0
R_API RSyscallItem *r_syscall_get(RSyscall *s, int num, int swi) {
	char *ret, *ret2, foo[32];
	RSyscallItem *si;
	if (!s || !s->db)
		return NULL;
	swi = getswi (s->db, swi);
	snprintf (foo, sizeof (foo), "0x%02x.%d", swi, num);
	ret = sdb_get (s->db, foo, 0);
	if (ret == NULL)
		return NULL;
	// TODO: optimize with sdb_const_get
	ret2 = sdb_get (s->db, ret, 0);
	if (ret2 == NULL)
		return NULL;
	si = r_syscall_item_new_from_string (ret, ret2);
	free (ret);
	free (ret2);
	return si;
}