On 2023/08/15 0:23, Alex Bennée wrote:

Akihiko Odaki <akihiko.od...@daynix.com> writes:

This demonstrates how to write a plugin in C++.

Signed-off-by: Akihiko Odaki <akihiko.od...@daynix.com>
---
  docs/devel/tcg-plugins.rst |  8 ++++++++
  configure                  | 15 ++++++++++++---
  contrib/plugins/Makefile   |  5 +++++
  contrib/plugins/cc.cc      | 15 +++++++++++++++
  tests/tcg/Makefile.target  |  3 +++
  5 files changed, 43 insertions(+), 3 deletions(-)
  create mode 100644 contrib/plugins/cc.cc

diff --git a/docs/devel/tcg-plugins.rst b/docs/devel/tcg-plugins.rst
index c9f8b27590..0a11f8036c 100644
--- a/docs/devel/tcg-plugins.rst
+++ b/docs/devel/tcg-plugins.rst
@@ -584,6 +584,14 @@ The plugin has a number of arguments, all of them are 
optional:
    configuration arguments implies ``l2=on``.
    (default: N = 2097152 (2MB), B = 64, A = 16)
+- contrib/plugins/cc.cc
+
+cc plugin demonstrates how to write a plugin in C++. It simply outputs
+"hello, world" to the plugin log::
+
+  $ qemu-system-arm $(QEMU_ARGS) \
+    -plugin ./contrib/plugins/libcc.so -d plugin
+

I'm going to assume this is useful because you have some out of tree C++
plugins? I'd drop the last two patches for now until there is a slightly
more compelling use case.

The out-of-tree plugin is mentioned in the cover letter and available at:
https://github.com/shioya-lab/sniper/tree/akihikodaki/bb/frontend/qemu-frontend

This plugin emits a trace of execution for use in Sniper simulator. I believe it's useful for other people doing microarchitecture research since processor simulation infrastructure is often written in C++.


The C++ compiler detection moved into meson in b485458e00 (configure,
meson: move C++ compiler detection to meson.build) so I don't think
there is currently a compelling reason to bring this back into
configure.


It is necessary because TCG tests use Makefile and config-host.mak is emitted by configure. We can remove C++ detection from configure when TCG tests or the config-host.mak generation migrate to Meson.

Reply via email to