From b5365f32d7b1dcc6c3e9be7584ce8d4f68b3e7e1 Mon Sep 17 00:00:00 2001 From: Vladimir Chtchetkine Date: Mon, 9 Aug 2010 13:33:57 -0700 Subject: Move memchecker initialization from main.c to vl-android.c (core) Also move qemu-malloc.c to common CORE and UI sources Change-Id: Ifd62ae247cc03700d85b5fc35072d73ac37cc570 --- Makefile.android | 2 +- android/main.c | 14 +++++--------- qemu-options.hx | 3 +++ vl-android.c | 18 ++++++++++++++++++ 4 files changed, 27 insertions(+), 10 deletions(-) diff --git a/Makefile.android b/Makefile.android index 779653c..a5e5de3 100644 --- a/Makefile.android +++ b/Makefile.android @@ -640,7 +640,6 @@ CORE_MISC_SOURCES = vl-android.c \ shaper.c \ charpipe.c \ tcpdump.c \ - qemu-malloc.c \ qemu-option.c \ savevm.c \ net-android.c \ @@ -719,6 +718,7 @@ UI_AND_CORE_SOURCES = osdep.c \ cutils.c \ sockets.c \ keymaps.c \ + qemu-malloc.c \ android/keycode-array.c \ android/charmap.c \ android/hw-qemud.c \ diff --git a/android/main.c b/android/main.c index 99720f5..2eba00f 100644 --- a/android/main.c +++ b/android/main.c @@ -62,9 +62,6 @@ #include "android/cmdline-option.h" #include "android/help.h" #include "hw/goldfish_nand.h" -#ifdef CONFIG_MEMCHECK -#include "memcheck/memcheck.h" -#endif // CONFIG_MEMCHECK #include "android/globals.h" #include "tcpdump.h" @@ -1395,12 +1392,6 @@ int main(int argc, char **argv) opts->trace = tracePath; } -#ifdef CONFIG_MEMCHECK - if (opts->memcheck) { - memcheck_init(opts->memcheck); - } -#endif // CONFIG_MEMCHECK - if (opts->tcpdump) { if (qemu_tcpdump_start(opts->tcpdump) < 0) { dwarning( "could not start packet capture: %s", strerror(errno)); @@ -1873,6 +1864,11 @@ int main(int argc, char **argv) args[n++] = opts->charmap; } + if (opts->memcheck) { + args[n++] = "-android-memcheck"; + args[n++] = opts->memcheck; + } + /* physical memory */ args[n++] = "-m"; args[n++] = opts->memory; diff --git a/qemu-options.hx b/qemu-options.hx index 03e3be2..1883b08 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -1630,4 +1630,7 @@ DEF("android-gui", HAS_ARG, QEMU_OPTION_android_gui, \ DEF("android-hw", HAS_ARG, QEMU_OPTION_android_hw, \ "-android-hw read hardware initialization from ini file\n") +DEF("android-memcheck", HAS_ARG, QEMU_OPTION_android_memcheck, \ + "-android-memcheck enable memory access checking on the emulated system\n") + #endif diff --git a/vl-android.c b/vl-android.c index fa32b79..12627fd 100644 --- a/vl-android.c +++ b/vl-android.c @@ -57,6 +57,10 @@ #include "android/globals.h" #include "targphys.h" +#ifdef CONFIG_MEMCHECK +#include "memcheck/memcheck.h" +#endif // CONFIG_MEMCHECK + #include #include #include @@ -344,6 +348,9 @@ char* android_op_gui = NULL; /* Path to hardware initialization file passed with -android-hw option. */ char* android_op_hwini = NULL; +/* Memory checker options. */ +char* android_op_memcheck = NULL; + extern int android_display_width; extern int android_display_height; extern int android_display_bpp; @@ -5813,6 +5820,11 @@ int main(int argc, char **argv, char **envp) case QEMU_OPTION_android_hw: android_op_hwini = (char*)optarg; break; +#ifdef CONFIG_MEMCHECK + case QEMU_OPTION_android_memcheck: + android_op_memcheck = (char*)optarg; + break; +#endif // CONFIG_MEMCHECK } } } @@ -5856,6 +5868,12 @@ int main(int argc, char **argv, char **envp) iniFile_free(hw_ini); #endif // CONFIG_STANDALONE_CORE +#ifdef CONFIG_MEMCHECK + if (android_op_memcheck) { + memcheck_init(android_op_memcheck); + } +#endif // CONFIG_MEMCHECK + #if defined(CONFIG_KVM) && defined(CONFIG_KQEMU) if (kvm_allowed && kqemu_allowed) { fprintf(stderr, -- cgit v1.1