I want to get the back trace dump (malloc debug) of an android device. Im doing this via ADB terminal access, linux platform, root
do i need to restart the target progam first only then the kill -47 <pid> to get the back trace heap dump will success?
for now the steps i did was:
on terminal 1: setprop libc.debug.malloc.options "backtrace leak_track verbose guard"
on terminal 1: setprop libc.debug.malloc.program <target native program> (example audioserver)
on terminal 2: logcat | grep malloc_debug
on terminal 3: ps -ef | grep <target native program> (example audioserver)
on terminal 1: kill -47 <pid of target program> (retrieved at #4)
after few minutes wait, when i check in terminal 2, nothing appear saying it dumping the back trace heap
when i check in the target dir to dump the back trace heap also there is nothing, no back trace heap txt file.
Note:
I managed to get the back trace heap txt file ONLY WHEN i kill/restart the target program. refer below how i do it
after step #4, using the pid returned, i kill the target program by doing "kill -9 <pid of target program>"
then at terminal 2: message will say
11-06 13:39:26.226 22650 22650 I malloc_debug: ls: Run: 'kill -47 1234' to dump the backtrace.
11-06 13:39:26.227 22650 22650 I malloc_debug: ls: malloc debug enabled
then at terminal 1, i do `kill -47 1234`
the back trace heap dump txt successfully created in the target dir
So, my question is, do i really need to make the target program restarted first?
restarted via any way/method such as:
force stop the app using force stop button or
simply just reboot the device (quick one) or
use kill -9 command