[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v6 05/22] instrument: [bsd-user] Add command line li
From: |
Lluís Vilanova |
Subject: |
[Qemu-devel] [PATCH v6 05/22] instrument: [bsd-user] Add command line library loader |
Date: |
Wed, 13 Sep 2017 13:13:53 +0300 |
User-agent: |
StGit/0.18 |
Signed-off-by: Lluís Vilanova <address@hidden>
---
bsd-user/main.c | 17 +++++++++++++++++
bsd-user/syscall.c | 5 +++++
2 files changed, 22 insertions(+)
diff --git a/bsd-user/main.c b/bsd-user/main.c
index 8a6706a1c8..104844edfc 100644
--- a/bsd-user/main.c
+++ b/bsd-user/main.c
@@ -33,6 +33,7 @@
#include "exec/log.h"
#include "trace/control.h"
#include "glib-compat.h"
+#include "instrument/cmdline.h"
int singlestep;
unsigned long mmap_min_addr;
@@ -667,6 +668,11 @@ static void usage(void)
"-B address set guest_base address to address\n"
"-bsd type select emulated BSD type FreeBSD/NetBSD/OpenBSD
(default)\n"
"\n"
+#if defined(CONFIG_INSTRUMENT)
+ "-instr [file=]<file>[,arg=<string>]\n"
+ " load an instrumentation library\n"
+ "\n"
+#endif
"Debug options:\n"
"-d item1[,...] enable logging of specified items\n"
" (use '-d help' for a list of log items)\n"
@@ -738,6 +744,9 @@ int main(int argc, char **argv)
envlist_t *envlist = NULL;
char *trace_file = NULL;
bsd_type = target_openbsd;
+ char *instrument_path = NULL;
+ int instrument_argc = 0;
+ const char **instrument_argv = NULL;
if (argc <= 1)
usage();
@@ -756,6 +765,9 @@ int main(int argc, char **argv)
cpu_model = NULL;
qemu_add_opts(&qemu_trace_opts);
+#if defined(CONFIG_INSTRUMENT)
+ qemu_add_opts(&qemu_instr_opts);
+#endif
optind = 1;
for (;;) {
@@ -843,6 +855,9 @@ int main(int argc, char **argv)
} else if (!strcmp(r, "trace")) {
g_free(trace_file);
trace_file = trace_opt_parse(optarg);
+ } else if (!strcmp(r, "instr")) {
+ instr_opt_parse(optarg, &instrument_path,
+ &instrument_argc, &instrument_argv);
} else {
usage();
}
@@ -872,6 +887,8 @@ int main(int argc, char **argv)
}
trace_init_file(trace_file);
+ instr_init(instrument_path, instrument_argc, instrument_argv);
+
/* Zero out regs */
memset(regs, 0, sizeof(struct target_pt_regs));
diff --git a/bsd-user/syscall.c b/bsd-user/syscall.c
index 66492aaf5d..3230f722f3 100644
--- a/bsd-user/syscall.c
+++ b/bsd-user/syscall.c
@@ -26,6 +26,8 @@
#include "qemu.h"
#include "qemu-common.h"
+#include "instrument/cmdline.h"
+
//#define DEBUG
@@ -332,6 +334,7 @@ abi_long do_freebsd_syscall(void *cpu_env, int num,
abi_long arg1,
_mcleanup();
#endif
gdb_exit(cpu_env, arg1);
+ instr_fini();
/* XXX: should free thread stack and CPU env */
_exit(arg1);
ret = 0; /* avoid warning */
@@ -430,6 +433,7 @@ abi_long do_netbsd_syscall(void *cpu_env, int num, abi_long
arg1,
_mcleanup();
#endif
gdb_exit(cpu_env, arg1);
+ instr_fini();
/* XXX: should free thread stack and CPU env */
_exit(arg1);
ret = 0; /* avoid warning */
@@ -505,6 +509,7 @@ abi_long do_openbsd_syscall(void *cpu_env, int num,
abi_long arg1,
_mcleanup();
#endif
gdb_exit(cpu_env, arg1);
+ instr_fini();
/* XXX: should free thread stack and CPU env */
_exit(arg1);
ret = 0; /* avoid warning */
- [Qemu-devel] [PATCH v6 00/22] instrument: Add basic event instrumentation, Lluís Vilanova, 2017/09/13
- [Qemu-devel] [PATCH v6 01/22] instrument: Add documentation, Lluís Vilanova, 2017/09/13
- [Qemu-devel] [PATCH v6 02/22] instrument: Add configure-time flag, Lluís Vilanova, 2017/09/13
- [Qemu-devel] [PATCH v6 03/22] instrument: Add generic library loader, Lluís Vilanova, 2017/09/13
- [Qemu-devel] [PATCH v6 04/22] instrument: [linux-user] Add command line library loader, Lluís Vilanova, 2017/09/13
- [Qemu-devel] [PATCH v6 05/22] instrument: [bsd-user] Add command line library loader,
Lluís Vilanova <=
- [Qemu-devel] [PATCH v6 06/22] instrument: [softmmu] Add command line library loader, Lluís Vilanova, 2017/09/13
- [Qemu-devel] [PATCH v6 07/22] instrument: [qapi] Add library loader, Lluís Vilanova, 2017/09/13
- [Qemu-devel] [PATCH v6 08/22] instrument: [hmp] Add library loader, Lluís Vilanova, 2017/09/13
- [Qemu-devel] [PATCH v6 09/22] instrument: Add basic control interface, Lluís Vilanova, 2017/09/13
- [Qemu-devel] [PATCH v6 10/22] instrument: Add support for tracing events, Lluís Vilanova, 2017/09/13
- [Qemu-devel] [PATCH v6 11/22] instrument: Track vCPUs, Lluís Vilanova, 2017/09/13
- [Qemu-devel] [PATCH v6 12/22] instrument: Add event 'guest_cpu_enter', Lluís Vilanova, 2017/09/13
- [Qemu-devel] [PATCH v6 13/22] instrument: Support synchronous modification of vCPU state, Lluís Vilanova, 2017/09/13
- [Qemu-devel] [PATCH v6 14/22] exec: Add function to synchronously flush TB on a stopped vCPU, Lluís Vilanova, 2017/09/13
- [Qemu-devel] [PATCH v6 15/22] instrument: Add event 'guest_cpu_exit', Lluís Vilanova, 2017/09/13