Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp777049pxb; Fri, 22 Apr 2022 10:56:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyjSVybMRv4H6ZuFh0Ih22MZgoz5+TXEkbqM4pRwd6amhOMz3gM/gYgMSHKmbGJ0CvOavgx X-Received: by 2002:a05:6a00:1ac8:b0:4fa:917f:c1aa with SMTP id f8-20020a056a001ac800b004fa917fc1aamr6100681pfv.2.1650650189236; Fri, 22 Apr 2022 10:56:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650650189; cv=none; d=google.com; s=arc-20160816; b=zbdFbColdK5NYUDm3nKYd2FOgk7/q8h7drZ1UPLvtnB/ffIywLU+NkZoPWaWZGSvR6 CjkE77X8wCkFCmZKBaOc6byP/WkBu+hRgC8km4hu47dUwS0AaAk6cQwtsjktAuCeKiTn z0PeVtHpglJiModuKlzFq2TxqPGCupuIGd/gmS79U9RN9oyNYmUrVB+cglHbUDctBF71 19zR6LZETdAEmI7NsDWHI2/iIVwDdK7a9qRWn8oUVZHsW7aegfAu8X5z/bgb05hcTSpo a9P9LEljSC8PPb29lTKl1QSVmVvTY6lnS8pDk0Z3ERLUpz3esga281DdqtIKQP9HwdMO H21Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=QjO9zZCHyHzmC89BeesJw6bj4mjc3AQKTs5k6ZcDG5Q=; b=BJoD5srjRaNND1sgVMUanw/ANOI6r7g6igREmWka3/8MbSQMhlu6Tv/qxqzrOIWF2t PEP1Nb07OX+qnvGpTmgCeibf16pJgriYUBLQUlnly44fZPYmqbyRA9BM3086ivdK6oRO NA4R0BFFQXxMStmGSGph432l9/4VggkmCB8cVXtA+jj2/zXZYkc64SdCgesnfxHSCg+n duArwdWYEdM0wyRno6WcwR0j5EGTln+lM4hjAZ+4UmE1iuCLwnKqHyKm5qVBEfcPrIFO EmCuYSIH4xaEPjKjhLRqJVyCnGifgwP8VZFWMBcA11D5SoiPxfYHpdnZ8B4X4m6K3QyD gbkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=QsFsg4zg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id k63-20020a638442000000b003aa866465d3si6480550pgd.556.2022.04.22.10.56.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 10:56:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=QsFsg4zg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id AA3EEE9942; Fri, 22 Apr 2022 10:39:35 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354405AbiDSQL4 (ORCPT + 99 others); Tue, 19 Apr 2022 12:11:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232437AbiDSQLz (ORCPT ); Tue, 19 Apr 2022 12:11:55 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 21ECA1FCF7 for ; Tue, 19 Apr 2022 09:09:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650384552; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=QjO9zZCHyHzmC89BeesJw6bj4mjc3AQKTs5k6ZcDG5Q=; b=QsFsg4zgiCJfIoGiIvU4oWs5c3FQw1Wup+Y23qU8O8QsLZPkr49FLhrPIZrG7doeMDRxHu d+hrg9wqYUW6c+Tx5GZpC5gERXcaIfUaQt7qYIYXu1NhXTwzR4Q2QKvFdsx1wBBpINJilj hyxJgejtbjKJWf4wBFEIMZsvLD31bw8= Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-675-T7adfZiMNrGmlZeWpkZ84w-1; Tue, 19 Apr 2022 12:09:05 -0400 X-MC-Unique: T7adfZiMNrGmlZeWpkZ84w-1 Received: by mail-qk1-f198.google.com with SMTP id v14-20020a05620a0f0e00b00699f4ea852cso12766195qkl.9 for ; Tue, 19 Apr 2022 09:09:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=QjO9zZCHyHzmC89BeesJw6bj4mjc3AQKTs5k6ZcDG5Q=; b=ZgeEwpZ66bB5iydWK34Z5ngnQ5O6SznC78gigmhqTtld/TpQTGOxIvafJrUgeeb9pw uJuLUx0Z2MQu7MDgOf59WCH6KwcwApIgPWaVAPqKle6Nk1FKh4YfU66Yjkv4iHelPfh0 cSSxS4YB0jgB/zrzJsF1irIPdnkl6WQBRLKnyFR0fOCJQrG8C+ZCUCgQz7IomNJRw7EN v7irjI1ydjGxCpeVsOMqA3E/NYWukBLhM/WwkAwCc/uYUNNnS4iQi1PT7uK10+/cHBdZ uP1EBIz/SwfTmlm6vMrkJI/SOyXqsyrE1p4Fj+3yZEmdw+TAm+N3t79kWBZKWXCMCkhn wuaA== X-Gm-Message-State: AOAM533dXCxydOdFnD1nSB2DxgS6+cuvQaKOdTEMQHYRjgd885Uqwyr1 DHaDfx+N0nQVTEU9Mg9vQjSh+iOP2CbTjDcu71kq8Pegsy9338+J/Kdl0qphyN5HBiDJI/GHWhI vPdsRAyq8EIMrNtG3eRIDJQoC X-Received: by 2002:a05:620a:25cf:b0:699:bbc6:9e58 with SMTP id y15-20020a05620a25cf00b00699bbc69e58mr10316583qko.64.1650384543639; Tue, 19 Apr 2022 09:09:03 -0700 (PDT) X-Received: by 2002:a05:620a:25cf:b0:699:bbc6:9e58 with SMTP id y15-20020a05620a25cf00b00699bbc69e58mr10316560qko.64.1650384543400; Tue, 19 Apr 2022 09:09:03 -0700 (PDT) Received: from treble ([2600:1700:6e32:6c00::35]) by smtp.gmail.com with ESMTPSA id c20-20020a05622a059400b002e1d59e68f3sm244823qtb.48.2022.04.19.09.09.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Apr 2022 09:09:02 -0700 (PDT) Date: Tue, 19 Apr 2022 09:09:00 -0700 From: Josh Poimboeuf To: Peter Zijlstra 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: <20220419160900.2clkkvpit7zyu2o6@treble> References: <20220419111555.GR2731@worktop.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20220419111555.GR2731@worktop.programming.kicks-ass.net> X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 19, 2022 at 01:15:55PM +0200, Peter Zijlstra wrote: > 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. True, running with --posix I get awk: cmd. line:1: (FILENAME=- FNR=17142) fatal: function `strtonum' not defined The non-gawk users always ruin the party. -- Josh