Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- pid=$(pgrep -f mon.py)
- reader='Hewlett-Packard Company HP USB Smart Card Keyboard'
- logfile='/home/valdur55/0-mem-minimal-leak.log'
- tmpfolder='/tmp/minimal-leak'
- function readmem(){
- grep rw-p /proc/$1/maps | sed -n 's/^\([0-9a-f]*\)-\([0-9a-f]*\) .*$/\1 \2/p' | while read start stop; do gdb --batch --pid $1 -ex "dump memory $tmpfolder/$1-$start-$stop.dump 0x$start 0x$stop"; done
- }
- function analyze(){
- for f in /tmp/minimal-leak/*.dump ; do count=$(strings $f| grep $1 -c) ; echo "$f ; $count" | grep -v " ; 0" >> $logfile ; done;
- }
- mkdir -p $tmpfolder
- date >> $logfile
- readmem $pid
- analyze $reader
- rm $tmpfolder/*.dump
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement