[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v4 05/20] instrument: [bsd-user] Add command line li
From: |
Lluís Vilanova |
Subject: |
[Qemu-devel] [PATCH v4 05/20] instrument: [bsd-user] Add command line library loader |
Date: |
Wed, 6 Sep 2017 20:42:53 +0300 |
User-agent: |
StGit/0.17.1-dirty |
Signed-off-by: Lluís Vilanova <address@hidden>
---
bsd-user/main.c | 15 +++++++++++++++
bsd-user/syscall.c | 5 +++++
2 files changed, 20 insertions(+)
diff --git a/bsd-user/main.c b/bsd-user/main.c
index 8a6706a1c8..2cf75290cd 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,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 (;;) {
@@ -843,6 +853,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 +885,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 v4 00/20] instrument: Add basic event instrumentation, Lluís Vilanova, 2017/09/06
- [Qemu-devel] [PATCH v4 01/20] instrument: Add documentation, Lluís Vilanova, 2017/09/06
- [Qemu-devel] [PATCH v4 02/20] instrument: Add configure-time flag, Lluís Vilanova, 2017/09/06
- [Qemu-devel] [PATCH v4 03/20] instrument: Add generic library loader, Lluís Vilanova, 2017/09/06
- [Qemu-devel] [PATCH v4 04/20] instrument: [linux-user] Add command line library loader, Lluís Vilanova, 2017/09/06
- [Qemu-devel] [PATCH v4 05/20] instrument: [bsd-user] Add command line library loader,
Lluís Vilanova <=
- [Qemu-devel] [PATCH v4 06/20] instrument: [softmmu] Add command line library loader, Lluís Vilanova, 2017/09/06
- [Qemu-devel] [PATCH v4 07/20] instrument: [qapi] Add library loader, Lluís Vilanova, 2017/09/06
- [Qemu-devel] [PATCH v4 08/20] instrument: [hmp] Add library loader, Lluís Vilanova, 2017/09/06
- [Qemu-devel] [PATCH v4 09/20] instrument: Add basic control interface, Lluís Vilanova, 2017/09/06