qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 1/2] trace: allow trace events with string argum


From: Blue Swirl
Subject: Re: [Qemu-devel] [PATCH 1/2] trace: allow trace events with string arguments
Date: Mon, 5 Sep 2011 19:45:36 +0000

On Mon, Sep 5, 2011 at 3:37 PM, Stefan Hajnoczi
<address@hidden> wrote:
> String arguments are useful for producing human-readable traces without
> post-processing (e.g. stderr backend).  Although the simple backend
> cannot handles strings all others can.  Strings should be allowed and
> the simple backend can be extended to support them.

I don't think this is possible in general. Yes if the string can be
found in the executable (assuming address space randomizations don't
make that impossible post run), but not if the string happens to be
constructed in the stack or in the data segment during run time.

So I'd still at least strongly discourage string use.

> Signed-off-by: Stefan Hajnoczi <address@hidden>
> ---
>  docs/tracing.txt |    8 +++-----
>  1 files changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/docs/tracing.txt b/docs/tracing.txt
> index 4b27ab0..e130a61 100644
> --- a/docs/tracing.txt
> +++ b/docs/tracing.txt
> @@ -70,11 +70,6 @@ Trace events should use types as follows:
>    cannot include all user-defined struct declarations and it is therefore
>    necessary to use void * for pointers to structs.
>
> -   Pointers (including char *) cannot be dereferenced easily (or at all) in
> -   some trace backends.  If pointers are used, ensure they are meaningful by
> -   themselves and do not assume the data they point to will be traced.  Do
> -   not pass in string arguments.
> -
>  * For everything else, use primitive scalar types (char, int, long) with the
>    appropriate signedness.
>
> @@ -185,6 +180,9 @@ source tree.  It may not be as powerful as 
> platform-specific or third-party
>  trace backends but it is portable.  This is the recommended trace backend
>  unless you have specific needs for more advanced backends.
>
> +The "simple" backend currently does not capture string arguments, it simply
> +records the char* pointer value instead of the string that is pointed to.
> +
>  ==== Monitor commands ====
>
>  * info trace
> --
> 1.7.5.4
>
>
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]