Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2724666ybt; Mon, 22 Jun 2020 05:36:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxr74DWyY+hIoyvw+MM1Qqkw49LOLeMZNn2hi+GhQnqI0yh2xXTZzDGsnCuJHZGR8LWKvtM X-Received: by 2002:a05:6402:642:: with SMTP id u2mr16614710edx.230.1592829404737; Mon, 22 Jun 2020 05:36:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592829404; cv=none; d=google.com; s=arc-20160816; b=du7xLnfmZWnAloqu96jATUWjbtbyqDDyFCjPA8vTtLVKdJd0COgdTUHeCWz7aPFj1r LA3UUC5P71W86jZwK8I4ES9erIkqnFxAAipnz96JxXZNR6IxrX0CY48O403VQdSpmlR0 NtAzlJjBomlsK8Pcr1o+SdBC+MPEEanRHKtoH/lWJzmzB9gzJPUwTk923PW1C7mVNmf2 zdy/yVaSt15+UYa22Bz49n0/z166hEzdg/EY2bHfFp1hp/dhpGKR4jigVSptkCQU6QXB ezFVIhS1YqBTyxTHr5WfzNOxtI+U/4V4ZRIIaC6KXwJ8Z9JTfcGpcp/F1LfNLGn05J0o bA6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:to:from:subject :dkim-signature; bh=A9zAd0jKr1HJJKM0vzPcK7UnodFtieRjTMmElMPUxBU=; b=HpsTZ91VVgByqd5TDKHcyzsV0Cj8//n+lQtdi+8cImUIFoYCMRgTjzE/uhTCUSUvFN 8ydJYKDus3lZsAKHTrzQQglw7tuzQljIGE493+Kl9DnDnkY27PqQse0a+81RcY/3MLN3 pM4zUNLS107Q8VOf99Iuf1L8l160lx/wFpdMmM/ev9SSg/55L3AmJFWSLk6N+/SKmKDB gIAKOKS12+gQy60X8HxyChrt9RoutO8dTxSYT394KpuSRABzUV0lsoakjnvt8iL0FZf2 WyjbprK7UxWuRpTkdp3VAiCqTmKUZSSItHiUYTSDtEkBx6pSl+s1EZaaPQdUb5iehkku 4R5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@yandex-team.ru header.s=default header.b=bsEelNyo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=yandex-team.ru Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l2si8634992ejg.443.2020.06.22.05.36.22; Mon, 22 Jun 2020 05:36:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@yandex-team.ru header.s=default header.b=bsEelNyo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=yandex-team.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728278AbgFVMd7 (ORCPT + 99 others); Mon, 22 Jun 2020 08:33:59 -0400 Received: from forwardcorp1j.mail.yandex.net ([5.45.199.163]:54294 "EHLO forwardcorp1j.mail.yandex.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728226AbgFVMd5 (ORCPT ); Mon, 22 Jun 2020 08:33:57 -0400 Received: from mxbackcorp1j.mail.yandex.net (mxbackcorp1j.mail.yandex.net [IPv6:2a02:6b8:0:1619::162]) by forwardcorp1j.mail.yandex.net (Yandex) with ESMTP id D29E52E157C; Mon, 22 Jun 2020 15:33:54 +0300 (MSK) Received: from myt5-70c90f7d6d7d.qloud-c.yandex.net (myt5-70c90f7d6d7d.qloud-c.yandex.net [2a02:6b8:c12:3e2c:0:640:70c9:f7d]) by mxbackcorp1j.mail.yandex.net (mxbackcorp/Yandex) with ESMTP id tvXDMbdFDa-XriKD4Bn; Mon, 22 Jun 2020 15:33:54 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1592829234; bh=A9zAd0jKr1HJJKM0vzPcK7UnodFtieRjTMmElMPUxBU=; h=Message-ID:References:Date:To:From:Subject:In-Reply-To; b=bsEelNyo6pu+0UTIojw04wNkSSXzilBSqb+HOXjDxZEoDzE171u4gsLxUDkmvUaFf GEFo1kDGc8ZCSG3oHu1UfhXC1Sypd98uq4t5HgZdNAUTuOUJfQep/wE2of2G0Dkxzz QXgExn2gOPUOPYO+oG8g2sZnhLrzMAMQOAtsmPoc= Authentication-Results: mxbackcorp1j.mail.yandex.net; dkim=pass header.i=@yandex-team.ru Received: from dynamic-vpn.dhcp.yndx.net (dynamic-vpn.dhcp.yndx.net [2a02:6b8:b081:14::1:13]) by myt5-70c90f7d6d7d.qloud-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id hleZ2ieHdd-XrkOkvx2; Mon, 22 Jun 2020 15:33:53 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) Subject: [PATCH 4/4] scripts/decode_stacktrace: guess path to vmlinux by release name From: Konstantin Khlebnikov To: linux-kernel@vger.kernel.org, Sasha Levin , Andrew Morton Date: Mon, 22 Jun 2020 15:33:53 +0300 Message-ID: <159282923334.248444.2399153100007347838.stgit@buzz> In-Reply-To: <159282922499.248444.4883465570858385250.stgit@buzz> References: <159282922499.248444.4883465570858385250.stgit@buzz> User-Agent: StGit/0.22-39-gd257 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add option decode_stacktrace -r to specify only release name. This is enough to guess standard paths to vmlinux and modules: $ echo -e 'schedule+0x0/0x0\ntap_open+0x0/0x0 [tap]' | ./scripts/decode_stacktrace.sh -r 5.4.0-37-generic schedule (kernel/sched/core.c:4138) tap_open (drivers/net/tap.c:502) tap Signed-off-by: Konstantin Khlebnikov --- scripts/decode_stacktrace.sh | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/scripts/decode_stacktrace.sh b/scripts/decode_stacktrace.sh index 7f18ac10af03..4bdcb6d8c605 100755 --- a/scripts/decode_stacktrace.sh +++ b/scripts/decode_stacktrace.sh @@ -5,14 +5,33 @@ if [[ $# < 1 ]]; then echo "Usage:" - echo " $0 [base path] [modules path]" + echo " $0 -r | [base path] [modules path]" exit 1 fi -vmlinux=$1 -basepath=${2-auto} -modpath=$3 -release="" +if [[ $1 == "-r" ]] ; then + vmlinux="" + basepath="auto" + modpath="" + release=$2 + + for fn in {,/usr/lib/debug}/boot/vmlinux-$release{,.debug} /lib/modules/$release{,/build}/vmlinux ; do + if [ -e "$fn" ] ; then + vmlinux=$fn + break + fi + done + + if [[ $vmlinux == "" ]] ; then + echo "ERROR! vmlinux image for release $release is not found" >&2 + exit 2 + fi +else + vmlinux=$1 + basepath=${2-auto} + modpath=$3 + release="" +fi declare -A cache declare -A modcache