From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by sourceware.org (Postfix) with ESMTPS id 5C66B38515E3 for ; Thu, 25 Mar 2021 09:39:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 5C66B38515E3 Received: by mail-pf1-x42f.google.com with SMTP id x126so1421730pfc.13 for ; Thu, 25 Mar 2021 02:39:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=c5K549yLCiumGFkR4GhD/+BJRYRRgw5O28KVOrxN0QM=; b=IVSAtuR8hc61kUZuu234ZLSJHsCXQPPrK1Bk0RlofDRI3P/9KtJ4f8nNIQmq38tP9p x1jSDqq0Q9K72E9j3+qRxb1SMiLkPNKKC4SIAHmdwxLDcxgYGD5EZ79HFTz87a8jZ89O 0TyW9+JRplmYdVNSHr/p7/u5m38S+Ox3aBrc6zcmeZ3NMRHEIpIPWMmLZajipTxKSg/R J+7MVJp0jwOrrWfFmDevsO+0pXb8IBjvvmRqYanDaELi1IIVZn0lk6zPCS+yT00OkuYE 74Q4a3s25k+NXOW2TjViVUjUe4yTCHFq588vLR0HjWlNQJ0hJKuy7/PUw0EAqdXq4uKz IyCA== X-Gm-Message-State: AOAM5338siSJQLMBoZAsPb9hKQtTrJ0Gejqmo3jiuJXYO14lcXhMYpDa lLs+FGMCRBDMlwbvfEwKpiDuDAjd624UFNL+ X-Google-Smtp-Source: ABdhPJz80+T+wvz4hf4Zfr3UgsxpcMfPRZTIyX2qzA5BPE69iRhUoFTG6gXSnZY82nsLaVQGWF2FkA== X-Received: by 2002:a65:4243:: with SMTP id d3mr7031136pgq.180.1616665168482; Thu, 25 Mar 2021 02:39:28 -0700 (PDT) Received: from mail.google.com ([141.164.41.4]) by smtp.gmail.com with ESMTPSA id cv3sm5143324pjb.9.2021.03.25.02.39.27 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 25 Mar 2021 02:39:28 -0700 (PDT) Date: Thu, 25 Mar 2021 09:39:25 +0000 From: Changbin Du To: Andrew Burgess Cc: Changbin Du , gdb-patches@sourceware.org Subject: Re: [PATCH] gdb/riscv: fix creating breakpoints at invalid addresses Message-ID: <20210325093924.ak2xw6nz7jet7hml@mail.google.com> References: <20210325084757.32077-1-changbin.du@gmail.com> <20210325091752.GO5520@embecosm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210325091752.GO5520@embecosm.com> User-Agent: NeoMutt/20180716-508-7c9a6d X-Spam-Status: No, score=-13.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Mar 2021 09:39:30 -0000 On Thu, Mar 25, 2021 at 09:17:52AM +0000, Andrew Burgess wrote: > * Changbin Du via Gdb-patches [2021-03-25 08:47:57 +0000]: > > > To allow breakpoints to be created at invalid addresses, > > target_read_code() is used instead of read_code(). The > > original read_code() should be removed, otherwise the > > breakpoint command will fail. > > > > (gdb) hbreak setup_arch > > Cannot access memory at address 0xffffffe000c036ac > > > > gdb/ChangeLog: > > 2021-03-24 Changbin Du > > > > * riscv-tdep.c (riscv_breakpoint_kind_from_pc): Update. > > Can you change this to 'Remove call to read_code.' or similar. Just > saying 'Update.' isn't very helpful. > Sure, please checkout in v2. Thanks. > Approved with that change. > > Thanks, > Andrew > > > > > --- > > gdb/ChangeLog | 4 ++++ > > gdb/riscv-tdep.c | 1 - > > 2 files changed, 4 insertions(+), 1 deletion(-) > > > > diff --git a/gdb/ChangeLog b/gdb/ChangeLog > > index a548c58e8f72..a84299a2cc38 100644 > > --- a/gdb/ChangeLog > > +++ b/gdb/ChangeLog > > @@ -1,3 +1,7 @@ > > +2021-03-25 Changbin Du > > + > > + * riscv-tdep.c (riscv_breakpoint_kind_from_pc): Update. > > + > > 2021-03-24 Simon Marchi > > > > * target.h (current_top_target): Remove, make callers use the > > diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c > > index ca3efaf71cf8..c17839968465 100644 > > --- a/gdb/riscv-tdep.c > > +++ b/gdb/riscv-tdep.c > > @@ -706,7 +706,6 @@ riscv_breakpoint_kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr) > > user. */ > > if (target_read_code (*pcptr, buf, 1) == -1) > > buf[0] = 0; > > - read_code (*pcptr, buf, 1); > > } > > > > if (riscv_debug_breakpoints) > > -- > > 2.27.0 > > > > -- Cheers, Changbin Du