How to associate assembly code to exact line in C program?
· One min read
gccarguments
gcc -fverbose-asm
objdumparguments
objdump -lSd
gcc argumentsgcc -fverbose-asm
objdump argumentsobjdump -lSd
cat /proc/$pid/smaps
find out the PID of the process
ps -aux
capture /proc/PID/smaps and save into some file like before_meminc.txt
wait till memory gets increased
try again step 2
find the difference between first smaps and 2nd smaps, e.g. with
diff -u before_meminc.txt after_meminc.txt
note down the address range where memory got increased
use pstack and watch command to get the right call stack
watch -n 1 'pstack $PID | tee -a $PID.stack'
C-c when we caputred right stack
check our stack file, find the functions between address range which we got from step 6.