From patchwork Tue Jul 25 09:34:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?S3Vhbi1ZaW5nIExlZSAo5p2O5Yag56mOKQ==?= X-Patchwork-Id: 13326201 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1D67EC0015E for ; Tue, 25 Jul 2023 09:35:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8464B8D0001; Tue, 25 Jul 2023 05:35:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7F6986B0078; Tue, 25 Jul 2023 05:35:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6E4FE8D0001; Tue, 25 Jul 2023 05:35:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 5E7876B0075 for ; Tue, 25 Jul 2023 05:35:29 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 298BC40D9E for ; Tue, 25 Jul 2023 09:35:29 +0000 (UTC) X-FDA: 81049626378.29.9892ED9 Received: from mailgw02.mediatek.com (mailgw02.mediatek.com [216.200.240.185]) by imf10.hostedemail.com (Postfix) with ESMTP id F29F3C001A for ; Tue, 25 Jul 2023 09:35:25 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=mediatek.com header.s=dk header.b=FG8WaoZJ; spf=pass (imf10.hostedemail.com: domain of kuan-ying.lee@mediatek.com designates 216.200.240.185 as permitted sender) smtp.mailfrom=kuan-ying.lee@mediatek.com; dmarc=pass (policy=quarantine) header.from=mediatek.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690277727; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=C00yyw7N4UE3CQr7IQj99NXJeOHNCH/zFRWE/gdHGS8=; b=ggx5MjMOfktfVKeprb372PhZOpts/yZhURDlVo/ok3pC728erck6Qf2fxBKudAVGfGYdME 9KXuOrirjpSBouvBk84gKgxFcYlGAAGDXbKoShecnDE1FNbnudIHbN6Nm1uCEm38MkBbKF 4l9PnsnQhbPN7F4YVm5zfFUox3jT/cY= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690277727; a=rsa-sha256; cv=none; b=0NOo8nNbj/DePOzU0Bd6KOffJVZcpJinMw7K0aCXbN2SpvtKSzdj0xDmqzArY+QXQWZM+n jQ1lTk0qZed0zwW3+6pvRPWIYg8bDgbRRDPZxUGbYr2WekrP0vNdkvRyf2reFd4620n6hl XYTN8NkWjRrvYMyhNNon0lLu9DJNVWo= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=mediatek.com header.s=dk header.b=FG8WaoZJ; spf=pass (imf10.hostedemail.com: domain of kuan-ying.lee@mediatek.com designates 216.200.240.185 as permitted sender) smtp.mailfrom=kuan-ying.lee@mediatek.com; dmarc=pass (policy=quarantine) header.from=mediatek.com X-UUID: 925fffb62ace11ee83ed1395ce914268-20230725 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:Message-ID:Date:Subject:CC:To:From; bh=C00yyw7N4UE3CQr7IQj99NXJeOHNCH/zFRWE/gdHGS8=; b=FG8WaoZJmjZ0ymIWxlWPaBDqgnjO1quo6vgPCoaMZ4oxt/6e/KyxLLzgAOGyRVnnyKNzu4I6cjrPLsWIO7e46bMm6EoOySSmmZ4Nz0ZD2IzK6Ct/E1vKp2pgeSZj51KAGSHks2gLVm8q+GJg+L+de0vr5nkxRhbvN0dS+EPSfYk=; X-CID-UNFAMILIAR: 1 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.29,REQID:a9af9f01-3831-42f6-9935-d0b1ec1832de,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:100,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:100 X-CID-INFO: VERSION:1.1.29,REQID:a9af9f01-3831-42f6-9935-d0b1ec1832de,IP:0,URL :0,TC:0,Content:0,EDM:0,RT:0,SF:100,FILE:0,BULK:0,RULE:Spam_GS981B3D,ACTIO N:quarantine,TS:100 X-CID-META: VersionHash:e7562a7,CLOUDID:fa186e42-d291-4e62-b539-43d7d78362ba,B ulkID:230725173521PY17USMJ,BulkQuantity:1,Recheck:0,SF:38|29|28|16|19|48,T C:nil,Content:0,EDM:-3,IP:nil,URL:11|1,File:nil,Bulk:40,QS:nil,BEC:nil,COL :0,OSI:0,OSA:0,AV:0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_USA,TF_CID_SPAM_FSD,TF_CID_SPAM_ULN,TF_CID_SPAM_SNR, TF_CID_SPAM_SDM,TF_CID_SPAM_ASC X-UUID: 925fffb62ace11ee83ed1395ce914268-20230725 Received: from mtkmbs14n2.mediatek.inc [(172.21.101.76)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1009685775; Tue, 25 Jul 2023 02:35:20 -0700 Received: from mtkmbs11n1.mediatek.inc (172.21.101.185) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Tue, 25 Jul 2023 17:35:17 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs11n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Tue, 25 Jul 2023 17:35:17 +0800 From: Kuan-Ying Lee To: Matthias Brugger , AngeloGioacchino Del Regno CC: , , , , , , , Kuan-Ying Lee , , Subject: [PATCH 0/8] Add GDB memory helper commands Date: Tue, 25 Jul 2023 17:34:50 +0800 Message-ID: <20230725093458.30064-1-Kuan-Ying.Lee@mediatek.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 X-MTK: N X-Rspamd-Queue-Id: F29F3C001A X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: 4gzkkoesju8yrmuhrsxqxrxo7f6wt91p X-HE-Tag: 1690277725-969653 X-HE-Meta: U2FsdGVkX19rvmKo/WMIce/r2CK7NbUkq+oPDDpQOJyeOs65Ro2ouIG0T6P9IXs9Ao9NyyhJMX3rm8WuNyzxeOMK7NbwFd7dVlDW1i0ApAXAC9nri0jOE8eYfr6tyuBeVjmmbks3MDoULAwhq0EIyGUveg1PcnhpOi3Az4xszik5/fjIdrvPyePiEeWBv9m7R3bUbrKT5yz7x4Pr1H9mwRjWWNAeb+lP/YCwGImYD8UmjfYrmlmxJL8b17EdYYzx8VuvLJdnWCYCzQ6vQP3JW2nc5GY+gUKzHu12ysocbRB7WwUXpGeSBYlIGZs3TPjdKxujlQuFbObd2vcz+6PYVyCflWXaZfPrGAZ1DFSAHwH53UgV2kYHBjrK57264EG7wC1HpWWnGoVBMujaAISiAOZAkm7X9GNtgLUg+TwKSAVXxq7XaORkwkXVhN2nNd1GEvurzM0nF3hZLcrWlA1R2heMSg1JXvwT7E4Bdujofs1nB91EyUfrQ0Zb3L31sBYeZNZSHljoMFG//jMwY7/CPswB3wY20RlHfZkffa8SxMKXFyRRJ7It6lUZFuDvSQL9oRfdtJZQOOX7uE7+3NK782gWOnfa/qt/EUcwAMzsSSi3eAbinh7fw3K2T1eNjPRm8I1XUxYZgYBbC9lltil0j+k5ZYNydwv1M/NAA7fk/XbFKU7gpMMBJJVm7VnUIFGPM+QXQfWwFSxZr5yzW5rd0MbVI/+IBDwK3eITIkxk2IYIVrCn7klUGBQrPWSrA51fDknEA5D5JymT8xsMhSlvXKHprTHi4K7J1+sm1/1wFwU3iItvL5fPL22ZRewBi2JQYhl0uj8ISDeB7PnHEWQTkXL0yF/9n26yW94VSgP1OsmZPdomcwBfPnenPaU10VCyWaKJUKodNZTilzVvuWLWMLYMb7L8/D5eKygyxTjKflC8YVB3/FOoepufXgZf1631H5iYru4/BPHY21SqMXP 2cZOZGTG PF21hHuUzhcrkOFA9PnRI1cZFhCH/oXnQY4+aDd/mLMGEJ+tWZYG1p1Ypju8WMhtsmg7/8E9YJKRDBxezl/b4Q8K21KBMWU1iSMGGOzXFm/TxXetR2h6loG8goLW1wskisEiTrS27C0k6R+VzH4J+dYhqbRIX8+Udyg7dWON5v5fK/0ChsKQEcGyxLg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Hi all, I've created some GDB commands I think useful when I debug some memory issues and kernel module issue. For memory issue, we would like to get slabinfo, slabtrace, page_owner and vmallocinfo to debug the memory issues. For module issue, we would like to query kernel module name when we get a module text address and load module symbol by specific path. This patchset is based on v6.5-rc3. Patch 1-2: - Add kernel module releated command. Patch 3-5: - Prepares for the memory-releated command. Patch 6-8: - Add memory-related commands. Kuan-Ying Lee (8): scripts/gdb/symbols: add specific ko module load command scripts/gdb/modules: add get module text support scripts/gdb/utils: add common type usage scripts/gdb/aarch64: add aarch64 page operation helper commands and configs scripts/gdb/stackdepot: Add stackdepot support scripts/gdb/page_owner: add page owner support scripts/gdb/slab: Add slab support scripts/gdb/vmalloc: add vmallocinfo support scripts/gdb/linux/constants.py.in | 59 +++ scripts/gdb/linux/mm.py | 579 +++++++++++++++++++----------- scripts/gdb/linux/modules.py | 32 +- scripts/gdb/linux/page_owner.py | 189 ++++++++++ scripts/gdb/linux/pgtable.py | 222 ++++++++++++ scripts/gdb/linux/slab.py | 322 +++++++++++++++++ scripts/gdb/linux/stackdepot.py | 54 +++ scripts/gdb/linux/symbols.py | 23 +- scripts/gdb/linux/utils.py | 20 ++ scripts/gdb/linux/vmalloc.py | 56 +++ scripts/gdb/vmlinux-gdb.py | 7 +- 11 files changed, 1356 insertions(+), 207 deletions(-) create mode 100644 scripts/gdb/linux/page_owner.py create mode 100644 scripts/gdb/linux/pgtable.py create mode 100644 scripts/gdb/linux/slab.py create mode 100644 scripts/gdb/linux/stackdepot.py create mode 100644 scripts/gdb/linux/vmalloc.py