Message ID | 20221111195938.1499148-2-debug@rivosinc.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp941795wru; Fri, 11 Nov 2022 12:07:18 -0800 (PST) X-Google-Smtp-Source: AA0mqf6RVMWCy2QhdSHW46RAZKBqUhct5Aa1CRcUKG6JHxJvrvgkNL/Co2Mp8AwEZy/dcmDCOiKS X-Received: by 2002:a65:6d93:0:b0:44e:466f:4759 with SMTP id bc19-20020a656d93000000b0044e466f4759mr3051528pgb.194.1668197238526; Fri, 11 Nov 2022 12:07:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668197238; cv=none; d=google.com; s=arc-20160816; b=OhjmSUQAk0srHsxNOWAhpRQdVv/7/jcPoqWDJ/1DLMirqMYyf6Ba9CxcdCi3Jc1VkM R4d6VFIyM6YDf/5kGexsTVD74rux4H4NQBMT4xmAZimD4BxAWNTmosZhIPGb8zz1e7bm icCnQxfwsZBs7g9xPIJxko6Fypcog7o3Sy4eTn8UP2PmYF29LfWcP7kDapWoQAOZrzXh j20LYnoOaqWwZZ458vbe4pb2ECEo9+7hdRF+jyy5P7Nid97SUVLKI2nrR1zRXv24HS/9 CfqAd88khGOtxduLsJvhEwIN5QOvO/qzbLOLrJxNb41VC4kn7Xvo74bM1UbxEH/+ymXd 1ZTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=tiOSDnaJDiv/bd6hfVEdnOGaLX+kZWWhVL356AX2InA=; b=tWqnXj6xPf2H/EibnuYk0oe87z4FXpzoWtLj/MdViIft9/+5OZitEWlyHV6J1VLDkz OsM1Qok5cAWfifoZP+XvH16iMGA7T9UNvJ47msK1tCmsqLGuzXD96poswfrZOOLm7l/R 0j2qt+AE2kh6VGXPBPViAwxFzM5pdnVJGh6baRZLVqsTvJxXd5v0l9u8AE3HvdZRtBQ+ nrCzG4OpL+xMCORMe9c945B94hBXT1hZXviWAGDcxFqwn+lWXV5gpbCqzNyF1z0rCL+q 9mya7inf3iYSLAIy3yc6eBeefyZJSz1TPHCmXJnPV3HcFVKcidiCUHiZqqMrVA9kUded 0h0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20210112.gappssmtp.com header.s=20210112 header.b=TkeO75on; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 36-20020a631464000000b0046af0960898si3277266pgu.625.2022.11.11.12.07.03; Fri, 11 Nov 2022 12:07:18 -0800 (PST) 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=@rivosinc-com.20210112.gappssmtp.com header.s=20210112 header.b=TkeO75on; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234334AbiKKT7z (ORCPT <rfc822;winker.wchi@gmail.com> + 99 others); Fri, 11 Nov 2022 14:59:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230043AbiKKT7x (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 11 Nov 2022 14:59:53 -0500 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E46C78339C for <linux-kernel@vger.kernel.org>; Fri, 11 Nov 2022 11:59:52 -0800 (PST) Received: by mail-pj1-x1030.google.com with SMTP id e7-20020a17090a77c700b00216928a3917so8621279pjs.4 for <linux-kernel@vger.kernel.org>; Fri, 11 Nov 2022 11:59:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tiOSDnaJDiv/bd6hfVEdnOGaLX+kZWWhVL356AX2InA=; b=TkeO75onMN37rOHMxLyT5F2rMv2tOdJlZrq3BTAW7LyaUwnWA7XsEFvkuNxYWoquke 7mkmYRz9zYKcuWbugrrJlnm7+iVDndnFJOOYHKLgvbRQKN5L+CViGDPlO2sucitqGLkU bNa2JUyPusiCwvZFd3vnQkniW0amRhAJIYJ3uOq1i7WBIIvmiqrGIWo0BDFxRInY6luB nU+jCGLaxXQTkuDtVxIWHUOc1rbJtyfWeHsHJFAnFA2bJvf1tBeBuLWZoiinbqYqKCCS nWRE+3+Byu2p5BZSp1y0IaGkU6Tg3FLIIzPrkMG5Zt/yNBDKwQxD5NN608POeObXdxFq tF0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tiOSDnaJDiv/bd6hfVEdnOGaLX+kZWWhVL356AX2InA=; b=FAEcax+KrwYPrtWaZog3fMRYcBmNR47XMFPI0sfdCmRGx5Wq4L72+Wo5B4Z4zJsjna xcl0s6/pYI/JXHl00jR2tKtjKq0bcKVAtlN5deoXzJCYaeMh/PTzFr7IB8WfUhKPJW+S WnEXB1BC9KQlqPrFW5GYMDOOndyJlv1eFmPu7jz9mjyq6WyWsB+rKf4uroxTnA9RA4At paT9TPMop/poTGLFdP7cupF7KxO1p1u/rKUosGAxvXKtJ2rK0eL0cqNeAMhKb66bPExs bxNNHySs4HJFttelNh7SylGVXOQYGFcdS8eUoKlcEmYWNvuWhNKwtaJvTfUambYHja/c vmsA== X-Gm-Message-State: ANoB5plKtnFr/XQMF9y4CU+v5d5rXQfI26a8akmVpFB0cfGZdi45exrd GOwuoY9uaLQS0V21+IGu8g7yAA== X-Received: by 2002:a17:90a:5294:b0:20a:7c09:7993 with SMTP id w20-20020a17090a529400b0020a7c097993mr3635460pjh.149.1668196792427; Fri, 11 Nov 2022 11:59:52 -0800 (PST) Received: from debug.ba.rivosinc.com ([66.220.2.162]) by smtp.gmail.com with ESMTPSA id z1-20020aa79901000000b005360da6b26bsm1954866pff.159.2022.11.11.11.59.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Nov 2022 11:59:51 -0800 (PST) From: debug@rivosinc.com To: palmer@dabbelt.com Cc: jan.kiszka@siemens.com, kbingham@kernel.org, paul.walmsley@sifive.com, aou@eecs.berkeley.edu, debug@rivosinc.com, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux@rivosinc.com Subject: [PATCH] gdb-script: updated lx_current for riscv Date: Fri, 11 Nov 2022 11:59:38 -0800 Message-Id: <20221111195938.1499148-2-debug@rivosinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221111195938.1499148-1-debug@rivosinc.com> References: <20221111195938.1499148-1-debug@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749231587567742918?= X-GMAIL-MSGID: =?utf-8?q?1749231587567742918?= |
Series |
gdb-script: updated lx_current for riscv
|
|
Commit Message
Deepak Gupta
Nov. 11, 2022, 7:59 p.m. UTC
From: Deepak Gupta <debug@rivosinc.com> lx_current python gdb command defined in scripts/gdb/cpus.py updated to support riscv architecture. Signed-off-by: Deepak Gupta <debug@rivosinc.com> --- scripts/gdb/linux/cpus.py | 8 ++++++++ 1 file changed, 8 insertions(+)
Comments
On Fri, Nov 11, 2022 at 11:59:38AM -0800, debug@rivosinc.com wrote: > From: Deepak Gupta <debug@rivosinc.com> > > lx_current python gdb command defined in scripts/gdb/cpus.py updated > to support riscv architecture. The commit which added support for arm64 gave an explanation of why SP_EL0 needed to be checked. Would be nice if you could do the same here for RISC-V. See 526940e39626 ("scripts/gdb: add lx_current support for arm64") for what I mean. While you're at it, "scripts/gdb: add support for RISC-V" would appear to be a more standard $subject for this file. Thanks, Conor. > > Signed-off-by: Deepak Gupta <debug@rivosinc.com> > --- > scripts/gdb/linux/cpus.py | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/scripts/gdb/linux/cpus.py b/scripts/gdb/linux/cpus.py > index 15fc4626d236..ce6703f1e35a 100644 > --- a/scripts/gdb/linux/cpus.py > +++ b/scripts/gdb/linux/cpus.py > @@ -173,6 +173,14 @@ def get_current_task(cpu): > else: > raise gdb.GdbError("Sorry, obtaining the current task is not allowed " > "while running in userspace(EL0)") > + elif utils.is_target_arch("riscv"): > + current_task_addr = gdb.parse_and_eval("$tp") > + if((current_task_addr.cast(utils.get_long_type()) >> 63) != 0): > + current_task = current_task_addr.cast(task_ptr_type) > + return current_task.dereference() > + else: > + raise gdb.GdbError("Sorry, obtaining the current task is not allowed " > + "while running in userspace") > else: > raise gdb.GdbError("Sorry, obtaining the current task is not yet " > "supported with this arch") > -- > 2.25.1 >
On Fri, Nov 11, 2022 at 11:59:38AM -0800, debug@rivosinc.com wrote: > From: Deepak Gupta <debug@rivosinc.com> > > lx_current python gdb command defined in scripts/gdb/cpus.py updated > to support riscv architecture. > > Signed-off-by: Deepak Gupta <debug@rivosinc.com> > --- > scripts/gdb/linux/cpus.py | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/scripts/gdb/linux/cpus.py b/scripts/gdb/linux/cpus.py > index 15fc4626d236..ce6703f1e35a 100644 > --- a/scripts/gdb/linux/cpus.py > +++ b/scripts/gdb/linux/cpus.py > @@ -173,6 +173,14 @@ def get_current_task(cpu): > else: > raise gdb.GdbError("Sorry, obtaining the current task is not allowed " > "while running in userspace(EL0)") > + elif utils.is_target_arch("riscv"): > + current_task_addr = gdb.parse_and_eval("$tp") > + if((current_task_addr.cast(utils.get_long_type()) >> 63) != 0): Shouldn't there be a get_long_type().sizeof == 8 check somewhere before shifting by 63? Or are 32-bit targets not supported at all for some reason? Thanks, drew > + current_task = current_task_addr.cast(task_ptr_type) > + return current_task.dereference() > + else: > + raise gdb.GdbError("Sorry, obtaining the current task is not allowed " > + "while running in userspace") > else: > raise gdb.GdbError("Sorry, obtaining the current task is not yet " > "supported with this arch") > -- > 2.25.1 > > > _______________________________________________ > linux-riscv mailing list > linux-riscv@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-riscv
On Sun, Nov 13, 2022 at 12:13:40AM +0000, Conor Dooley wrote: > On Fri, Nov 11, 2022 at 11:59:38AM -0800, debug@rivosinc.com wrote: > > From: Deepak Gupta <debug@rivosinc.com> > > > > lx_current python gdb command defined in scripts/gdb/cpus.py updated > > to support riscv architecture. > > The commit which added support for arm64 gave an explanation of why > SP_EL0 needed to be checked. Would be nice if you could do the same here > for RISC-V. See 526940e39626 ("scripts/gdb: add lx_current support for > arm64") for what I mean. > > While you're at it, "scripts/gdb: add support for RISC-V" would appear Realised I omitted a word there, sorry: s/add support/add lx_current support/ > to be a more standard $subject for this file. > > Thanks, > Conor. > > > > > Signed-off-by: Deepak Gupta <debug@rivosinc.com> > > --- > > scripts/gdb/linux/cpus.py | 8 ++++++++ > > 1 file changed, 8 insertions(+) > > > > diff --git a/scripts/gdb/linux/cpus.py b/scripts/gdb/linux/cpus.py > > index 15fc4626d236..ce6703f1e35a 100644 > > --- a/scripts/gdb/linux/cpus.py > > +++ b/scripts/gdb/linux/cpus.py > > @@ -173,6 +173,14 @@ def get_current_task(cpu): > > else: > > raise gdb.GdbError("Sorry, obtaining the current task is not allowed " > > "while running in userspace(EL0)") > > + elif utils.is_target_arch("riscv"): > > + current_task_addr = gdb.parse_and_eval("$tp") > > + if((current_task_addr.cast(utils.get_long_type()) >> 63) != 0): > > + current_task = current_task_addr.cast(task_ptr_type) > > + return current_task.dereference() > > + else: > > + raise gdb.GdbError("Sorry, obtaining the current task is not allowed " > > + "while running in userspace") > > else: > > raise gdb.GdbError("Sorry, obtaining the current task is not yet " > > "supported with this arch") > > -- > > 2.25.1 > >
diff --git a/scripts/gdb/linux/cpus.py b/scripts/gdb/linux/cpus.py index 15fc4626d236..ce6703f1e35a 100644 --- a/scripts/gdb/linux/cpus.py +++ b/scripts/gdb/linux/cpus.py @@ -173,6 +173,14 @@ def get_current_task(cpu): else: raise gdb.GdbError("Sorry, obtaining the current task is not allowed " "while running in userspace(EL0)") + elif utils.is_target_arch("riscv"): + current_task_addr = gdb.parse_and_eval("$tp") + if((current_task_addr.cast(utils.get_long_type()) >> 63) != 0): + current_task = current_task_addr.cast(task_ptr_type) + return current_task.dereference() + else: + raise gdb.GdbError("Sorry, obtaining the current task is not allowed " + "while running in userspace") else: raise gdb.GdbError("Sorry, obtaining the current task is not yet " "supported with this arch")