From patchwork Tue Jul 25 09:34:53 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: 13326203 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 456E0C04E69 for ; Tue, 25 Jul 2023 09:35:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D76C26B0071; Tue, 25 Jul 2023 05:35:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D27FD8D0003; Tue, 25 Jul 2023 05:35:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BF0D36B0075; Tue, 25 Jul 2023 05:35:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id ADA566B0071 for ; Tue, 25 Jul 2023 05:35:58 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 16DDB160D0C for ; Tue, 25 Jul 2023 09:35:58 +0000 (UTC) X-FDA: 81049627596.20.27221FA Received: from mailgw02.mediatek.com (mailgw02.mediatek.com [216.200.240.185]) by imf19.hostedemail.com (Postfix) with ESMTP id BBA611A000D for ; Tue, 25 Jul 2023 09:35:55 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=mediatek.com header.s=dk header.b=X9x68mWU; dmarc=pass (policy=quarantine) header.from=mediatek.com; spf=pass (imf19.hostedemail.com: domain of kuan-ying.lee@mediatek.com designates 216.200.240.185 as permitted sender) smtp.mailfrom=kuan-ying.lee@mediatek.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690277755; 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:in-reply-to:references:references:dkim-signature; bh=of+Yq84+TCPrRdlX79cImaBtdd9LrIudC8T+juj2xpM=; b=wIBZbYM6wAIhjCdvVGjGCEyi7OHnUuLFq8tdHzTAKQYly7Ird3eM9JxSlIQDmtf9UbExQ2 b0UCr79CoiiAA9ASLL7ZmyqfB/qnRxyJywDYPGOwM8Ud5qwul5aKLm/BAyKI87MjPK4z4H Z2Ks/1r6wEUag2ezmRdzZYB4R2NSAgI= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=mediatek.com header.s=dk header.b=X9x68mWU; dmarc=pass (policy=quarantine) header.from=mediatek.com; spf=pass (imf19.hostedemail.com: domain of kuan-ying.lee@mediatek.com designates 216.200.240.185 as permitted sender) smtp.mailfrom=kuan-ying.lee@mediatek.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690277755; a=rsa-sha256; cv=none; b=5KVM6AWkuTbD0PgjEgm/rb0MN6fE8dFcAWSbJRv7ot9u7NyzQvxCCqHxk1j0VeI8PXHDZn qfZxIql73tVTVhvb2spMRlx0WnvZ2y12uaQwBWQClr6639pYd0OPBj4Giwo0BbTTjB9+kv Imb+myzOaCklOkqUCkSRTAWkMj9TmY8= X-UUID: a30ffba42ace11ee83ed1395ce914268-20230725 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=of+Yq84+TCPrRdlX79cImaBtdd9LrIudC8T+juj2xpM=; b=X9x68mWU8XgX5xftI3Ulh/FmCUOfxpQ6Jqk9gJxBbr5MZKksY/Y+rCjFk+nHyX0rt9rJOL862bd5wKxBo7qfkz0VZYwXk8SOrkvpwdRBWMsRKFNMVrmPr6A9u65fj0jdw2OHyNaRptdPGQttm/ZBSNaotPLBQa/0Erji+t9AI0s=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.29,REQID:f32dda41-722f-4905-95e0-ddcc47c571bc,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:e7562a7,CLOUDID:f1a181a0-0933-4333-8d4f-6c3c53ebd55b,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:11|1,File:nil,Bulk:nil,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,NGT X-CID-BAS: 0,NGT,0,_ X-CID-FACTOR: TF_CID_SPAM_ULN,TF_CID_SPAM_SNR X-UUID: a30ffba42ace11ee83ed1395ce914268-20230725 Received: from mtkmbs13n2.mediatek.inc [(172.21.101.108)] by mailgw02.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 2026009358; Tue, 25 Jul 2023 02:35:48 -0700 Received: from mtkmbs11n1.mediatek.inc (172.21.101.185) by mtkmbs10n1.mediatek.inc (172.21.101.34) 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:28 +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:28 +0800 From: Kuan-Ying Lee To: Jan Kiszka , Kieran Bingham , Matthias Brugger , AngeloGioacchino Del Regno CC: , , , , , , , Kuan-Ying Lee , , Subject: [PATCH 3/8] scripts/gdb/utils: add common type usage Date: Tue, 25 Jul 2023 17:34:53 +0800 Message-ID: <20230725093458.30064-4-Kuan-Ying.Lee@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230725093458.30064-1-Kuan-Ying.Lee@mediatek.com> References: <20230725093458.30064-1-Kuan-Ying.Lee@mediatek.com> MIME-Version: 1.0 X-MTK: N X-Rspamd-Queue-Id: BBA611A000D X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: actfwe1yoxh5qm4hc891a5yb947ddhos X-HE-Tag: 1690277755-724489 X-HE-Meta: U2FsdGVkX1+slYrBNYiPRnDJvqhr54Acrx5tAUewqLl6EAeSEoItUICmDrPI/IrjQOqQV0PGoZkWbBtoqzk1nfUfNOrz52mvRrVzPVr2dIJQGbi7ZWbn66PVizqhM65b0oUPEZzHk+lRQYnF5CDexN831Wx1/BU8OOTG63aUVH5YOBFYKiOgkzQh3rQ2+xJD4dZsHA00Ntiku6aMs9NaRKru+q8Fz858djUczF7gn7BZjizm00U8fBIF8W1V4srduTBkL/JJnz9uTXuwpeC1OOOmoi7QekYsyct9kpPrMsKHzSJy7/NMu/anWKmOd9pCwKFhWvKhuZ1+yRTzM8FDDGm6bLe6qlF0Z/PUJqO/aT8FAGVCCVPg+xvZlSCTEI5PDH5GWKE6rarQ/rjUQV0nZCGLuTzFMMi0OyFHrexTqfW1XaaL7g28LohaCmS+mlgembfee+qGdFvLzF2rJ4lyBlt2GfbFYO4Yiv3DxPWstVfuqIJzgXUL0oRVBcQSCbgtY6UtXS/W/as55KFLaQa+6WMXK3VZQ0yfz7wxgxn+uM6Rt7dXWiDZdVPLzYoVQyIYt8XM2J8mSJ8o0Rsp3x9ULi6f2aA7Rl97pganBcveZ6iGQBBiCiTC8oAA0XjVEmxWGKu/xawueumqr07W2JFOnRheR58OqvHUW64/NOfVwisPO32dQiNfh3MSQQDI6SednmACmyFX6OYob9ssKepnbEyZRfNHEEbiKLXTSSwEsYSqzNTrdXKqLFctNpZsXAOXe0FGo9KYiRBnIdsGTYWAMf6pJjhQSPggkAJ1FKZxgH54EDnSLY6VCL8UKVhaiPYIT9UUqOVFUNMMXT9ihvFoSUPrXCu0N+KZxv7c7DizXPlJlSwBSNepE7O/CGPivPJJZOlAEB/hqo/N1aSFw+s4JuUhnuatxWwcanB/mMJhZU4N4DjirBIh2VmBb+16lTQJwIkoW5gD61L3Csf0ff5 nWo7HJFf DIiUmEiax/06bvVRD2denC1QCE8SV8lG9WI/9WW1EDaf1l2P5l8pAfO38H6QE/oq1CmYhz8I1d0A+69bt4yqYqJe8Z8uNFzjyJX1wsXfp7JkIUBvY/PZaaffik1lu0WHYeaCvcr70ng9ClfvvmnK1wRSRUy/RgzuBs2Y3thr3uh81R500RHIWqAoQ2yHPPUrSTX1MaS6pBFe/SRrbDuPZYK6FrXvXFdnKw+EdUHoWu3dW2um5zTXx9+TZcQ== 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: Since we often use 'unsigned long', 'size_t', 'usigned int' and 'struct page', we add these common types to utils. Signed-off-by: Kuan-Ying Lee --- scripts/gdb/linux/utils.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/scripts/gdb/linux/utils.py b/scripts/gdb/linux/utils.py index 9f44df13761e..7d5278d815fa 100644 --- a/scripts/gdb/linux/utils.py +++ b/scripts/gdb/linux/utils.py @@ -35,12 +35,32 @@ class CachedType: long_type = CachedType("long") +ulong_type = CachedType("unsigned long") +uint_type = CachedType("unsigned int") atomic_long_type = CachedType("atomic_long_t") +size_t_type = CachedType("size_t") +struct_page_type = CachedType("struct page") + +def get_uint_type(): + global uint_type + return uint_type.get_type() + +def get_page_type(): + global struct_page_type + return struct_page_type.get_type() def get_long_type(): global long_type return long_type.get_type() +def get_ulong_type(): + global ulong_type + return ulong_type.get_type() + +def get_size_t_type(): + global size_t_type + return size_t_type.get_type() + def offset_of(typeobj, field): element = gdb.Value(0).cast(typeobj) return int(str(element[field].address).split()[0], 16)