当前位置: 首页>>代码示例>>C++>>正文


C++ printxval函数代码示例

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


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

示例1: print_cmsg_type_data

static void
print_cmsg_type_data(struct tcb *tcp, const int cmsg_level, const int cmsg_type,
		     const void *cmsg_data, const size_t data_len)
{
	const unsigned int utype = cmsg_type;
	switch (cmsg_level) {
	case SOL_SOCKET:
		printxval(scmvals, cmsg_type, "SCM_???");
		if (utype < ARRAY_SIZE(cmsg_socket_printers)
		    && cmsg_socket_printers[utype].printer
		    && data_len >= cmsg_socket_printers[utype].min_len) {
			tprints(", cmsg_data=");
			cmsg_socket_printers[utype].printer(tcp, cmsg_data, data_len);
		}
		break;
	case SOL_IP:
		printxval(ip_cmsg_types, cmsg_type, "IP_???");
		if (utype < ARRAY_SIZE(cmsg_ip_printers)
		    && cmsg_ip_printers[utype].printer
		    && data_len >= cmsg_ip_printers[utype].min_len) {
			tprints(", cmsg_data=");
			cmsg_ip_printers[utype].printer(tcp, cmsg_data, data_len);
		}
		break;
	default:
		tprintf("%#x", cmsg_type);
	}
}
开发者ID:yunchih,项目名称:strace,代码行数:28,代码来源:msghdr.c

示例2: sys_socket

int
sys_socket(struct tcb *tcp)
{
	if (entering(tcp)) {
		printxval(domains, tcp->u_arg[0], "PF_???");
		tprints(", ");
		tprint_sock_type(tcp, tcp->u_arg[1]);
		tprints(", ");
		switch (tcp->u_arg[0]) {
		case PF_INET:
#ifdef PF_INET6
		case PF_INET6:
#endif
			printxval(inet_protocols, tcp->u_arg[2], "IPPROTO_???");
			break;
#ifdef PF_IPX
		case PF_IPX:
			/* BTW: I don't believe this.. */
			tprints("[");
			printxval(domains, tcp->u_arg[2], "PF_???");
			tprints("]");
			break;
#endif /* PF_IPX */
#ifdef PF_NETLINK
		case PF_NETLINK:
			printxval(netlink_protocols, tcp->u_arg[2], "NETLINK_???");
			break;
#endif
		default:
			tprintf("%lu", tcp->u_arg[2]);
			break;
		}
	}
	return 0;
}
开发者ID:3125788,项目名称:android_aosp_external_strace,代码行数:35,代码来源:net.c

示例3: printflock

static void
printflock(struct tcb *tcp, long addr, int getlk)
{
	struct flock fl;
	int r;

#if SUPPORTED_PERSONALITIES > 1
	if (
# if SIZEOF_OFF_T > SIZEOF_LONG
	    current_personality > 0 &&
#endif
	    current_wordsize != sizeof(fl.l_start)) {
		if (current_wordsize == 4) {
			/* 32-bit x86 app on x86_64 and similar cases */
			struct {
				short int l_type;
				short int l_whence;
				int32_t l_start; /* off_t */
				int32_t l_len; /* off_t */
				int32_t l_pid; /* pid_t */
			} fl32;
			r = umove(tcp, addr, &fl32);
			if (r >= 0) {
				fl.l_type = fl32.l_type;
				fl.l_whence = fl32.l_whence;
				fl.l_start = fl32.l_start;
				fl.l_len = fl32.l_len;
				fl.l_pid = fl32.l_pid;
			}
		} else {
			/* let people know we have a problem here */
			tprintf("<decode error: unsupported wordsize %d>",
				current_wordsize);
			return;
		}
	} else
#endif
	{
		r = umove(tcp, addr, &fl);
	}
	if (r < 0) {
		tprints("{...}");
		return;
	}
	tprints("{type=");
	printxval(lockfcmds, fl.l_type, "F_???");
	tprints(", whence=");
	printxval(whence_codes, fl.l_whence, "SEEK_???");
#if SIZEOF_OFF_T > SIZEOF_LONG
	tprintf(", start=%lld, len=%lld", fl.l_start, fl.l_len);
#else
	tprintf(", start=%ld, len=%ld", fl.l_start, fl.l_len);
#endif
	if (getlk)
		tprintf(", pid=%lu}", (unsigned long) fl.l_pid);
	else
		tprints("}");
}
开发者ID:bigzz,项目名称:strace_android,代码行数:58,代码来源:desc.c

示例4: print_cmsg_type_data

static void
print_cmsg_type_data(struct tcb *tcp, const int cmsg_level, const int cmsg_type,
		     const void *cmsg_data, const size_t data_len)
{
	switch (cmsg_level) {
	case SOL_SOCKET:
		printxval(scmvals, cmsg_type, "SCM_???");
		switch (cmsg_type) {
		case SCM_RIGHTS:
			print_scm_rights(tcp, cmsg_data, data_len);
			break;
		case SCM_CREDENTIALS:
			print_scm_creds(tcp, cmsg_data, data_len);
			break;
		case SCM_SECURITY:
			print_scm_security(tcp, cmsg_data, data_len);
			break;
		}
		break;
	case SOL_IP:
		printxval(ip_cmsg_types, cmsg_type, "IP_???");
		switch (cmsg_type) {
		case IP_PKTINFO:
			print_cmsg_ip_pktinfo(tcp, cmsg_data, data_len);
			break;
		case IP_TTL:
			print_cmsg_ip_ttl(tcp, cmsg_data, data_len);
			break;
		case IP_TOS:
			print_cmsg_ip_tos(tcp, cmsg_data, data_len);
			break;
		case IP_RECVOPTS:
		case IP_RETOPTS:
			print_cmsg_ip_opts(tcp, cmsg_data, data_len);
			break;
		case IP_RECVERR:
			print_cmsg_ip_recverr(tcp, cmsg_data, data_len);
			break;
		case IP_ORIGDSTADDR:
			print_cmsg_ip_origdstaddr(tcp, cmsg_data, data_len);
			break;
		case IP_CHECKSUM:
			print_cmsg_ip_checksum(tcp, cmsg_data, data_len);
			break;
		case SCM_SECURITY:
			print_scm_security(tcp, cmsg_data, data_len);
			break;
		}
		break;
	default:
		tprintf("%u", cmsg_type);
	}
}
开发者ID:3125788,项目名称:platform_external_strace,代码行数:53,代码来源:net.c

示例5: printcmsghdr

static void
printcmsghdr(struct tcb *tcp, unsigned long addr, unsigned long len)
{
	struct cmsghdr *cmsg = len < sizeof(struct cmsghdr) ?
			       NULL : malloc(len);
	if (cmsg == NULL || umoven(tcp, addr, len, (char *) cmsg) < 0) {
		tprintf(", msg_control=%#lx", addr);
		free(cmsg);
		return;
	}

	tprintf(", {cmsg_len=%u, cmsg_level=", (unsigned) cmsg->cmsg_len);
	printxval(socketlayers, cmsg->cmsg_level, "SOL_???");
	tprints(", cmsg_type=");

	if (cmsg->cmsg_level == SOL_SOCKET) {
		unsigned long cmsg_len;

		printxval(scmvals, cmsg->cmsg_type, "SCM_???");
		cmsg_len = (len < cmsg->cmsg_len) ? len : cmsg->cmsg_len;

		if (cmsg->cmsg_type == SCM_RIGHTS
		    && CMSG_LEN(sizeof(int)) <= cmsg_len) {
			int *fds = (int *) CMSG_DATA(cmsg);
			int first = 1;

			tprints(", {");
			while ((char *) fds < ((char *) cmsg + cmsg_len)) {
				if (!first)
					tprints(", ");
				printfd(tcp, *fds++);
				first = 0;
			}
			tprints("}}");
			free(cmsg);
			return;
		}
		if (cmsg->cmsg_type == SCM_CREDENTIALS
		    && CMSG_LEN(sizeof(struct ucred)) <= cmsg_len) {
			struct ucred *uc = (struct ucred *) CMSG_DATA(cmsg);

			tprintf("{pid=%ld, uid=%ld, gid=%ld}}",
				(long)uc->pid, (long)uc->uid, (long)uc->gid);
			free(cmsg);
			return;
		}
	}
	free(cmsg);
	tprints(", ...}");
}
开发者ID:3125788,项目名称:android_aosp_external_strace,代码行数:50,代码来源:net.c

示例6: printflock

/* fcntl/lockf */
static void
printflock(struct tcb *tcp, long addr, int getlk)
{
	struct flock fl;

#if SUPPORTED_PERSONALITIES > 1
	if (personality_wordsize[current_personality] != sizeof(fl.l_start)) {
		if (personality_wordsize[current_personality] == 4) {
			/* 32-bit x86 app on x86_64 and similar cases */
			struct {
				short int l_type;
				short int l_whence;
				int32_t l_start; /* off_t */
				int32_t l_len; /* off_t */
				int32_t l_pid; /* pid_t */
			} fl32;
			if (umove(tcp, addr, &fl32) < 0) {
				tprintf("{...}");
				return;
			}
			fl.l_type = fl32.l_type;
			fl.l_whence = fl32.l_whence;
			fl.l_start = fl32.l_start;
			fl.l_len = fl32.l_len;
			fl.l_pid = fl32.l_pid;
		} else {
			/* let people know we have a problem here */
			tprintf("{ <decode error: unsupported wordsize %d> }",
				personality_wordsize[current_personality]);
			return;
		}
	} else
#endif
	{
		if (umove(tcp, addr, &fl) < 0) {
			tprintf("{...}");
			return;
		}
	}
	tprintf("{type=");
	printxval(lockfcmds, fl.l_type, "F_???");
	tprintf(", whence=");
	printxval(whence, fl.l_whence, "SEEK_???");
	tprintf(", start=%ld, len=%ld", fl.l_start, fl.l_len);
	if (getlk)
		tprintf(", pid=%lu}", (unsigned long) fl.l_pid);
	else
		tprintf("}");
}
开发者ID:gittestusername,项目名称:uClinux,代码行数:50,代码来源:desc.c

示例7: decode_nand_oobinfo

static void
decode_nand_oobinfo(struct tcb *const tcp, const kernel_ulong_t addr)
{
	struct nand_oobinfo ninfo;
	unsigned int i, j;

	tprints(", ");
	if (umove_or_printaddr(tcp, addr, &ninfo))
		return;

	tprints("{useecc=");
	printxval(mtd_nandecc_options, ninfo.useecc, "MTD_NANDECC_???");
	tprintf(", eccbytes=%#x", ninfo.eccbytes);

	tprints(", oobfree={");
	for (i = 0; i < ARRAY_SIZE(ninfo.oobfree); ++i) {
		if (i)
			tprints("}, ");
		tprints("{");
		for (j = 0; j < ARRAY_SIZE(ninfo.oobfree[0]); ++j) {
			if (j)
				tprints(", ");
			tprintf("%#x", ninfo.oobfree[i][j]);
		}
	}

	tprints("}}, eccpos={");
	for (i = 0; i < ARRAY_SIZE(ninfo.eccpos); ++i) {
		if (i)
			tprints(", ");
		tprintf("%#x", ninfo.eccpos[i]);
	}

	tprints("}");
}
开发者ID:masatake,项目名称:strace,代码行数:35,代码来源:mtd.c

示例8: sys_personality

int
sys_personality(struct tcb *tcp)
{
	if (entering(tcp))
		printxval(personality_options, tcp->u_arg[0], "PER_???");
	return 0;
}
开发者ID:GeoffGats,项目名称:strace,代码行数:7,代码来源:system.c

示例9: sys_or1k_atomic

int sys_or1k_atomic(struct tcb *tcp)
{
	if (entering(tcp)) {
		printxval(atomic_ops, tcp->u_arg[0], "???");
		switch(tcp->u_arg[0]) {
		case OR1K_ATOMIC_SWAP:
			tprintf(", 0x%lx, 0x%lx", tcp->u_arg[1], tcp->u_arg[2]);
			break;
		case OR1K_ATOMIC_CMPXCHG:
			tprintf(", 0x%lx, %#lx, %#lx", tcp->u_arg[1], tcp->u_arg[2],
				tcp->u_arg[3]);
			break;

		case OR1K_ATOMIC_XCHG:
		case OR1K_ATOMIC_ADD:
		case OR1K_ATOMIC_AND:
		case OR1K_ATOMIC_OR:
		case OR1K_ATOMIC_UMAX:
		case OR1K_ATOMIC_UMIN:
			tprintf(", 0x%lx, %#lx", tcp->u_arg[1], tcp->u_arg[2]);
			break;

		case OR1K_ATOMIC_DECPOS:
			tprintf(", 0x%lx", tcp->u_arg[1]);
			break;

		default:
			break;
		}
	}

	return RVAL_HEX;
}
开发者ID:GeoffGats,项目名称:strace,代码行数:33,代码来源:system.c

示例10: sys_epoll_ctl

int
sys_epoll_ctl(struct tcb *tcp)
{
	if (entering(tcp)) {
		printfd(tcp, tcp->u_arg[0]);
		tprints(", ");
		printxval(epollctls, tcp->u_arg[1], "EPOLL_CTL_???");
		tprints(", ");
		printfd(tcp, tcp->u_arg[2]);
		tprints(", ");
		if (tcp->u_arg[3] == 0)
			tprints("NULL");
		else {
#ifdef HAVE_SYS_EPOLL_H
			struct epoll_event ev;
			if (
#ifdef EPOLL_CTL_DEL
			    (tcp->u_arg[1] != EPOLL_CTL_DEL) &&
#endif
			    umove(tcp, tcp->u_arg[3], &ev) == 0)
				print_epoll_event(&ev);
			else
#endif
				tprintf("%lx", tcp->u_arg[3]);
		}
	}
	return 0;
}
开发者ID:3125788,项目名称:android_aosp_external_strace,代码行数:28,代码来源:desc.c

示例11: decode_termios

static void
decode_termios(struct tcb *const tcp, const kernel_ulong_t addr)
{
	struct termios tios;

	tprints(", ");
	if (umove_or_printaddr(tcp, addr, &tios))
		return;
	if (abbrev(tcp)) {
		tprints("{");
		printxval(baud_options, tios.c_cflag & CBAUD, "B???");
		tprintf(" %sopost %sisig %sicanon %secho ...}",
			(tios.c_oflag & OPOST) ? "" : "-",
			(tios.c_lflag & ISIG) ? "" : "-",
			(tios.c_lflag & ICANON) ? "" : "-",
			(tios.c_lflag & ECHO) ? "" : "-");
		return;
	}
	tprintf("{c_iflags=%#lx, c_oflags=%#lx, ",
		(long) tios.c_iflag, (long) tios.c_oflag);
	tprintf("c_cflags=%#lx, c_lflags=%#lx, ",
		(long) tios.c_cflag, (long) tios.c_lflag);
	tprintf("c_line=%u, ", tios.c_line);
	if (!(tios.c_lflag & ICANON))
		tprintf("c_cc[VMIN]=%d, c_cc[VTIME]=%d, ",
			tios.c_cc[VMIN], tios.c_cc[VTIME]);
	tprints("c_cc=");
	print_quoted_string((char *) tios.c_cc, NCCS, QUOTE_FORCE_HEX);
	tprints("}");
}
开发者ID:MIPS,项目名称:external-strace,代码行数:30,代码来源:term.c

示例12: sys_rt_sigprocmask

int
sys_rt_sigprocmask(struct tcb *tcp)
{
	sigset_t sigset;

	/* Note: arg[3] is the length of the sigset. */
	if (entering(tcp)) {
		printxval(sigprocmaskcmds, tcp->u_arg[0], "SIG_???");
		tprints(", ");
		if (!tcp->u_arg[1])
			tprints("NULL, ");
		else if (copy_sigset_len(tcp, tcp->u_arg[1], &sigset, tcp->u_arg[3]) < 0)
			tprintf("%#lx, ", tcp->u_arg[1]);
		else {
			printsigmask(&sigset, 1);
			tprints(", ");
		}
	}
	else {
		if (!tcp->u_arg[2])
			tprints("NULL");
		else if (syserror(tcp))
			tprintf("%#lx", tcp->u_arg[2]);
		else if (copy_sigset_len(tcp, tcp->u_arg[2], &sigset, tcp->u_arg[3]) < 0)
			tprints("[?]");
		else
			printsigmask(&sigset, 1);
		tprintf(", %lu", tcp->u_arg[3]);
	}
	return 0;
}
开发者ID:GeoffGats,项目名称:strace,代码行数:31,代码来源:signal.c

示例13: sys_kexec_load

int
sys_kexec_load(struct tcb *tcp)
{
	unsigned long n;

	if (exiting(tcp))
		return 0;

	/* entry, nr_segments */
	tprintf("%#lx, %lu, ", tcp->u_arg[0], tcp->u_arg[1]);

	/* segments */
	print_kexec_segments(tcp, tcp->u_arg[2], tcp->u_arg[1]);
	tprints(", ");

	/* flags */
	n = tcp->u_arg[3];
	printxval(kexec_arch_values, n & KEXEC_ARCH_MASK, "KEXEC_ARCH_???");
	n &= ~KEXEC_ARCH_MASK;
	if (n) {
		tprints("|");
		printflags(kexec_load_flags, n, "KEXEC_???");
	}

	return 0;
}
开发者ID:fengidri,项目名称:typhoon,代码行数:26,代码来源:kexec.c

示例14: print_sg_io_v3_req

static int
print_sg_io_v3_req(struct tcb *tcp, const long arg)
{
	struct sg_io_hdr sg_io;

	if (umove(tcp, arg, &sg_io) < 0) {
		tprints("???}");
		return RVAL_DECODED | 1;
	}

	printxval(sg_io_dxfer_direction, sg_io.dxfer_direction,
		  "SG_DXFER_???");
	tprintf(", cmd[%u]=", sg_io.cmd_len);
	print_sg_io_buffer(tcp, (unsigned long) sg_io.cmdp, sg_io.cmd_len);
	tprintf(", mx_sb_len=%d", sg_io.mx_sb_len);
	tprintf(", iovec_count=%d", sg_io.iovec_count);
	tprintf(", dxfer_len=%u", sg_io.dxfer_len);
	tprintf(", timeout=%u", sg_io.timeout);
	tprintf(", flags=%#x", sg_io.flags);

	if (sg_io.dxfer_direction == SG_DXFER_TO_DEV ||
	    sg_io.dxfer_direction == SG_DXFER_TO_FROM_DEV) {
		tprintf(", data[%u]=", sg_io.dxfer_len);
		if (sg_io.iovec_count)
			tprint_iov_upto(tcp, sg_io.iovec_count,
					(unsigned long) sg_io.dxferp, 1,
					sg_io.dxfer_len);
		else
			print_sg_io_buffer(tcp, (unsigned long) sg_io.dxferp,
					   sg_io.dxfer_len);
	}
	return 1;
}
开发者ID:FrBrGeorge,项目名称:strace-mpers,代码行数:33,代码来源:scsi.c

示例15: print_mmap

static int
print_mmap(struct tcb *tcp, long *u_arg, unsigned long long offset)
{
	if (entering(tcp)) {
		/* addr */
		if (!u_arg[0])
			tprints("NULL, ");
		else
			tprintf("%#lx, ", u_arg[0]);
		/* len */
		tprintf("%lu, ", u_arg[1]);
		/* prot */
		printflags(mmap_prot, u_arg[2], "PROT_???");
		tprints(", ");
		/* flags */
#ifdef MAP_TYPE
		printxval(mmap_flags, u_arg[3] & MAP_TYPE, "MAP_???");
		addflags(mmap_flags, u_arg[3] & ~MAP_TYPE);
#else
		printflags(mmap_flags, u_arg[3], "MAP_???");
#endif
		tprints(", ");
		/* fd */
		printfd(tcp, u_arg[4]);
		/* offset */
		tprintf(", %#llx", offset);
	}
	return RVAL_HEX;
}
开发者ID:tizenorg,项目名称:platform.upstream.strace,代码行数:29,代码来源:mem.c


注:本文中的printxval函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。