[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL v2 56/73] plugin: add qemu_plugin_outs helper
From: |
Alex Bennée |
Subject: |
[PULL v2 56/73] plugin: add qemu_plugin_outs helper |
Date: |
Fri, 25 Oct 2019 07:36:56 +0100 |
Having the plugins grab stdout and spew stuff there is a bit ugly and
certainly makes the tests look ugly. Provide a hook back into QEMU
which can be redirected as needed.
Signed-off-by: Alex Bennée <address@hidden>
Reviewed-by: Aaron Lindsay <address@hidden>
diff --git a/include/qemu/log.h b/include/qemu/log.h
index b097a6cae11..a91105b2adc 100644
--- a/include/qemu/log.h
+++ b/include/qemu/log.h
@@ -45,6 +45,7 @@ static inline bool qemu_log_separate(void)
/* LOG_TRACE (1 << 15) is defined in log-for-trace.h */
#define CPU_LOG_TB_OP_IND (1 << 16)
#define CPU_LOG_TB_FPU (1 << 17)
+#define CPU_LOG_PLUGIN (1 << 18)
/* Lock output for a series of related logs. Since this is not needed
* for a single qemu_log / qemu_log_mask / qemu_log_mask_and_addr, we
diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h
index ddf267fbfe0..a00a7deb461 100644
--- a/include/qemu/qemu-plugin.h
+++ b/include/qemu/qemu-plugin.h
@@ -384,4 +384,10 @@ int qemu_plugin_n_vcpus(void);
/* returns -1 in user-mode */
int qemu_plugin_n_max_vcpus(void);
+/**
+ * qemu_plugin_outs() - output string via QEMU's logging system
+ * @string: a string
+ */
+void qemu_plugin_outs(const char *string);
+
#endif /* QEMU_PLUGIN_API_H */
diff --git a/plugins/api.c b/plugins/api.c
index 5adc4d25a1e..fa1d9f276d3 100644
--- a/plugins/api.c
+++ b/plugins/api.c
@@ -331,3 +331,11 @@ int qemu_plugin_n_max_vcpus(void)
return get_ms()->smp.max_cpus;
#endif
}
+
+/*
+ * Plugin output
+ */
+void qemu_plugin_outs(const char *string)
+{
+ qemu_log_mask(CPU_LOG_PLUGIN, "%s", string);
+}
diff --git a/plugins/qemu-plugins.symbols b/plugins/qemu-plugins.symbols
index 267ec381b4a..4bdb381f48e 100644
--- a/plugins/qemu-plugins.symbols
+++ b/plugins/qemu-plugins.symbols
@@ -36,4 +36,5 @@
qemu_plugin_vcpu_for_each;
qemu_plugin_n_vcpus;
qemu_plugin_n_max_vcpus;
+ qemu_plugin_outs;
};
diff --git a/util/log.c b/util/log.c
index 1d1b33f7d9f..1ca13059eef 100644
--- a/util/log.c
+++ b/util/log.c
@@ -273,6 +273,9 @@ const QEMULogItem qemu_log_items[] = {
{ CPU_LOG_TB_NOCHAIN, "nochain",
"do not chain compiled TBs so that \"exec\" and \"cpu\" show\n"
"complete traces" },
+#ifdef CONFIG_PLUGIN
+ { CPU_LOG_PLUGIN, "plugin", "output from TCG plugins\n"},
+#endif
{ 0, NULL, NULL },
};
--
2.20.1
- [PULL v2 10/73] tests/vm: Let subclasses disable IPv6, (continued)
- [PULL v2 10/73] tests/vm: Let subclasses disable IPv6, Alex Bennée, 2019/10/25
- [PULL v2 08/73] cirrus.yml: add latest Xcode build target, Alex Bennée, 2019/10/25
- [PULL v2 05/73] travis.yml: Fix the ccache lines, Alex Bennée, 2019/10/25
- [PULL v2 09/73] tests/vm: netbsd autoinstall, using serial console, Alex Bennée, 2019/10/25
- [PULL v2 53/73] plugin: add API symbols to qemu-plugins.symbols, Alex Bennée, 2019/10/25
- [PULL v2 54/73] plugin: expand the plugin_init function to include an info block, Alex Bennée, 2019/10/25
- [PULL v2 07/73] travis.yml: bump Xcode 10 to latest dot release, Alex Bennée, 2019/10/25
- [PULL v2 11/73] tests/vm/netbsd: Disable IPv6, Alex Bennée, 2019/10/25
- [PULL v2 13/73] gitlab-ci.yml: Use libvdeplug-dev to compile-test the VDE network backend, Alex Bennée, 2019/10/25
- [PULL v2 19/73] cpu: introduce cpu_in_exclusive_context(), Alex Bennée, 2019/10/25
- [PULL v2 56/73] plugin: add qemu_plugin_outs helper,
Alex Bennée <=
- [PULL v2 72/73] MAINTAINERS: add me for the TCG plugins code, Alex Bennée, 2019/10/25
- [PULL v2 59/73] tests/plugin: add sample plugins, Alex Bennée, 2019/10/25
- [PULL v2 22/73] plugin: add user-facing API, Alex Bennée, 2019/10/25
- [PULL v2 12/73] travis.yml: cache the clang sanitizer build, Alex Bennée, 2019/10/25
- [PULL v2 21/73] docs/devel: add plugins.rst design document, Alex Bennée, 2019/10/25
- [PULL v2 65/73] tests/plugin: add a hotblocks plugin, Alex Bennée, 2019/10/25
- [PULL v2 24/73] plugin: add implementation of the api, Alex Bennée, 2019/10/25
- [PULL v2 55/73] plugin: add qemu_plugin_insn_disas helper, Alex Bennée, 2019/10/25
- [PULL v2 40/73] target/arm: fetch code with translator_ld, Alex Bennée, 2019/10/25
- [PULL v2 52/73] configure: add --enable-plugins, Alex Bennée, 2019/10/25