如何查看某个进程的所有线程的Backtrace。
执行如下命令
debuggerd -b <pid>
示例,查看Camera Provider线程的Backtrace
----- pid 3359 at 2022-08-12 00:18:08.386056243+0800 -----
Cmd line: /vendor/bin/hw/android.hardware.camera.provider@2.4-service_64
ABI: 'arm64'
"provider@2.4-se" sysTid=3359
#00 pc 000000000004d360 /apex/com.android.runtime/lib64/bionic/libc.so (syscall+32) (BuildId: c8681a00ee291f65dafed44ab8c8ee37)
#01 pc 00000000000518e8 /apex/com.android.runtime/lib64/bionic/libc.so (__futex_wait_ex(void volatile*, bool, int, bool, timespec const*)+144) (BuildId: c8681a00ee291f65dafed44ab8c8ee37)
#02 pc 00000000000b1d40 /apex/com.android.runtime/lib64/bionic/libc.so (pthread_cond_timedwait+132) (BuildId: c8681a00ee291f65dafed44ab8c8ee37)
#03 pc 000000000005858c /apex/com.android.vndk.v30/lib64/libc++.so (std::__1::condition_variable::__do_timed_wait(std::__1::unique_lock<std::__1::mutex>&, std::__1::chrono::time_point<std::__1::chrono::system_clock, std::__1::chrono::duration<long long, std::__1::ratio<1l, 1000000000l> > >)+108) (BuildId: cd7d36d61219edf4da7d788565b373c7)
#04 pc 0000000000074e04 /vendor/lib64/com.qti.feature2.gs.qtang2.so (Semaphore::WaitForSemaphore()+316) (BuildId: eb03d67b5571426803946429fe168e43)
#05 pc 00000000000314a8 /vendor/lib64/com.qti.feature2.rt.so (ChiFeature2RealTime::AcquireResource(ChiFeature2RequestObject*) const+384) (BuildId: 33212e81ea7d8dcb5ab4bc32668a3ad3)
#06 pc 00000000000240d0 /vendor/lib64/com.qti.feature2.rt.so (ChiFeature2RealTime::OnExecuteProcessRequest(ChiFeature2RequestObject*) const+5784) (BuildId: 33212e81ea7d8dcb5ab4bc32668a3ad3)
#07 pc 000000000010e984 /vendor/lib64/hw/com.qti.chi.override.so (ChiFeature2Base::HandleExecuteProcessRequest(ChiFeature2RequestObject*, unsigned char)+972) (BuildId: 6a2564ca8b4bc186bdd623215ad163d6)
#08 pc 00000000000fca50 /vendor/lib64/hw/com.qti.chi.override.so (ChiFeature2Base::OnProcessRequest(ChiFeature2RequestObject*, unsigned char)+600) (BuildId: 6a2564ca8b4bc186bdd623215ad163d6)
#09 pc 0000000000113b98 /vendor/lib64/hw/com.qti.chi.override.so (ChiFeature2Base::ProcessExecute(ChiFeature2RequestObject*, unsigned char)+248) (BuildId: 6a2564ca8b4bc186bdd623215ad163d6)
#10 pc 0000000000116858 /vendor/lib64/hw/com.qti.chi.override.so (ChiFeature2Base::ProcessRequest(ChiFeature2RequestObject*, ChiFeature2RequestCommands)+920) (BuildId: 6a2564ca8b4bc186bdd623215ad163d6)
#11 pc 00000000001503bc /vendor/lib64/hw/com.qti.chi.override.so (ChiFeature2Graph::WalkBackFromLink(ChiFeature2UsecaseRequestObject*, ChiFeature2GraphLinkData*)+7852) (BuildId: 6a2564ca8b4bc186bdd623215ad163d6)
#12 pc 00000000001675a8 /vendor/lib64/hw/com.qti.chi.override.so (ChiFeature2GraphManager::ExecuteProcessRequest(ChiFeature2UsecaseRequestObject*)+3272) (BuildId: 6a2564ca8b4bc186bdd623215ad163d6)
#13 pc 0000000000192f94 /vendor/lib64/hw/com.qti.chi.override.so (Feature2Wrapper::ExecuteProcessRequest(camera3_capture_request*)+9708) (BuildId: 6a2564ca8b4bc186bdd623215ad163d6)
#14 pc 0000000000272738 /vendor/lib64/hw/com.qti.chi.override.so (AdvancedCameraUsecase::ExecuteCaptureRequest(camera3_capture_request*)+2160) (BuildId: 6a2564ca8b4bc186bdd623215ad163d6)
#15 pc 000000000023d438 /vendor/lib64/hw/com.qti.chi.override.so (Usecase::ProcessCaptureRequest(camera3_capture_request*)+9536) (BuildId: 6a2564ca8b4bc186bdd623215ad163d6)
#16 pc 00000000001ed7ac /vendor/lib64/hw/com.qti.chi.override.so (ExtensionModule::OverrideProcessRequest(camera3_device const*, camera3_capture_request*, void*)+2900) (BuildId: 6a2564ca8b4bc186bdd623215ad163d6)
#17 pc 0000000000341250 /vendor/lib64/hw/camera.jlq.so (CamX::process_capture_request(camera3_device const*, camera3_capture_request*) (.cfi)+3736) (BuildId: f40ac5a8e2a89dfdd269cbbd70f5a602)
#18 pc 0000000000022880 /vendor/lib64/camera.device@3.4-impl.so (android::hardware::camera::device::V3_4::implementation::CameraDeviceSession::processOneCaptureRequest_3_4(android::hardware::camera::device::V3_4::CaptureRequest const&)+3312) (BuildId: 702f6b5b5198b77116656b2344645ed6)
#19 pc 0000000000021ab4 /vendor/lib64/camera.device@3.4-impl.so (android::hardware::camera::device::V3_4::implementation::CameraDeviceSession::processCaptureRequest_3_4(android::hardware::hidl_vec<android::hardware::camera::device::V3_4::CaptureRequest> const&, android::hardware::hidl_vec<android::hardware::camera::device::V3_2::BufferCache> const&, std::__1::function<void (android::hardware::camera::common::V1_0::Status, unsigned int)>)+164) (BuildId: 702f6b5b5198b77116656b2344645ed6)
#20 pc 0000000000028474 /vendor/lib64/camera.device@3.5-impl.so (android::hardware::camera::device::V3_4::implementation::CameraDeviceSession::TrampolineSessionInterface_3_4::processCaptureRequest_3_4(android::hardware::hidl_vec<android::hardware::camera::device::V3_4::CaptureRequest> const&, android::hardware::hidl_vec<android::hardware::camera::device::V3_2::BufferCache> const&, std::__1::function<void (android::hardware::camera::common::V1_0::Status, unsigned int)>)+232) (BuildId: 58bd6367cab17a21ea3e48947874f29f)
#21 pc 000000000001b54c /apex/com.android.vndk.v30/lib64/android.hardware.camera.device@3.4.so (android::hardware::camera::device::V3_4::BnHwCameraDeviceSession::_hidl_processCaptureRequest_3_4(android::hidl::base::V1_0::BnHwBase*, android::hardware::Parcel const&, android::hardware::Parcel*, std::__1::function<void (android::hardware::Parcel&)>)+564) (BuildId: 7d9fff3b3a1131847c40ee43e62f22f6)
#22 pc 000000000002c7f8 /apex/com.android.vndk.v30/lib64/android.hardware.camera.device@3.5.so (android::hardware::camera::device::V3_5::BnHwCameraDeviceSession::onTransact(unsigned int, android::hardware::Parcel const&, android::hardware::Parcel*, unsigned int, std::__1::function<void (android::hardware::Parcel&)>)+940) (BuildId: 61cda7ead86db949ddd16b35ab67686c)
#23 pc 0000000000082c78 /apex/com.android.vndk.v30/lib64/libhidlbase.so (android::hardware::BHwBinder::transact(unsigned int, android::hardware::Parcel const&, android::hardware::Parcel*, unsigned int, std::__1::function<void (android::hardware::Parcel&)>)+68) (BuildId: fc3e2389a057aeefafa6557f6d78a06b)
#24 pc 0000000000086c10 /apex/com.android.vndk.v30/lib64/libhidlbase.so (android::hardware::IPCThreadState::getAndExecuteCommand()+1076) (BuildId: fc3e2389a057aeefafa6557f6d78a06b)
#25 pc 0000000000087e58 /apex/com.android.vndk.v30/lib64/libhidlbase.so (android::hardware::IPCThreadState::joinThreadPool(bool)+96) (BuildId: fc3e2389a057aeefafa6557f6d78a06b)
#26 pc 0000000000001294 /vendor/bin/hw/android.hardware.camera.provider@2.4-service_64 (main.cfi+552) (BuildId: 985b4eccf2a3084bf02b13215e6d8b51)
#27 pc 00000000000496ac /apex/com.android.runtime/lib64/bionic/libc.so (__libc_init+96) (BuildId: c8681a00ee291f65dafed44ab8c8ee37)
......
......
"Binder:3359_3" sysTid=3674
#00 pc 000000000009e6b8 /apex/com.android.runtime/lib64/bionic/libc.so (__ioctl+8) (BuildId: c8681a00ee291f65dafed44ab8c8ee37)
#01 pc 000000000005a37c /apex/com.android.runtime/lib64/bionic/libc.so (ioctl+156) (BuildId: c8681a00ee291f65dafed44ab8c8ee37)
#02 pc 0000000000045ad4 /apex/com.android.vndk.v30/lib64/libbinder.so (android::IPCThreadState::talkWithDriver(bool)+296) (BuildId: 0b8ba93d1f5e85f99ed5490d667435d9)
#03 pc 0000000000045cc4 /apex/com.android.vndk.v30/lib64/libbinder.so (android::IPCThreadState::getAndExecuteCommand()+24) (BuildId: 0b8ba93d1f5e85f99ed5490d667435d9)
#04 pc 0000000000046580 /apex/com.android.vndk.v30/lib64/libbinder.so (android::IPCThreadState::joinThreadPool(bool)+60) (BuildId: 0b8ba93d1f5e85f99ed5490d667435d9)
#05 pc 000000000006bfb0 /apex/com.android.vndk.v30/lib64/libbinder.so (android::PoolThread::threadLoop()+24) (BuildId: 0b8ba93d1f5e85f99ed5490d667435d9)
#06 pc 00000000000154d0 /apex/com.android.vndk.v30/lib64/libutils.so (android::Thread::_threadLoop(void*)+260) (BuildId: e20dd469139162d0c9d1dc16a708a620)
#07 pc 0000000000014d94 /apex/com.android.vndk.v30/lib64/libutils.so (thread_data_t::trampoline(thread_data_t const*)+412) (BuildId: e20dd469139162d0c9d1dc16a708a620)
#08 pc 00000000000b2950 /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+204) (BuildId: c8681a00ee291f65dafed44ab8c8ee37)
#09 pc 000000000005236c /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64) (BuildId: c8681a00ee291f65dafed44ab8c8ee37)
----- end 3359 -----