History

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.

Masahiro Yamada committed 12 years ago

Commit 7fa0e6d1 parent 8ac28be1 file · +22 −11Browse files

Showing the changes to scripts/objdiff (1 of 1 file). Show all

Unified · Split

scripts/objdiff+22−11
@@ -36,7 +36,7 @@ TMPD=$SRCTREE/.tmp_objdiff · 35 unmodified lines
3636
3737 usage() {
3838 echo >&2 "Usage: $0 <command> <args>"
39− echo >&2 " record <list of object files>"
39+ echo >&2 " record <list of object files or directories>"
4040 echo >&2 " diff <commitA> <commitB>"
4141 echo >&2 " clean all | <commit>"
4242 exit 1
@@ -54,6 +54,18 @@ get_output_dir() { · 11 unmodified lines
5454 echo $TMPD/$CMT${dir#$SRCTREE}
5555 }
5656
57+do_objdump() {
58+ dir=$(get_output_dir $1)
59+ base=${1##*/}
60+ dis=$dir/${base%.o}.dis
61+
62+ [ ! -d "$dir" ] && mkdir -p $dir
63+
64+ # remove addresses for a cleaner diff
65+ # http://dummdida.tumblr.com/post/60924060451/binary-diff-between-libc-from-scientificlinux-and
66+ $OBJDUMP -D $1 | sed "s/^[[:space:]]\+[0-9a-f]\+//" > $dis
67+}
68+
5769 dorecord() {
5870 [ $# -eq 0 ] && usage
5971
@@ -63,16 +75,15 @@ dorecord() { · 3 unmodified lines
6375
6476 OBJDUMP="${CROSS_COMPILE}objdump"
6577
66− for f in $FILES; do
67− dir=$(get_output_dir $f)
68− base=${f##*/}
69− dis=$dir/${base%.o}.dis
70−
71− [ ! -d "$dir" ] && mkdir -p $dir
72−
73− # remove addresses for a cleaner diff
74− # http://dummdida.tumblr.com/post/60924060451/binary-diff-between-libc-from-scientificlinux-and
75− $OBJDUMP -D $f | sed "s/^[[:space:]]\+[0-9a-f]\+//" > $dis
78+ for d in $FILES; do
79+ if [ -d "$d" ]; then
80+ for f in $(find $d -name '*.o')
81+ do
82+ do_objdump $f
83+ done
84+ else
85+ do_objdump $d
86+ fi
7687 done
7788 }
7889