atos-tools / qemu

QEMU with instrumentation support, ref to tcg/plugins/README
https://guillon.github.io/qemu-plugins
Other
5 stars 8 forks source link

Can I pass parameters to the plugin? #8

Open LittleSec opened 5 years ago

LittleSec commented 5 years ago

For example, I want to write a plugin named hello-plugin, which can read a file to do something. Usually we can use the command like hello-plugin <filename>. I want to know if qemu-plugin can do this for example --tcg-plugin ./hello-plugin.so filename? I notice the parameters.c, but I don't know how to use, it seems doing nothings as it's description.

guillon commented 5 years ago

There is no QEMU command line interface for passing parameters to plugins, generally we pass plugin parameters though the environment such as for instance in the dineroIV plugin where the cache topology is passed through several environment variables. For instance: $ env HELLO_PLUGIN_PARAMS=param1,param2 qemu ... --tcg-plugin hello-plugin.so Then the hello-plugin implementation has to parse the getenv("HELLO_PLUGIN_PARAMS").

There is an interface through the gdb plugin interface to mofify some declared plugin properties and the parameters.c is just an exemple plugin to show this, unfortunately this interface is not available from the command line as of now.

LittleSec commented 5 years ago

thanks, I try it.