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
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 <unistd.h>
#include <fcntl.h>
#include <signal.h>
@@ -344,6 +348,9 @@
/* 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 @@
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 @@
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,