[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 1/1] vl.c: don't try to insert malloc tracepoint
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [PATCH 1/1] vl.c: don't try to insert malloc tracepoints on newer glib |
Date: |
Fri, 4 Sep 2015 19:11:41 +0100 |
On 4 September 2015 at 18:58, Serge Hallyn <address@hidden> wrote:
> Because it has deprecated it with commit
> 3be6ed60aa58095691bd697344765e715a327fc1. This prevents the warning
>
> (process:3535): GLib-WARNING **:
> /build/glib2.0-3tdlHy/glib2.0-2.45.6/./glib/gmem.c:482: custom memory
> allocation vtable not supported
>
> as reported at https://bugs.launchpad.net/ubuntu/+source/qemu-kvm/+bug/1491972
>
> (thanks danpb for the suggestion)
>
> Signed-off-by: Serge Hallyn <address@hidden>
> ---
> vl.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/vl.c b/vl.c
> index 584ca88..cab9425 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -2719,6 +2719,7 @@ static const QEMUOption *lookup_opt(int argc, char
> **argv,
> return popt;
> }
>
> +#if ! GLIB_CHECK_VERSION(2, 44, 0)
Existing style for these checks doesn't have a space
between the "!" and the "GLIB_CHECK_VERSION".
> static gpointer malloc_and_trace(gsize n_bytes)
> {
> void *ptr = malloc(n_bytes);
> @@ -2738,6 +2739,7 @@ static void free_and_trace(gpointer mem)
> trace_g_free(mem);
> free(mem);
> }
> +#endif
We could reduce the number of ifdefs we have to have here by
having inside this #if...
void register_glib_mem_trace_functions(void)
(with the GMemVTable and the call to g_mem_set_vtable in it),
and then having an
#else
void register_glib_mem_trace_functions(void)
{
/* Newer versions of glib don't support intercepting the
* memory allocation functions.
*/
}
#endif
Then you can make the callsite un-ifdefed.
thanks
-- PMM