diff mbox series

[RFC,18/21] linux-user: allow dumping of plugin status at end of run

Message ID 20181005154910.3099-19-alex.bennee@linaro.org
State New
Headers show
Series Trace updates and plugin RFC | expand

Commit Message

Alex Bennée Oct. 5, 2018, 3:49 p.m. UTC
As we don't have a monitor in linux-user mode we need some way of
exporting our data to the world. We introduce a new -d option (plugin)
which turns on the existing LOG_TRACE flag which qemu_plugin_status()
will dump output to before we finally exit.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

---
 linux-user/exit.c | 12 ++++++++++++
 util/log.c        |  2 ++
 2 files changed, 14 insertions(+)

-- 
2.17.1

Comments

Richard Henderson Oct. 15, 2018, 5:28 p.m. UTC | #1
On 10/5/18 8:49 AM, Alex Bennée wrote:
> As we don't have a monitor in linux-user mode we need some way of

> exporting our data to the world. We introduce a new -d option (plugin)

> which turns on the existing LOG_TRACE flag which qemu_plugin_status()

> will dump output to before we finally exit.

> 

> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

> ---

>  linux-user/exit.c | 12 ++++++++++++

>  util/log.c        |  2 ++

>  2 files changed, 14 insertions(+)


Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~
diff mbox series

Patch

diff --git a/linux-user/exit.c b/linux-user/exit.c
index 14e94e28fa..2f9e016207 100644
--- a/linux-user/exit.c
+++ b/linux-user/exit.c
@@ -17,12 +17,23 @@ 
  *  along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 #include "qemu/osdep.h"
+#include "qemu/plugins.h"
 #include "qemu.h"
 
 #ifdef CONFIG_GCOV
 extern void __gcov_dump(void);
 #endif
 
+static void plugin_report(void)
+{
+#ifdef CONFIG_TRACE_PLUGIN
+    GString *plugin_report = qemu_plugin_status("");
+    qemu_log_mask(LOG_TRACE, "%s", plugin_report->str);
+    g_string_free(plugin_report, true);
+#endif
+}
+
+
 void preexit_cleanup(CPUArchState *env, int code)
 {
 #ifdef TARGET_GPROF
@@ -31,5 +42,6 @@  void preexit_cleanup(CPUArchState *env, int code)
 #ifdef CONFIG_GCOV
         __gcov_dump();
 #endif
+        plugin_report();
         gdb_exit(env, code);
 }
diff --git a/util/log.c b/util/log.c
index 5759bf571f..d4423277e0 100644
--- a/util/log.c
+++ b/util/log.c
@@ -288,6 +288,8 @@  const QEMULogItem qemu_log_items[] = {
     { CPU_LOG_TB_NOCHAIN, "nochain",
       "do not chain compiled TBs so that \"exec\" and \"cpu\" show\n"
       "complete traces" },
+    { LOG_TRACE, "plugin",
+      "show summary plugin information at end of run." },
     { 0, NULL, NULL },
 };