During the development process of Qualcomm DSP software, the DSP kernel program may crash. At this time, we need to determine where the program crashed to fix the BUG.
Locating the crash location of the Qualcomm DSP program is similar to standard Linux debugging. The difference is that we need to use the debugging tools provided by Qualcomm,such as hexagon-addr2line.
Enable debug symbols
First, pass -g option to compiler to generate debug symbols. Set up as follows in CMake.
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
Crash log
Get the crash log from logcat.
adb logcat -d | grep adsprpc | cut -d' ' -f2,11- >
Then the log outputs as follows.
10:27:43.124 ############################### Process on cDSP CRASHED!!!!!!! ########################################
10:27:43.124 --------------------- Crash Details are furnished below ------------------------------------
10:27:43.124 Process "/frpc/f072e6e0 test_sdk_sr" crashed in thread "fr/23672/23672" due to TLBMISS RW occurrence
10:27:43.124 Crashed Shared Object "./libdsp_skel.so" load address : 0x20A40000
10:27:43.124 fastrpc_shell_unsigned_3 load address : D00000 and size : 11CACC
10:27:43.124 Fault PC : 0xD8A974
10:27:43.124 LR : 0x20A546BC
10:27:43.124 SP : 0x203FF598
10:27:43.124 Bad VA : 0x23500000
10:27:43.124 FP : 0x203FF5B0
10:27:43.124 SSR : 0x1970471
10:27:43.124 Error code : 0x7103
10:27:43.124 Call trace :
10:27:43.125 [<20A546BC>] _Z26module_module_simpfyRK5StMatRS_S1_fRKN3dsp19sr_paras_module_pyraE+0x18E4: (./libdsp_skel.so)
10:27:43.125 [<20A546BC>] _Z26module_module_simpfyRK5StMatRS_S1_fRKN3dsp19sr_paras_module_pyraE+0x18E4: (./libdsp_skel.so)
10:27:43.125 [<20A52F50>] _Z26module_module_simpfyRK5StMatRS_S1_fRKN3dsp19sr_paras_module_pyraE+0x178: (./libdsp_skel.so)
10:27:43.125 [<20A55250>] dsp_module_simpfy+0xF8: (./libdsp_skel.so)
10:27:43.125 [<20A44158>] dsp_skel_handle_invoke+0x8E8: (./libdsp_skel.so)
10:27:43.125 [<00D59554>] remote_handle_close+0x28F8: (fastrpc_shell_unsigned_3)
10:27:43.125 [<00D4A5D8>] err_Fatal_internal0+0x8D64: (fastrpc_shell_unsigned_3)
10:27:43.125 [<00D51804>] err_Fatal_internal0+0xFF90: (fastrpc_shell_unsigned_3)
10:27:43.125 [<00D8A974>] memcpy+0x194: (fastrpc_shell_unsigned_3)
10:27:43.125 ----------------------------- End of Crash Report --------------------------------------------------
Anylasis log
We can learn from the Log:
- The dsp program crashed in libdsp_skel.so
- The load address of libdsp_skel.so is 0x20A40000
- The program crashed in function of dsp_module_simpfy+0xF8, and it’s address is 0x20A55250
- We calculate relative values, 0x20A55250 – 0x20A40000 = 0x15250
Locate program crash location
Get the line number in the source file where the crashed occured.
/your_path/hexagon-addr2line -e /your_path/libdsp_skel.so 0x15250
The command outputs:
/your_source_path/module.cpp:1069:1
Finally, founding out that the program crashed at line 1069 of module.cpp.