From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 423C5C433F5 for ; Tue, 19 Apr 2022 11:16:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350940AbiDSLSs (ORCPT ); Tue, 19 Apr 2022 07:18:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240937AbiDSLSq (ORCPT ); Tue, 19 Apr 2022 07:18:46 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A41CB15813 for ; Tue, 19 Apr 2022 04:16:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=+T7NqF6/cRpeqLTjnKQGsYUj/qWAJ0JiGzVJuAqgZKc=; b=NLM0J+iuLWHKNpKCGCeEkDju3W PDkQdkbLIlBXas0Nakn3n7fSu48s5ZDUW6QpOBpQ6DdbQnS19dC9nv8GF14cw5CS13mZ5qjd7dK60 8w7HFmptfY6DZ9Va/WAG6CzJUVpVeQKJ1Rgx0Z4q6njNtL1jTXYEJhSvOjt634deH72Kw/UbZXmgu VZpe3Rlf8E7pJvdyyRuIQLuU8q1x5A118h1rUTeAoLMTGt6ZyP/VOCFZZPujBtsq3WNC8K9vG6abi MkFWdAAID7AWh+CaFqYcwr2N+807tAUYKQrYBSrBlWwztjAcy0NN9WBQrObTgZfb0mtr9FV9wVIT0 CLTLh7Zg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=worktop.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nglpt-006nyQ-BA; Tue, 19 Apr 2022 11:15:57 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id 36DC7986195; Tue, 19 Apr 2022 13:15:55 +0200 (CEST) Date: Tue, 19 Apr 2022 13:15:55 +0200 From: Peter Zijlstra To: Josh Poimboeuf Cc: x86@kernel.org, linux-kernel@vger.kernel.org, Miroslav Benes Subject: Re: [PATCH v2 13/25] scripts: Create objdump-func helper script Message-ID: <20220419111555.GR2731@worktop.programming.kicks-ass.net> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 18, 2022 at 09:50:32AM -0700, Josh Poimboeuf wrote: > Add a simple script which disassembles a single function from an object > file. Comes in handy for objtool warnings and kernel stack traces. > > Originally-by: Peter Zijlstra > Signed-off-by: Josh Poimboeuf > --- > scripts/objdump-func | 18 ++++++++++++++++++ > 1 file changed, 18 insertions(+) > create mode 100755 scripts/objdump-func > > diff --git a/scripts/objdump-func b/scripts/objdump-func > new file mode 100755 > index 000000000000..140646c456fc > --- /dev/null > +++ b/scripts/objdump-func > @@ -0,0 +1,18 @@ > +#!/bin/bash > +# SPDX-License-Identifier: GPL-2.0 > +# > +# Disassemble a single function. > +# > +# usage: objdump-func > + > +set -o errexit > +set -o nounset > + > +OBJDUMP="${CROSS_COMPILE:-}objdump" > + > +command -v awk >/dev/null 2>&1 || die "awk isn't installed" > + > +OBJ=$1; shift > +FUNC=$1; shift > + > +${OBJDUMP} -wdr $@ $OBJ | awk "/^\$/ { P=0; } /$FUNC[^>]*>:\$/ { P=1; O=strtonum(\"0x\" \$1); } { if (P) { o=strtonum(\"0x\" \$1); printf(\"%04x \", o-O); print \$0; } }" > -- > 2.34.1 > This might rely on awk being gawk, I'm never very careful about those things.