From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lndn.lancelotsix.com (vps-42846194.vps.ovh.net [IPv6:2001:41d0:801:2000::2400]) by sourceware.org (Postfix) with ESMTPS id 9D30E385840F for ; Wed, 30 Mar 2022 13:22:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9D30E385840F Received: from ubuntu (unknown [IPv6:2a02:390:9086::635]) by lndn.lancelotsix.com (Postfix) with ESMTPSA id 3259D80D60; Wed, 30 Mar 2022 13:22:21 +0000 (UTC) Date: Wed, 30 Mar 2022 13:22:11 +0000 From: Lancelot SIX To: Pedro Alves Cc: gdb-patches@sourceware.org Subject: Re: [PATCH 2/3] gdbserver/linux: Access memory even if threads are running Message-ID: <20220330132033.y3w4iyuedj76rfxd@ubuntu> References: <20220330124319.2804582-1-pedro@palves.net> <20220330124319.2804582-3-pedro@palves.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220330124319.2804582-3-pedro@palves.net> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.11 (lndn.lancelotsix.com [0.0.0.0]); Wed, 30 Mar 2022 13:22:21 +0000 (UTC) X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_ABUSEAT, RCVD_IN_XBL, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Wed, 30 Mar 2022 13:22:24 -0000 > +/* Helper for read_memory/write_memory using /proc/PID/mem. Because > + we can use a single read/write call, this can be much more > + efficient than banging away at PTRACE_PEEKTEXT. Also, unlike > + PTRACE_PEEKTEXT/PTRACE_POKETEXT, this works with running threads. > + One an only one of READBUF and WRITEBUF is non-null. If READBUF is > + not null, then we're reading, otherwise we're writing. */ Hi, Seems to me that this property can be asserted. WDYT? Something like gdb_assert ((readbuf == nullptr) != (writebuf == nullptr)); should do. Best, Lancelot. > + > +static int > +proc_xfer_memory (CORE_ADDR memaddr, unsigned char *readbuf, > + const gdb_byte *writebuf, int len)