@@ -50,6 +50,7 @@
#endif
#include "qemu-common.h"
+#include "trace.h"
#include "sysemu.h"
#include "qemu_socket.h"
@@ -71,6 +72,8 @@ static void *oom_check(void *ptr)
#if defined(_WIN32)
void *qemu_memalign(size_t alignment, size_t size)
{
+ trace_qemu_memalign(alignment, size);
+
if (!size) {
abort();
}
@@ -79,6 +82,8 @@ void *qemu_memalign(size_t alignment, size_t size)
void *qemu_vmalloc(size_t size)
{
+ trace_qemu_vmalloc(size);
+
/* FIXME: this is not exactly optimal solution since VirtualAlloc
has 64Kb granularity, but at least it guarantees us that the
memory is page aligned. */
@@ -90,6 +95,7 @@ void *qemu_vmalloc(size_t size)
void qemu_vfree(void *ptr)
{
+ trace_qemu_vfree(ptr);
VirtualFree(ptr, 0, MEM_RELEASE);
}
@@ -97,6 +103,8 @@ void qemu_vfree(void *ptr)
void *qemu_memalign(size_t alignment, size_t size)
{
+ trace_qemu_memalign(alignment, size);
+
#if defined(_POSIX_C_SOURCE) && !defined(__sun__)
int ret;
void *ptr;
@@ -122,6 +130,7 @@ void *qemu_vmalloc(size_t size)
void qemu_vfree(void *ptr)
{
+ trace_qemu_vfree(ptr);
free(ptr);
}
@@ -22,6 +22,7 @@
* THE SOFTWARE.
*/
#include "qemu-common.h"
+#include "trace.h"
#include <stdlib.h>
static void *oom_check(void *ptr)
@@ -39,6 +40,7 @@ void *get_mmap_addr(unsigned long size)
void qemu_free(void *ptr)
{
+ trace_qemu_free(ptr);
free(ptr);
}
@@ -53,6 +55,7 @@ static int allow_zero_malloc(void)
void *qemu_malloc(size_t size)
{
+ trace_qemu_malloc(size);
if (!size && !allow_zero_malloc()) {
abort();
}
@@ -61,6 +64,7 @@ void *qemu_malloc(size_t size)
void *qemu_realloc(void *ptr, size_t size)
{
+ trace_qemu_realloc(ptr, size);
if (!size && !allow_zero_malloc()) {
abort();
}
@@ -22,3 +22,13 @@
# system may not have the necessary headers included.
#
# The <format-string> should be a sprintf()-compatible format string.
+
+# qemu-malloc.c
+qemu_malloc(size_t size) "size %zu"
+qemu_realloc(void *ptr, size_t size) "ptr %p size %zu"
+qemu_free(void *ptr) "ptr %p"
+
+# osdep.c
+qemu_memalign(size_t alignment, size_t size) "alignment %zu size %zu"
+qemu_valloc(size_t size) "size %zu"
+qemu_vfree(void *ptr) "ptr %p"