summaryrefslogtreecommitdiffstats
path: root/test/debug.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/debug.c')
-rw-r--r--test/debug.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/debug.c b/test/debug.c
new file mode 100644
index 0000000..7a1e259
--- /dev/null
+++ b/test/debug.c
@@ -0,0 +1,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);
+}