在valgrind下在Android上运行Bluedroid

时间:2018-01-23 05:48:08

标签: android valgrind android-source android-bluetooth

我试图在Android 5.1的valgrind下运行bluedroid 我编译并安装了来自" external / valgrind"
的valgrind 我正在运行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/

1 个答案:

答案 0 :(得分:0)

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

我的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下重启。