From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 53507 invoked by alias); 15 Oct 2019 07:43:21 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 53421 invoked by uid 89); 15 Oct 2019 07:43:21 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=Chen, chen, HX-Envelope-From:sk:vincent, viewpoint X-HELO: mail-qk1-f193.google.com Received: from mail-qk1-f193.google.com (HELO mail-qk1-f193.google.com) (209.85.222.193) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 15 Oct 2019 07:43:19 +0000 Received: by mail-qk1-f193.google.com with SMTP id p10so18299548qkg.8 for ; Tue, 15 Oct 2019 00:43:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=mime-version:from:date:message-id:subject:to:cc; bh=S5waM4FEBD2TOVBcjN2IVdB1zsuOBedVrQYJmcF1Ggw=; b=MHQamxGKKklL3cpue37yatOEdSzDGviS9qqZPdbJDI/dnE5FlT683TTQcpwSa4ErdL g2QaEX9mbu2lLK0yCmS6UgDWoyM+zD6RH07EpoLHAUCxzdugSiLdiaVruEvQyU9RAgdj 7Ekct7FjdB9t1hTcQrjzcnSc1ot7ESkPacswNj95rgZ2S06CtH53tHTRnR5quswpgNP9 iZNqlGbP1oZMXao9K6a2utd3tVgdw3pWlxFceYLFP0px6xiTz8+QaY3/1/ovUo0xxPYp pOBW1K1Egvx7uZx+O9irgVxToN1UUEziSSAc74nurn5ZP7YvxPxepZdRNfv8HCPmhwV1 C08w== MIME-Version: 1.0 From: Vincent Chen Date: Tue, 15 Oct 2019 07:43:00 -0000 Message-ID: Subject: RISC-V: Is it reasonable to extend current target_description for KGDB? To: gdb@sourceware.org Cc: Paul Walmsley Content-Type: text/plain; charset="UTF-8" X-SW-Source: 2019-10/txt/msg00009.txt.bz2 Hi, I am a Linux developer and trying to add the KGDB support to the RISC-V Linux. During the porting, I encountered a GDB issue with the 'g' packet. I hope the GDB experts can give me some advice. The KGDB is a debugger provided by the kernel for users to debug kernel space through GDB. To parse the GDB packets, the KGDB has a simple gdb stub. However, this gdb stub does not support the "qSupported" packet. In this case, GDB does not know the register configuration on the remote target. From the gdb remote debugging messages, I guess GDB will assume that the remote target only supports x0~x31 plus pc registers. This will cause GDB not to query the remote target about the content of the specified register by sending a "p" packet If the specified register does not belong to the register list of the "g" packet. In other words, GDB only can get the information of x0~x31 plus pc registers from KGDB. One way to solve this problem may be to add 'qSupported' packet support to the KGDB's gdb stub. However, I think this may be a bit inappropriate because the KGDB in RISC-V only reports 36 registers, namely 32 GPRs, $PC, $sstatus, $sbadaddr and $scause. Therefore, from the viewpoint of KGDB, if the register list of the 'p' packet can include these 36 registers, the complex implementation for the register query flow will be unnecessary. In fact, I found that other architectures (such as ARM, ARM64, and PowerPC) make the register list of the 'p' packet include all reported registers. However, I am not familiar with GDB, and I don't know if the current GDB implementation has some limitations or points to note about achieving this feature. Therefore, I would be grateful if anyone could give me any advice or would like to implement it. Thanks Best regards Vincent Chen