123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- #!/bin/bash
- if [ $# -ne 3 ]; then
- echo 'usage: ftrace-bisect full-file test-file non-test-file'
- exit
- fi
- full=$1
- test=$2
- nontest=$3
- x=`cat $full | wc -l`
- if [ $x -eq 1 ]; then
- echo "There's only one function left, must be the bad one"
- cat $full
- exit 0
- fi
- let x=$x/2
- let y=$x+1
- if [ ! -f $full ]; then
- echo "$full does not exist"
- exit 1
- fi
- if [ -f $test ]; then
- echo -n "$test exists, delete it? [y/N]"
- read a
- if [ "$a" != "y" -a "$a" != "Y" ]; then
- exit 1
- fi
- fi
- if [ -f $nontest ]; then
- echo -n "$nontest exists, delete it? [y/N]"
- read a
- if [ "$a" != "y" -a "$a" != "Y" ]; then
- exit 1
- fi
- fi
- sed -ne "1,${x}p" $full > $test
- sed -ne "$y,\$p" $full > $nontest
|