From patchwork Wed Apr 12 20:25:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Raghav X-Patchwork-Id: 82673 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp596941vqo; Wed, 12 Apr 2023 13:59:13 -0700 (PDT) X-Google-Smtp-Source: AKy350Y8i/T36BM4pzeHgZeZXHC09F99BV5CVgVMYe96nXgDIijbsO0DXOT4D4VewWAcFNlyJETB X-Received: by 2002:a17:907:7291:b0:930:f953:9608 with SMTP id dt17-20020a170907729100b00930f9539608mr311342ejc.0.1681333152782; Wed, 12 Apr 2023 13:59:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681333152; cv=none; d=google.com; s=arc-20160816; b=a4FrLhjDr64YaOzKulYeIuwcOOIoQE5M21c/2MFjAdHpoH9GcM2JzTKfq4RB7Xkxhm pdOsh6TqaZVcMwtlAAowBAKuUwtFpMVms9Yz9yDyjJvVP4OZc3eHOxCxVrysMUk+REi4 RAznr5JA0QwPH+5j7jEedUzaApkefoZFFeMb+9NKJW1pP4gyoykU3Xlf80qArqoMZbvZ ICRes+snbWIMySa1hTCOaItcdVoKLQ6wKVbtNBMgPZ01/neCWfttpgqeiOD39aGXug95 g1jlSvLENwL//TF/6BAATcBWKA/6ONT8qcHvybrv67odgDqVxFL/XUvH0KaovhQWTqpG 3FlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:cms-type:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :dkim-filter; bh=G7hlX/PwHSHsnQb6g7B1nnSJc0emLV9kq1u9zEYO/to=; b=L0qCgP8axq6Y9XbvA5fED8pVmwkeSozyuCJsQrGyh15bLOr8R2k7FN1jdYensnf0+i 9uyFu7LSgN1o8EPloIfm3JdIqMsxLH2MR6ZppQLVs/14ptdN8WDpNqFBwFNIIABmdWld IA4hOiTIHhMYMAe2yUn7E1jJ4W5MbDRP9czduJ4/xrCvkEWTFQQt58iODe+K2joX/pI9 3IR4WkyaqJVBhwDe/UkOM67ka/yKFl1vTbCoK3mMNj0TyXF6rjzaSwfrS6XubaHz/4ke OtsMPsX+CMFs0se1rly+w6/Ps52C5oBQr+z/qfzu9lH/7N8zWUVJe7PJDhDrzzeaCGRq CO8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=UHVqsBbX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g15-20020a1709064e4f00b0094a701e39c7si7626372ejw.148.2023.04.12.13.58.48; Wed, 12 Apr 2023 13:59:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=UHVqsBbX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230260AbjDLUe3 (ORCPT + 99 others); Wed, 12 Apr 2023 16:34:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230246AbjDLUe1 (ORCPT ); Wed, 12 Apr 2023 16:34:27 -0400 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5BED95BB5 for ; Wed, 12 Apr 2023 13:34:24 -0700 (PDT) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20230412203422euoutp02321e0a4e939b3b7223d0c0500e81d4bc~VSj0RC6gn0762407624euoutp02M for ; Wed, 12 Apr 2023 20:34:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20230412203422euoutp02321e0a4e939b3b7223d0c0500e81d4bc~VSj0RC6gn0762407624euoutp02M DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1681331662; bh=G7hlX/PwHSHsnQb6g7B1nnSJc0emLV9kq1u9zEYO/to=; h=From:To:CC:Subject:Date:References:From; b=UHVqsBbXJPXDWeVU+ruk78qMz0rvbcnwBWh5CZSQdYvoA1QDy9aeEF+IYy5GeJKEB GptLfstL5yrtkp4Vw84ZGn5JuK17h1mpVQNou2ifYGsrzXpFh/5/jYIflp2sBp5TN+ +iJy37+74jLHcvSQ8od1uGLozcrF4xeV+OIll+GQ= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20230412203421eucas1p10f6ed397d10bfcc7a02a2884cd0b1ca7~VSjz14N0b1494514945eucas1p1H; Wed, 12 Apr 2023 20:34:21 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 75.91.09503.DC517346; Wed, 12 Apr 2023 21:34:21 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20230412203420eucas1p2efd38df12efde2ca05c6b3a26f5a753b~VSjyuN-9g1224012240eucas1p2y; Wed, 12 Apr 2023 20:34:20 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20230412203420eusmtrp1180226167cdbe7f4d9ef2c9c8453f242~VSjytzIY82288322883eusmtrp1x; Wed, 12 Apr 2023 20:34:20 +0000 (GMT) X-AuditID: cbfec7f2-e8fff7000000251f-13-643715cde0cb Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 2B.02.22108.CC517346; Wed, 12 Apr 2023 21:34:20 +0100 (BST) Received: from CAMSVWEXC02.scsc.local (unknown [106.1.227.72]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20230412203420eusmtip10e0dcebf6291abed02c97f89e041d553~VSjyej_Wi0450104501eusmtip1p; Wed, 12 Apr 2023 20:34:20 +0000 (GMT) Received: from localhost (106.110.32.140) by CAMSVWEXC02.scsc.local (2002:6a01:e348::6a01:e348) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 12 Apr 2023 21:34:19 +0100 From: Pankaj Raghav To: , CC: , , , , Subject: [PATCH v2] scripts/gdb: use mem instead of core_layout to get the module address Date: Wed, 12 Apr 2023 22:25:18 +0200 Message-ID: <20230412202516.1027149-1-p.raghav@samsung.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Originating-IP: [106.110.32.140] X-ClientProxiedBy: CAMSVWEXC01.scsc.local (2002:6a01:e347::6a01:e347) To CAMSVWEXC02.scsc.local (2002:6a01:e348::6a01:e348) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrNIsWRmVeSWpSXmKPExsWy7djP87pnRc1TDGa+kLW4d/Mms8Wp7s1M Fpd3zWGzuDHhKaPF8eV/2RxYPTat6mTz2H5yEpPH501yAcxRXDYpqTmZZalF+nYJXBl/Lmxj LrglVjF/42q2BsbdQl2MnBwSAiYS/bPnsHYxcnEICaxglDh/opUJwvnCKLHm9Wko5zOjxNe+ j2wwLZ93PmMHsYUEljNK7O4PhLCBig59roNo2MIo8bhpCVA3BwebgJZEYydYvYiAscSLycf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iz7UuNoiij4wSf16fY4RwtjBK7N5y nqWLkYODTUBLorGTHaRBRMBY4sXkY2wgNrNAjcTjDavB4sICkRKr9x9nBrFZBFQldnxrZAGx eQWsJT68vsYOMkZCQF5i8QMJiLCgxMmZT1ggxshLNG+dzQxhS0gcfPGCGeI2JYmGzWdYIOxa ic9/nzFOYBSahaR9FpL2WUjaFzAyr2IUSS0tzk3PLTbUK07MLS7NS9dLzs/dxAiMmW3Hfm7e wTjv1Ue9Q4xMHIyHGCU4mJVEeH+4mKYI8aYkVlalFuXHF5XmpBYfYjQFemcis5Rocj4wavNK 4g3NDEwNTcwsDUwtzYyVxHk9CzoShQTSE0tSs1NTC1KLYPqYODilGpiChdVb5v/cUvGoVjLt xc5kK9m17nXKuzY8WtJT/y8/e53Km+mzbqwNlf4los9tfdJvjnT3/Jn3zs6znK2rsl9+7pK9 yk+vJB+2FXUv+v4jKPRkrlOA1rzYkLrLwkIuK1/rtXo58qzey1o2g2NV9bvljk8f7wy+EK58 9c9i/Y9XdnPzqEdPcjFe8fjPmmKF/3OtIqcWHV3w72t6xpIIy4WCwu760yUfxqd7+VV/nLPz 8for7027xS5a+LSFneLW+33OyKxo8Y2z3itYz2/5377TT05zSZPV/G0v5E+fWSulfaNrq5H9 6udfrxTv2HYsxSAodIdcf//+Vq2VTA1fkr/OO3uj/k7sCsMAC/E61qjVSizFGYmGWsxFxYkA 1jU7ECIDAAA= X-CMS-MailID: 20230412203420eucas1p2efd38df12efde2ca05c6b3a26f5a753b X-Msg-Generator: CA X-RootMTR: 20230412203420eucas1p2efd38df12efde2ca05c6b3a26f5a753b X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20230412203420eucas1p2efd38df12efde2ca05c6b3a26f5a753b References: X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, URIBL_BLOCKED autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763005591801306740?= X-GMAIL-MSGID: =?utf-8?q?1763005591801306740?= commit ac3b43283923 ("module: replace module_layout with module_memory") changed the struct module data structure from module_layout to module_memory. The core_layout member which is used while loading modules are not available anymore leading to the following error while running gdb: (gdb) lx-symbols loading vmlinux Python Exception : There is no member named core_layout. Error occurred in Python: There is no member named core_layout. Replace core_layout with its new counterpart mem[MOD_TEXT]. Fixes: ac3b43283923 ("module: replace module_layout with module_memory") Signed-off-by: Pankaj Raghav --- scripts/gdb/linux/constants.py.in | 3 +++ scripts/gdb/linux/modules.py | 4 ++-- scripts/gdb/linux/symbols.py | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/scripts/gdb/linux/constants.py.in b/scripts/gdb/linux/constants.py.in index 36fd2b145853..471300ba176c 100644 --- a/scripts/gdb/linux/constants.py.in +++ b/scripts/gdb/linux/constants.py.in @@ -62,6 +62,9 @@ LX_GDBPARSED(hrtimer_resolution) LX_GDBPARSED(IRQD_LEVEL) LX_GDBPARSED(IRQ_HIDDEN) +/* linux/module.h */ +LX_GDBPARSED(MOD_TEXT) + /* linux/mount.h */ LX_VALUE(MNT_NOSUID) LX_VALUE(MNT_NODEV) diff --git a/scripts/gdb/linux/modules.py b/scripts/gdb/linux/modules.py index 441b23239896..261f28640f4c 100644 --- a/scripts/gdb/linux/modules.py +++ b/scripts/gdb/linux/modules.py @@ -13,7 +13,7 @@ import gdb -from linux import cpus, utils, lists +from linux import cpus, utils, lists, constants module_type = utils.CachedType("struct module") @@ -73,7 +73,7 @@ class LxLsmod(gdb.Command): " " if utils.get_long_type().sizeof == 8 else "")) for module in module_list(): - layout = module['core_layout'] + layout = module['mem'][constants.LX_MOD_TEXT] gdb.write("{address} {name:<19} {size:>8} {ref}".format( address=str(layout['base']).split()[0], name=module['name'].string(), diff --git a/scripts/gdb/linux/symbols.py b/scripts/gdb/linux/symbols.py index dc07b6d12e30..fdad3f32c747 100644 --- a/scripts/gdb/linux/symbols.py +++ b/scripts/gdb/linux/symbols.py @@ -15,7 +15,7 @@ import gdb import os import re -from linux import modules, utils +from linux import modules, utils, constants if hasattr(gdb, 'Breakpoint'): @@ -109,7 +109,7 @@ lx-symbols command.""" def load_module_symbols(self, module): module_name = module['name'].string() - module_addr = str(module['core_layout']['base']).split()[0] + module_addr = str(module['mem'][constants.LX_MOD_TEXT]['base']).split()[0] module_file = self._get_module_file(module_name) if not module_file and not self.module_files_updated: