WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] Re: [Xen-changelog] Make it possible to run valgrind on code

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] Re: [Xen-changelog] Make it possible to run valgrind on code linked with the libxc libraries.
From: Muli Ben-Yehuda <mulix@xxxxxxxxx>
Date: Tue, 22 Nov 2005 21:47:55 +0200
Cc: emellor@xxxxxxxxxxxxx
Delivery-date: Tue, 22 Nov 2005 19:47:55 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <E1EeckQ-0000QP-Lt@xxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <E1EeckQ-0000QP-Lt@xxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.11
On Tue, Nov 22, 2005 at 06:20:06PM +0000, Xen patchbot -unstable wrote:
> diff -r c1c8da6f2afe -r 602aefe7bd48 tools/libxc/xg_private.h
> --- a/tools/libxc/xg_private.h        Mon Nov 21 18:08:44 2005
> +++ b/tools/libxc/xg_private.h        Tue Nov 22 15:31:16 2005
> @@ -15,6 +15,16 @@
>  
>  #include <xen/linux/privcmd.h>
>  #include <xen/memory.h>
> +
> +/* valgrind cannot see when a hypercall has filled in some values.  For this
> +   reason, we must zero the dom0_op_t instance before a call, if using
> +   valgrind.  */
> +#ifdef VALGRIND
> +#define DECLARE_DOM0_OP dom0_op_t op; memset(&op, 0, sizeof(op))
> +#else
> +#define DECLARE_DOM0_OP dom0_op_t op
> +#endif

This is pretty ugly IMHO. Also, if someone does

if (foo)
        bla;
else
        DECLARE_DOM0_OP;

it breaks.

Is the micro-optimization of not initializing the structures to 0
worth it? I really doubt it. But if yes, please at least do something
like

#ifdef VALGRIND
#define DECLARE_DOM0_OP(name) dom0_op_t name = {
        .cmd = 0,
        .interface_version = 0, 
        .pad = { 0 }
}
#else
#define #define DECLARE_DOM0_OP(name) dom0_op_t name;
#endif

Cheers,
Muli
-- 
Muli Ben-Yehuda
http://www.mulix.org | http://mulix.livejournal.com/


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>