Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp4591907rwb; Tue, 8 Aug 2023 10:36:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IELaytNVejxD59nNHmtovZKGPjj+7Tm7ZLm3FXSGRy7ad8Zq7oeJuZdWMs7gq6jBVsvQyMB X-Received: by 2002:a17:906:10d0:b0:99c:825:6076 with SMTP id v16-20020a17090610d000b0099c08256076mr235868ejv.35.1691516212629; Tue, 08 Aug 2023 10:36:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691516212; cv=none; d=google.com; s=arc-20160816; b=bUBNk5CQ8D48PSYKW9NjcUBizc4chBbsGNzZzeCK0gHAcLjXBqofxU4NrkZeTFqoMV FPVN/qq8XyUsw7nfPqRhna/2yYKlIgZVV/YycTA74PS4dpGUgB7+OqON/+78k36KdJGV EQ15EtlL8lem1cXrMcDabzPK05dJCTKeyFX8bDU8yl8yVys0eHvK7PRdmU9ddwsQDu4q e/WKmmg7S2Dw2iDMuJuOxZ84yP97Ion43myfMetRE83eyE037mb/YOcEPf7ZbRoZPD8k QIUM5uEq06Q+GbplrFeW1NiOdKd7nDpHdFpGBa+Hv+8ZPV5T3a7Ys5ffYSo0CY8s+bbQ dPmw== 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=OtHaWkasxjIMGWU5hrDt8uzkSlnn2Mb9zapLRhKJZqvI6kLurTa8m8lIGP/nQfsTCN vDo/uZnbz/F5GmV17fuSnQDhMNW6QBCeKj0q+nW2CT2NFXOTRlUsE9vc43EKbLpgKyB5 yNn2tnt6OIYsvJFKLnO6CRvGr9MJXcAMjKVxP/fR8gK4VAv22HouCzJmV6iYNQz6M1MA wub+s3g1u0Gy6pfryAviv/6K5xdP2Z5OCa9W4GasLrdACG+4disDCruWvgSJabvSXNHD OXfDyq0ruvwJmAVLYxo6t3edZFVsXT8F0ADA2u1DJvjhiFwD4tHiGoRFA0SU0pcoVPBJ 9bSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=HbqK8pPd; 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 m18-20020a170906259200b00992b49a8f89si7831491ejb.650.2023.08.08.10.36.27; Tue, 08 Aug 2023 10:36:52 -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=HbqK8pPd; 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 S232027AbjHHQTs (ORCPT + 99 others); Tue, 8 Aug 2023 12:19:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232400AbjHHQSD (ORCPT ); Tue, 8 Aug 2023 12:18:03 -0400 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A3726A77; Tue, 8 Aug 2023 08:48:36 -0700 (PDT) X-UUID: d824fe3c35c511ee9cb5633481061a41-20230808 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=HbqK8pPdZoJOnHhDY/nJ7xMYe/pfAjXTB82e027MUDyFkgfO+wWgJ+EvzpC9v1zDaVSkRP55FrN9UaalAMgz2gbBeNlDxdA/XavIlRb9we9yGSGGcQVuqUjaeZ4jAhupeccHExHXW4LJlIPL7qumh7+SmP+Qkc6YMXKEyu9rMhI=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.31,REQID:df494657-af38-46eb-b513-6039c93ef14b,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:95 X-CID-INFO: VERSION:1.1.31,REQID:df494657-af38-46eb-b513-6039c93ef14b,IP:0,URL :0,TC:0,Content:0,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Spam_GS981B3D,ACTION :quarantine,TS:95 X-CID-META: VersionHash:0ad78a4,CLOUDID:d93a04a1-0933-4333-8d4f-6c3c53ebd55b,B ulkID:230808163036TTTRMJO3,BulkQuantity:1,Recheck:0,SF:48|38|29|28|17|19,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,NGT X-CID-BAS: 0,NGT,0,_ X-CID-FACTOR: TF_CID_SPAM_FSD,TF_CID_SPAM_ULN,TF_CID_SPAM_SNR,TF_CID_SPAM_SDM, TF_CID_SPAM_ASC,TF_CID_SPAM_FAS X-UUID: d824fe3c35c511ee9cb5633481061a41-20230808 Received: from mtkmbs14n1.mediatek.inc [(172.21.101.75)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 53193084; Tue, 08 Aug 2023 16:30:34 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.108) 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, 8 Aug 2023 16:30:33 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Tue, 8 Aug 2023 16:30:33 +0800 From: Kuan-Ying Lee To: Jan Kiszka , Kieran Bingham , Matthias Brugger , AngeloGioacchino Del Regno CC: , , , , , , , Kuan-Ying Lee , , Subject: [PATCH v2 3/8] scripts/gdb/utils: add common type usage Date: Tue, 8 Aug 2023 16:30:13 +0800 Message-ID: <20230808083020.22254-4-Kuan-Ying.Lee@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230808083020.22254-1-Kuan-Ying.Lee@mediatek.com> References: <20230808083020.22254-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, 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