From: Philippe Waroquiers Date: Wed, 18 Jul 2012 23:01:02 +0000 (+0000) Subject: Fix 303624 segmentation fault on Android 4.1 (e.g. on android emulator or Galaxy... X-Git-Tag: svn/VALGRIND_3_8_0~110 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=964de45da8647796523629d89f7e7a26ec9327d8;p=thirdparty%2Fvalgrind.git Fix 303624 segmentation fault on Android 4.1 (e.g. on android emulator or Galaxy Nexus OMAP) Valgrind was crashing systematically on Android 4.1. This crash is caused by AT_IGNORE-ing AT_BASE. This AT_IGNORE was needed to have breakpoints in shared libs be handled properly (not very clear what is the problem in the interaction between Valgrind GDBSERVER, AT_BASE and GDB). Waiting to better understand all this, as a temporary bypass, this patch ensures we do not ignore the AT_BASE on android. The possible consequence is that breakpoints might be inserted by the Valgrind gdbserver at wrong addresses in shared lib. (any feedback on that is welcome). Valgrind was build and then "proved" to work on Android emulator 4.0 and emulator 4.1, by using memcheck on one executable. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12758 --- diff --git a/NEWS b/NEWS index e42f50bfc2..22c34b5a16 100644 --- a/NEWS +++ b/NEWS @@ -251,7 +251,7 @@ n-i-bz Fix assert in gdbserver for watchpoints watching the same address 303127 Power test suite fixes for frsqrte, vrefp, and vrsqrtefp instructions. 303250 "Assertion `instrs_in->arr_used <= 10000' failed" on OpenSSL with --track-origins=yes - +303624 segmentation fault on Android 4.1 (e.g. on android emulator or Galaxy Nexus OMAP) Release 3.7.0 (5 November 2011) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/README.android b/README.android index 9c43d7ee79..397a01d51a 100644 --- a/README.android +++ b/README.android @@ -6,9 +6,12 @@ This is known to work at least for : Android 4.0.3 running on a (rooted, AOSP build) Nexus S. Android 4.0.3 running on Motorola Xoom. Android 4.0.3 running on android emulator. + Android 4.1 running on android emulator. Android 2.3.4 on Nexus S worked at some time in the past. -It is known not to work on Android 4.1 running on android emulator. + +On android, GDBserver might insert breaks at wrong addresses. +Feedback on this welcome. Other configurations and toolchains might work, but haven't been tested. Feedback is welcome. diff --git a/README.android_emulator b/README.android_emulator index 4808c484b5..754895965d 100644 --- a/README.android_emulator +++ b/README.android_emulator @@ -42,8 +42,6 @@ android # Android sdk 20 # Android platform tools 12 -# Android 4.1 (API 16) does not work. - # then define a virtual device: Tools -> Manage AVDs... # I define an AVD Name with 64 Mb SD Card, (4.0.3, api 15) diff --git a/coregrind/m_initimg/initimg-linux.c b/coregrind/m_initimg/initimg-linux.c index 691b381a94..dd68d6b061 100644 --- a/coregrind/m_initimg/initimg-linux.c +++ b/coregrind/m_initimg/initimg-linux.c @@ -668,8 +668,13 @@ Addr setup_client_stack( void* init_sp, /* When gdbserver sends the auxv to gdb, the AT_BASE has to be ignored, as otherwise gdb adds this offset to loaded shared libs, causing wrong address - relocation e.g. when inserting breaks. */ + relocation e.g. when inserting breaks. + However, ignoring AT_BASE makes V crash on Android 4.1. + So, keep the AT_BASE on android for now. + ??? Need to dig in depth about AT_BASE/GDB interaction */ +# if !defined(VGPV_arm_linux_android) auxv->a_type = AT_IGNORE; +# endif auxv->u.a_val = info->interp_base; break;