thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
34b321
From d15566b6a91973dbf83c92a9678bd3ac4939af75 Mon Sep 17 00:00:00 2001
34b321
From: Miroslav Rezanina <mrezanin@redhat.com>
34b321
Date: Fri, 29 Jul 2016 07:41:27 +0200
34b321
Subject: [PATCH 16/16] trace: remove malloc tracing
34b321
34b321
RH-Author: Miroslav Rezanina <mrezanin@redhat.com>
34b321
Message-id: <1469778087-316-1-git-send-email-mrezanin@redhat.com>
34b321
Patchwork-id: 71514
34b321
O-Subject: [RHEL-7.3 qemu-kvm PATCH] trace: remove malloc tracing
34b321
Bugzilla: 1360137
34b321
RH-Acked-by: Fam Zheng <famz@redhat.com>
34b321
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
34b321
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
34b321
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
34b321
34b321
From: Paolo Bonzini <pbonzini@redhat.com>
34b321
34b321
The malloc vtable is not supported anymore in glib, because it broke
34b321
when constructors called g_malloc.  Remove tracing of g_malloc,
34b321
g_realloc and g_free calls.
34b321
34b321
Note that, for systemtap users, glib also provides tracepoints
34b321
glib.mem_alloc, glib.mem_free, glib.mem_realloc, glib.slice_alloc
34b321
and glib.slice_free.
34b321
34b321
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
34b321
Reviewed-by: Alberto Garcia <berto@igalia.com>
34b321
Message-id: 1442417924-25831-1-git-send-email-pbonzini@redhat.com
34b321
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
34b321
(cherry picked from commit 98cf48f60aa4999f5b2808569a193a401a390e6a)
34b321
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
34b321
---
34b321
 trace-events |  3 ---
34b321
 vl.c         | 26 --------------------------
34b321
 2 files changed, 29 deletions(-)
34b321
34b321
diff --git a/trace-events b/trace-events
34b321
index af5147a..6cd46e9 100644
34b321
--- a/trace-events
34b321
+++ b/trace-events
34b321
@@ -474,9 +474,6 @@ scsi_request_sense(int target, int lun, int tag) "target %d lun %d tag %d"
34b321
 vm_state_notify(int running, int reason) "running %d reason %d"
34b321
 load_file(const char *name, const char *path) "name %s location %s"
34b321
 runstate_set(int new_state) "new state %d"
34b321
-g_malloc(size_t size, void *ptr) "size %zu ptr %p"
34b321
-g_realloc(void *ptr, size_t size, void *newptr) "ptr %p size %zu newptr %p"
34b321
-g_free(void *ptr) "ptr %p"
34b321
 qemu_system_shutdown_request(void) ""
34b321
 qemu_system_powerdown_request(void) ""
34b321
 
34b321
diff --git a/vl.c b/vl.c
34b321
index 35b927e..9756361 100644
34b321
--- a/vl.c
34b321
+++ b/vl.c
34b321
@@ -2738,26 +2738,6 @@ static const QEMUOption *lookup_opt(int argc, char **argv,
34b321
     return popt;
34b321
 }
34b321
 
34b321
-static gpointer malloc_and_trace(gsize n_bytes)
34b321
-{
34b321
-    void *ptr = malloc(n_bytes);
34b321
-    trace_g_malloc(n_bytes, ptr);
34b321
-    return ptr;
34b321
-}
34b321
-
34b321
-static gpointer realloc_and_trace(gpointer mem, gsize n_bytes)
34b321
-{
34b321
-    void *ptr = realloc(mem, n_bytes);
34b321
-    trace_g_realloc(mem, n_bytes, ptr);
34b321
-    return ptr;
34b321
-}
34b321
-
34b321
-static void free_and_trace(gpointer mem)
34b321
-{
34b321
-    trace_g_free(mem);
34b321
-    free(mem);
34b321
-}
34b321
-
34b321
 static int object_set_property(const char *name, const char *value, void *opaque)
34b321
 {
34b321
     Object *obj = OBJECT(opaque);
34b321
@@ -2832,11 +2812,6 @@ int main(int argc, char **argv, char **envp)
34b321
     bool userconfig = true;
34b321
     const char *log_mask = NULL;
34b321
     const char *log_file = NULL;
34b321
-    GMemVTable mem_trace = {
34b321
-        .malloc = malloc_and_trace,
34b321
-        .realloc = realloc_and_trace,
34b321
-        .free = free_and_trace,
34b321
-    };
34b321
     const char *trace_events = NULL;
34b321
     const char *trace_file = NULL;
34b321
     FILE *vmstate_dump_file = NULL;
34b321
@@ -2845,7 +2820,6 @@ int main(int argc, char **argv, char **envp)
34b321
     error_set_progname(argv[0]);
34b321
     qemu_init_exec_dir(argv[0]);
34b321
 
34b321
-    g_mem_set_vtable(&mem_trace);
34b321
     if (!g_thread_supported()) {
34b321
 #if !GLIB_CHECK_VERSION(2, 31, 0)
34b321
         g_thread_init(NULL);
34b321
-- 
34b321
1.8.3.1
34b321