scripts: objdiff: support directories for the augument of record command
For example, $ scripts/objdiff record init drivers/usb disassembles all the objects under init and drivers/usb directories. This feature would be useful when we change various files under the specific directory. Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Acked-by: Jason Cooper <jason@lakedaemon.net> Signed-off-by: Michal Marek <mmarek@suse.cz>
This commit is contained in:
parent
8ac28bee76
commit
7fa0e6db3c
1 changed files with 22 additions and 11 deletions
|
@ -36,7 +36,7 @@ TMPD=$SRCTREE/.tmp_objdiff
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo >&2 "Usage: $0 <command> <args>"
|
echo >&2 "Usage: $0 <command> <args>"
|
||||||
echo >&2 " record <list of object files>"
|
echo >&2 " record <list of object files or directories>"
|
||||||
echo >&2 " diff <commitA> <commitB>"
|
echo >&2 " diff <commitA> <commitB>"
|
||||||
echo >&2 " clean all | <commit>"
|
echo >&2 " clean all | <commit>"
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -54,6 +54,18 @@ get_output_dir() {
|
||||||
echo $TMPD/$CMT${dir#$SRCTREE}
|
echo $TMPD/$CMT${dir#$SRCTREE}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
do_objdump() {
|
||||||
|
dir=$(get_output_dir $1)
|
||||||
|
base=${1##*/}
|
||||||
|
dis=$dir/${base%.o}.dis
|
||||||
|
|
||||||
|
[ ! -d "$dir" ] && mkdir -p $dir
|
||||||
|
|
||||||
|
# remove addresses for a cleaner diff
|
||||||
|
# http://dummdida.tumblr.com/post/60924060451/binary-diff-between-libc-from-scientificlinux-and
|
||||||
|
$OBJDUMP -D $1 | sed "s/^[[:space:]]\+[0-9a-f]\+//" > $dis
|
||||||
|
}
|
||||||
|
|
||||||
dorecord() {
|
dorecord() {
|
||||||
[ $# -eq 0 ] && usage
|
[ $# -eq 0 ] && usage
|
||||||
|
|
||||||
|
@ -63,16 +75,15 @@ dorecord() {
|
||||||
|
|
||||||
OBJDUMP="${CROSS_COMPILE}objdump"
|
OBJDUMP="${CROSS_COMPILE}objdump"
|
||||||
|
|
||||||
for f in $FILES; do
|
for d in $FILES; do
|
||||||
dir=$(get_output_dir $f)
|
if [ -d "$d" ]; then
|
||||||
base=${f##*/}
|
for f in $(find $d -name '*.o')
|
||||||
dis=$dir/${base%.o}.dis
|
do
|
||||||
|
do_objdump $f
|
||||||
[ ! -d "$dir" ] && mkdir -p $dir
|
done
|
||||||
|
else
|
||||||
# remove addresses for a cleaner diff
|
do_objdump $d
|
||||||
# http://dummdida.tumblr.com/post/60924060451/binary-diff-between-libc-from-scientificlinux-and
|
fi
|
||||||
$OBJDUMP -D $f | sed "s/^[[:space:]]\+[0-9a-f]\+//" > $dis
|
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue