All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: NDNF <arkaisp2021@gmail.com>
Cc: qemu-devel@nongnu.org, pavel.dovgaluk@ispras.ru
Subject: Re: [PATCH v2 1/2] src/plugins: add helper functions for drcov
Date: Thu, 21 Oct 2021 11:35:17 +0100	[thread overview]
Message-ID: <87zgr2u0g1.fsf@linaro.org> (raw)
In-Reply-To: <163429171602.439576.8875867021199772041.stgit@pc-System-Product-Name>


NDNF <arkaisp2021@gmail.com> writes:

> This patch adds helper functions to the drcov plugin.
> Which provide information about:
> - start_code.
> - end_code.
> - entry.
> - path to the executable binary.
>
> Signed-off-by: Ivanov Arkady <arkadiy.ivanov@ispras.ru>
> ---
>  include/qemu/qemu-plugin.h   |    5 +++++
>  plugins/api.c                |   27 +++++++++++++++++++++++++++
>  plugins/qemu-plugins.symbols |    4 ++++
>  3 files changed, 36 insertions(+)
>
> diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h
> index 5775e82c4e..807d932e02 100644
> --- a/include/qemu/qemu-plugin.h
> +++ b/include/qemu/qemu-plugin.h
> @@ -405,4 +405,9 @@ int qemu_plugin_n_max_vcpus(void);
>   */
>  void qemu_plugin_outs(const char *string);
>  
> +QEMU_PLUGIN_EXPORT const char *qemu_plugin_path_to_binary(void);
> +QEMU_PLUGIN_EXPORT uint64_t qemu_plugin_start_code(void);
> +QEMU_PLUGIN_EXPORT uint64_t qemu_plugin_end_code(void);
> +QEMU_PLUGIN_EXPORT uint64_t qemu_plugin_entry_code(void);
> +

Could you please add some documentation to these functions to explain
what each one does. Using the jdoc style:

/**
 * foo() - does bar
 * @baz: the amount of bar
 ...

as this gets automatically translated into API documentation in the
developer docs.

>  #endif /* QEMU_PLUGIN_API_H */
> diff --git a/plugins/api.c b/plugins/api.c
> index bbdc5a4eb4..4e8a582d58 100644
> --- a/plugins/api.c
> +++ b/plugins/api.c
> @@ -340,3 +340,30 @@ void qemu_plugin_outs(const char *string)
>  {
>      qemu_log_mask(CPU_LOG_PLUGIN, "%s", string);
>  }
> +
> +#ifdef CONFIG_USER_ONLY
> +#include "qemu.h"
> +const char *qemu_plugin_path_to_binary(void)
> +{
> +    TaskState *ts = (TaskState *) current_cpu->opaque;
> +    return ts->bprm->filename;
> +}
> +
> +uint64_t qemu_plugin_start_code(void)
> +{
> +    TaskState *ts = (TaskState *) current_cpu->opaque;
> +    return ts->info->start_code;
> +}
> +
> +uint64_t qemu_plugin_end_code(void)
> +{
> +    TaskState *ts = (TaskState *) current_cpu->opaque;
> +    return ts->info->end_code;
> +}
> +
> +uint64_t qemu_plugin_entry_code(void)
> +{
> +    TaskState *ts = (TaskState *) current_cpu->opaque;
> +    return ts->info->entry;
> +}
> +#endif

You need some stub functions here for system emulation mode although you
might be able to return something useful for the binary path?

> diff --git a/plugins/qemu-plugins.symbols b/plugins/qemu-plugins.symbols
> index 4bdb381f48..021851fb7d 100644
> --- a/plugins/qemu-plugins.symbols
> +++ b/plugins/qemu-plugins.symbols
> @@ -37,4 +37,8 @@
>    qemu_plugin_n_vcpus;
>    qemu_plugin_n_max_vcpus;
>    qemu_plugin_outs;
> +  qemu_plugin_path_to_binary;
> +  qemu_plugin_start_code;
> +  qemu_plugin_end_code;
> +  qemu_plugin_entry_code;

Please maintain the sorted list as it makes it easier to find missing
symbols ;-)

-- 
Alex Bennée


  reply	other threads:[~2021-10-21 10:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-15  9:55 [PATCH v2 0/2] plugins: add a drcov plugin NDNF
2021-10-15  9:55 ` [PATCH v2 1/2] src/plugins: add helper functions for drcov NDNF
2021-10-21 10:35   ` Alex Bennée [this message]
2021-10-15  9:55 ` [PATCH v2 2/2] contrib/plugins: add a drcov plugin NDNF
2021-10-21 10:40   ` Alex Bennée

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zgr2u0g1.fsf@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=arkaisp2021@gmail.com \
    --cc=pavel.dovgaluk@ispras.ru \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.