From patchwork Fri May 30 11:11:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 4269801 Return-Path: X-Original-To: patchwork-linux-kbuild@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 830429F1D6 for ; Fri, 30 May 2014 11:12:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A44072038C for ; Fri, 30 May 2014 11:12:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CA7F220395 for ; Fri, 30 May 2014 11:12:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752220AbaE3LMJ (ORCPT ); Fri, 30 May 2014 07:12:09 -0400 Received: from smtp.mei.co.jp ([133.183.100.20]:53342 "EHLO smtp.mei.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752703AbaE3LMI (ORCPT ); Fri, 30 May 2014 07:12:08 -0400 Received: from mail-gw.jp.panasonic.com ([157.8.1.157]) by smtp.mei.co.jp (8.12.11.20060614/3.7W/kc-maile14) with ESMTP id s4UBC5TH026118; Fri, 30 May 2014 20:12:05 +0900 (JST) Received: from epochmail.jp.panasonic.com ([157.8.1.130]) by mail.jp.panasonic.com (8.11.6p2/3.7W/kc-maili13) with ESMTP id s4UBC5J23107; Fri, 30 May 2014 20:12:05 +0900 Received: by epochmail.jp.panasonic.com (8.12.11.20060308/3.7W/lomi15) id s4UBC5ra020226; Fri, 30 May 2014 20:12:05 +0900 Received: from poodle by lomi15.jp.panasonic.com (8.12.11.20060308/3.7W) with ESMTP id s4UBC50l020182; Fri, 30 May 2014 20:12:05 +0900 Received: from beagle.diag.org (beagle.diag.org [10.184.179.16]) by poodle (Postfix) with ESMTP id 3F9B52740043; Fri, 30 May 2014 20:12:05 +0900 (JST) From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , Jason Cooper Subject: [PATCH 7/7] scripts: objdiff: support directories for the augument of record command Date: Fri, 30 May 2014 20:11:55 +0900 Message-Id: <1401448315-800-8-git-send-email-yamada.m@jp.panasonic.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1401448315-800-1-git-send-email-yamada.m@jp.panasonic.com> References: <1401448315-800-1-git-send-email-yamada.m@jp.panasonic.com> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Cc: Jason Cooper --- scripts/objdiff | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/scripts/objdiff b/scripts/objdiff index 4d3a197..661f6fe 100755 --- a/scripts/objdiff +++ b/scripts/objdiff @@ -36,7 +36,7 @@ TMPD=$SRCTREE/.tmp_objdiff usage() { echo >&2 "Usage: $0 " - echo >&2 " record " + echo >&2 " record " echo >&2 " diff " echo >&2 " clean all | " exit 1 @@ -54,6 +54,18 @@ get_output_dir() { 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 clearer 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() { [ $# -eq 0 ] && usage @@ -63,16 +75,15 @@ dorecord() { OBJDUMP="${CROSS_COMPILE}objdump" - for f in $FILES; do - dir=$(get_output_dir $f) - base=${f##*/} - dis=$dir/${base%.o}.dis - - [ ! -d "$dir" ] && mkdir -p $dir - - # remove addresses for a clearer diff - # http://dummdida.tumblr.com/post/60924060451/binary-diff-between-libc-from-scientificlinux-and - $OBJDUMP -D $f | sed "s/^[[:space:]]\+[0-9a-f]\+//" > $dis + for d in $FILES; do + if [ -d "$d" ]; then + for f in $(find $d -name '*.o') + do + do_objdump $f + done + else + do_objdump $d + fi done }