Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp4236171rwo; Tue, 25 Jul 2023 02:58:23 -0700 (PDT) X-Google-Smtp-Source: APBJJlH4qosgpkjeisH4SwRn7E7tXsjtCepP7wSFxJa/b/IO4+aGOiOtM4W9KPb5uqqIyXHxSQg0 X-Received: by 2002:a17:907:2718:b0:993:ec0b:1a27 with SMTP id w24-20020a170907271800b00993ec0b1a27mr12064499ejk.24.1690279103140; Tue, 25 Jul 2023 02:58:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690279103; cv=none; d=google.com; s=arc-20160816; b=sTZcv0n+71P4qraXS8RqExGPkSCMN+06QIhInzi9iRlyr2qMcXCHtSgxC/ogY8NNeI /QpGUlqQRw3B0UdI1qdZb5nqwQ8pJC4Aj+1aSPettyB3Q6K+ixwkwo/qIx7rCZZsCFIn KL/mkUv9WZ49p3X7mdqQR73Ty4SQ3AackCf6i9gwklizEO/K+mfN9kDIMENffynOzZFE ppc6gVKJKklT4UV3yD9FP3nMeCkz+FRYFnhW+TDgQErIixgyi3kk3x8JpiB4PWyhTZ+G YSZHeCAcf1bhEAmx7jDhLL0/Fg8iSSl7EB3KDDyvGcOjGzxWFxrwUZ+t996/l3Bf7R+2 cfbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=of+Yq84+TCPrRdlX79cImaBtdd9LrIudC8T+juj2xpM=; fh=6k0khTxGVH1+z7/UroFbx6JqzCpFP1yEYFy+y/7Bd9E=; b=CdTsIRfzrMygmTfAbAI8FbqkYleCqTzbJF8jK9tIZZiU72IeittK3QSl0S39Fox/gt HFRqCohrZoRUlE5y3euzgCr5mbm1CVXTYf/w5Gc28kHpOWtLUblesfbSZIfErFUKgRif XWGr+Hb/Z+0QvT1sKPkJ3ufrHHDvajOrA/TX/u/4nkVaYnkAQ+NjWI4s1+D3NuFlWk2v SLb9RO469M+qjR7KryLPjx7Qog8y9g/evXCaexrVp9ASq41JBZIrdxvqFrunXwNHcPap d9dGb4XT35ud+PAPJqnvb0ouWlL6T7kEdmVptx4WSpP5jNiUTlamoi7K+h8qRIeC91pF ff+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=X9x68mWU; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qw26-20020a170906fcba00b0098e0739532fsi7841462ejb.732.2023.07.25.02.57.58; Tue, 25 Jul 2023 02:58:23 -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=@mediatek.com header.s=dk header.b=X9x68mWU; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233355AbjGYJhM (ORCPT + 99 others); Tue, 25 Jul 2023 05:37:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233286AbjGYJgs (ORCPT ); Tue, 25 Jul 2023 05:36:48 -0400 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D24532D53; Tue, 25 Jul 2023 02:35:36 -0700 (PDT) X-UUID: 9820e9882ace11ee9cb5633481061a41-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:938e9b19-6711-4107-a6d7-c657b13f9bd6,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:09a181a0-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_SNR,TF_CID_SPAM_ULN X-UUID: 9820e9882ace11ee9cb5633481061a41-20230725 Received: from mtkmbs13n2.mediatek.inc [(172.21.101.108)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1573546419; Tue, 25 Jul 2023 17:35:29 +0800 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 Content-Type: text/plain X-MTK: N X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY,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 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) -- 2.18.0