运行 Valgrind 下 Android 上的 Bluedroid

Running Bluedroid on Android under valgrind

我正在尝试 运行 bluedroid 在 Android 5.1
上的 valgrind 下 我从 "external/valgrind"
编译并安装了 valgrind 我是 运行ning valgrind 3.11.0
我禁用了 selinux
我成功地使用 logwrapper 启动了 valgrind:

setprop wrap.com.android.bluetooth "logwrapper valgrind"

它开始了,但很快就失败了:

Zygote   setregid() failed. errno: 1
Zygote   setreuid() failed. errno: 1
libc     pthread_create sched_setscheduler call failed: Operation not permitted  
libc     pthread_create sched_setscheduler call failed: Operation not permitted  
bt_osi_alarm bool timer_create_internal(clockid_t, void**) unable to create timer with clock 9: Operation not permitted  
bt_osi_alarm The kernel might not have support for timer_create(CLOCK_BOOTTIME_ALARM): https://lwn.net/Articles/429925/

将时钟类型从 CLOCK_BOOTTIME_ALARM 更改为 CLOCK_BOOTTIME 后,在 alarm.cc 中,我能够成功地 运行 bluedroid with valgring on Android。

我的 valgrind 启动脚本:(vg.sh)

#!/system/bin/sh                                                                                                        

 PACKAGE="com.android.bluetooth"                                                                                         

 VGPARAMS='-v --error-limit=no --trace-children=yes --log-file=/sdcard/valgrind.log.%p --tool=memcheck --leak-check=no --show-reachable=no --track-origins=yes'
 export TMPDIR=/data/data/$PACKAGE                                                                                       

 /system/bin/valgrind $VGPARAMS $* 

我正常启动,设置 logwrapper:

adb shell setprop wrap.com.android.bluetooth "logwrapper /system/xbin/vg.sh"  

然后杀死蓝牙进程,然后在 valgrind 下重新启动。