Revision 0750112a vl.c
b/vl.c | ||
---|---|---|
2075 | 2075 |
return popt; |
2076 | 2076 |
} |
2077 | 2077 |
|
2078 |
static gpointer malloc_and_trace(gsize n_bytes) |
|
2079 |
{ |
|
2080 |
void *ptr = malloc(n_bytes); |
|
2081 |
trace_qemu_malloc(n_bytes, ptr); |
|
2082 |
return ptr; |
|
2083 |
} |
|
2084 |
|
|
2085 |
static gpointer realloc_and_trace(gpointer mem, gsize n_bytes) |
|
2086 |
{ |
|
2087 |
void *ptr = realloc(mem, n_bytes); |
|
2088 |
trace_qemu_realloc(mem, n_bytes, ptr); |
|
2089 |
return ptr; |
|
2090 |
} |
|
2091 |
|
|
2092 |
static void free_and_trace(gpointer mem) |
|
2093 |
{ |
|
2094 |
trace_qemu_free(mem); |
|
2095 |
free(mem); |
|
2096 |
} |
|
2097 |
|
|
2078 | 2098 |
int main(int argc, char **argv, char **envp) |
2079 | 2099 |
{ |
2080 | 2100 |
const char *gdbstub_dev = NULL; |
... | ... | |
2103 | 2123 |
const char *trace_file = NULL; |
2104 | 2124 |
const char *log_mask = NULL; |
2105 | 2125 |
const char *log_file = NULL; |
2126 |
GMemVTable mem_trace = { |
|
2127 |
.malloc = malloc_and_trace, |
|
2128 |
.realloc = realloc_and_trace, |
|
2129 |
.free = free_and_trace, |
|
2130 |
}; |
|
2106 | 2131 |
|
2107 | 2132 |
atexit(qemu_run_exit_notifiers); |
2108 | 2133 |
error_set_progname(argv[0]); |
2109 | 2134 |
|
2135 |
g_mem_set_vtable(&mem_trace); |
|
2136 |
|
|
2110 | 2137 |
init_clocks(); |
2111 | 2138 |
|
2112 | 2139 |
qemu_cache_utils_init(envp); |
Also available in: Unified diff