[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 09/13] instrument: [bsd-user] Add command line libra
From: |
Lluís Vilanova |
Subject: |
[Qemu-devel] [PATCH 09/13] instrument: [bsd-user] Add command line library loader |
Date: |
Mon, 24 Jul 2017 20:38:45 +0300 |
User-agent: |
StGit/0.17.1-dirty |
Signed-off-by: Lluís Vilanova <address@hidden>
---
bsd-user/main.c | 16 ++++++++++++++++
bsd-user/syscall.c | 5 +++++
2 files changed, 21 insertions(+)
diff --git a/bsd-user/main.c b/bsd-user/main.c
index fa9c012c9f..37bf6a435c 100644
--- a/bsd-user/main.c
+++ b/bsd-user/main.c
@@ -33,6 +33,8 @@
#include "exec/log.h"
#include "trace/control.h"
#include "glib-compat.h"
+#include "instrument/cmdline.h"
+#include "instrument/control.h"
int singlestep;
unsigned long mmap_min_addr;
@@ -666,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"
@@ -735,6 +742,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();
@@ -753,6 +763,7 @@ int main(int argc, char **argv)
cpu_model = NULL;
qemu_add_opts(&qemu_trace_opts);
+ qemu_add_opts(&qemu_instr_opts);
optind = 1;
for (;;) {
@@ -840,6 +851,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();
}
@@ -869,6 +883,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 00/13] instrument: Add basic event instrumentation, Lluís Vilanova, 2017/07/24
- [Qemu-devel] [PATCH 01/13] instrument: Add documentation, Lluís Vilanova, 2017/07/24
- [Qemu-devel] [PATCH 02/13] instrument: [none] Add null instrumentation mode, Lluís Vilanova, 2017/07/24
- [Qemu-devel] [PATCH 03/13] instrument: [dynamic] Add dynamic instrumentation mode, Lluís Vilanova, 2017/07/24
- [Qemu-devel] [PATCH 04/13] instrument: Allow adding the "instrument" property without modifying event files, Lluís Vilanova, 2017/07/24
- [Qemu-devel] [PATCH 05/13] instrument: [dynamic] Add default public per-event functions, Lluís Vilanova, 2017/07/24
- [Qemu-devel] [PATCH 06/13] instrument: Add event control interface, Lluís Vilanova, 2017/07/24
- [Qemu-devel] [PATCH 07/13] instrument: Add generic command line library loader, Lluís Vilanova, 2017/07/24
- [Qemu-devel] [PATCH 08/13] instrument: [linux-user] Add command line library loader, Lluís Vilanova, 2017/07/24
- [Qemu-devel] [PATCH 09/13] instrument: [bsd-user] Add command line library loader,
Lluís Vilanova <=
- [Qemu-devel] [PATCH 10/13] instrument: [softmmu] Add command line library loader, Lluís Vilanova, 2017/07/24
- [Qemu-devel] [PATCH 11/13] instrument: [qapi] Add library loader, Lluís Vilanova, 2017/07/24
- [Qemu-devel] [PATCH 12/13] instrument: [hmp] Add library loader, Lluís Vilanova, 2017/07/24
- [Qemu-devel] [PATCH 13/13] trace: Rename C++-specific names in event arguments, Lluís Vilanova, 2017/07/24
- Re: [Qemu-devel] [PATCH 00/13] instrument: Add basic event instrumentation, Stefan Hajnoczi, 2017/07/25