summaryrefslogtreecommitdiffstats
path: root/util/debug.c
blob: 7a1e2593347fb07125cddbbc7341847f0f9bf45b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include "cachepc/uapi.h"

#include <sys/ioctl.h>
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <stdint.h>
#include <err.h>
#include <fcntl.h>
#include <unistd.h>

int
main(int argc, const char **argv)
{
	uint32_t arg;
	int fd, ret;

	fd = open("/dev/kvm", O_RDONLY);
	if (fd < 0) err(1, "open");

	arg = argc > 1 ?  atoi(argv[1]) : 1;
	ret = ioctl(fd, KVM_CPC_DEBUG, &arg);
	if (ret == -1) err(1, "ioctl DEBUG");

	close(fd);
}