backtrace: #00 pc 00000000003bce1c /system/lib64/libbluetooth.so (bluetooth::Uuid::ToString() const+12) #01 pc 0000000000180388 /system/lib64/libbluetooth.so (checkIOSDevice(unsigned int, bluetooth::Uuid*) [clone .cfi]+136) #02 pc 000000000018442c /system/lib64/libbluetooth.so (btif_dm_search_services_evt(unsigned short, char*) [clone .cfi]+1388) #03 pc 000000000017cfbc /system/lib64/libbluetooth.so (bt_jni_msg_ready(void*) [clone .cfi]+136) #04 pc 0000000000096908 /system/lib64/libchrome.so (base::debug::TaskAnnotator::RunTask(char const*, base::PendingTask*)+248) #05 pc 00000000000afd14 /system/lib64/libchrome.so (base::MessageLoop::RunTask(base::PendingTask*)+416) #06 pc 00000000000affbc /system/lib64/libchrome.so (base::MessageLoop::DeferOrRunPendingTask(base::PendingTask)+52) #07 pc 00000000000b03f8 /system/lib64/libchrome.so (base::MessageLoop::DoWork()+380) #08 pc 00000000000b1790 /system/lib64/libchrome.so (base::MessagePumpDefault::Run(base::MessagePump::Delegate*)+180) #09 pc 00000000000afa08 /system/lib64/libchrome.so (base::MessageLoop::RunHandler()+112) #10 pc 00000000000cc60c /system/lib64/libchrome.so (base::RunLoop::Run()+136) #11 pc 000000000017d54c /system/lib64/libbluetooth.so (run_message_loop(void*) [clone .cfi]+348) #12 pc 00000000002b6164 /system/lib64/libbluetooth.so (work_queue_read_cb(void*) [clone .cfi]+120) #13 pc 00000000002b460c /system/lib64/libbluetooth.so (run_reactor(reactor_t*, int) [clone .cfi]+416) #14 pc 00000000002b4440 /system/lib64/libbluetooth.so (reactor_start(reactor_t*) [clone .cfi]+84) #15 pc 00000000002b5f14 /system/lib64/libbluetooth.so (run_thread(void*) [clone .cfi]+188) #16 pc 00000000000819b4 /system/lib64/libc.so (__pthread_start(void*)+36) #17 pc 0000000000023478 /system/lib64/libc.so (__start_thread+68)
// 以下信息以简述描述 // 栈信息 // 各个寄存器附近的内存信息 // 崩溃附近的log日志 // 各个线程栈信息 // 崩溃附近的所有线程的日志信息 --------- log main 09-1315:40:03.9521845918500 W bt_btm_ble: btm_ble_process_adv_pkt_cont device no longer discoverable, discarding advertising packet 09-1315:40:03.9671845918500 W bt_btm_ble: btm_ble_process_adv_pkt_cont device no longer discoverable, discarding advertising packet 09-1315:40:04.0061845918480 D bt_btif_config: btif_get_device_type: Device [b8:c7:4a:77:58:1e] type 1 09-1315:40:04.0071845918480 W BluetoothRemoteDevices: Skip name update for B8:C7:4A:77:58:1E 09-13 15:40:04.007 18459 18480 W BluetoothRemoteDevices: Skip class update for B8:C7:4A:77:58:1E 09-1315:40:04.0161845918500 W bt_btm_ble: btm_ble_process_adv_pkt_cont device no longer discoverable, discarding advertising packet 09-1315:40:04.1311845918500 W bt_btm_ble: btm_ble_process_adv_pkt_cont device no longer discoverable, discarding advertising packet 09-1315:40:04.1401845918500 W bt_btm_ble: btm_ble_process_adv_pkt_cont device no longer discoverable, discarding advertising packet 09-1315:40:04.1421845918480 D bt_btif_config: btif_get_device_type: Device [e0:cc:f8:71:cd:0b] type 1 09-1315:40:04.1421845918480 W BluetoothRemoteDevices: Skip name update for E0:CC:F8:71:CD:0B 09-13 15:40:04.142 18459 18480 W BluetoothRemoteDevices: Skip class update for E0:CC:F8:71:CD:0B 09-1315:40:04.1561845918500 W bt_btm_ble: btm_ble_process_adv_pkt_cont device no ......
2.调查过程
从日志信息中,我们首先看日志前几行,定位哪个应用,那种类型的错误。
1 2
pid: 18459, tid: 18480, name: BT Service Call >>> com.android.bluetooth <<< signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x84d20a5cc8
从以上信息可以看出问题发生在BT Service Call中,包名为: com.android.bluetooth 。
错误类型是:SIGSEGV段错误,内存地址指向:0x84d20a5cc8
确定应用和错误类型之后,开始分析trace文件
1 2 3 4
#00 pc 00000000003bce1c /system/lib64/libbluetooth.so (bluetooth::Uuid::ToString() const+12) #01 pc 0000000000180388 /system/lib64/libbluetooth.so (checkIOSDevice(unsigned int, bluetooth::Uuid*) [clone .cfi]+136) #02 pc 000000000018442c /system/lib64/libbluetooth.so (btif_dm_search_services_evt(unsigned short, char*) [clone .cfi]+1388) #03 pc 000000000017cfbc /system/lib64/libbluetooth.so (bt_jni_msg_ready(void*) [clone .cfi]+136)
BTIF_TRACE_EVENT("%s: event = %d", __func__, event); switch (event) { case BTA_DM_DISC_RES_EVT: { bt_property_t prop; uint32_t i = 0; bt_status_t ret;
...... prop.type = BT_PROPERTY_UUIDS; prop.len = 0; if ((p_data->disc_res.result == BTA_SUCCESS) && (p_data->disc_res.num_uuids > 0)) { prop.val = p_data->disc_res.p_uuid_list; prop.len = p_data->disc_res.num_uuids * Uuid::kNumBytes128; // 遍历扫描到的设备uuid for (i = 0; i < p_data->disc_res.num_uuids; i++) { std::string temp = ((p_data->disc_res.p_uuid_list + i))->ToString(); LOG_INFO(LOG_TAG, "%s index:%d uuid:%s", __func__, i, temp.c_str()); } }
...... 此处省略部分代码 ......
if (p_data->disc_res.num_uuids != 0) { /* Also write this to the NVRAM */ #ifdef BTIF_VENDOR_CHK_IOS_DEVICE // 如果有uuid就传入uuid的个数和uuid list if (checkIOSDevice(p_data->disc_res.num_uuids, p_data->disc_res.p_uuid_list)) { BTIF_TRACE_WARNING("%s:IOS device don't response carplay uuid when search services," " so do not report uuids when get_remote_services", __func__); break; } #endif ret = btif_storage_set_remote_device_property(&bd_addr, &prop); ASSERTC(ret == BT_STATUS_SUCCESS, "storing remote services failed", ret); /* Send the event to the BTIF */ HAL_CBACK(bt_hal_cbacks, remote_device_properties_cb, BT_STATUS_SUCCESS, &bd_addr, 1, &prop); } } break;