From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id PXpUBqNZRGJIMAAAWB0awg (envelope-from ) for ; Wed, 30 Mar 2022 09:22:43 -0400 Received: by simark.ca (Postfix, from userid 112) id 092401F0BB; Wed, 30 Mar 2022 09:22:43 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 80BFA1E787 for ; Wed, 30 Mar 2022 09:22:42 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E562B385E449 for ; Wed, 30 Mar 2022 13:22:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E562B385E449 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1648646561; bh=gJYLhIDcMM7ayhbtT4f9ymSuCKMKocUcNZW3POzTT6w=; h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=YYJFLxT9bo6ctJ3TsYTu4jzi9igEFCUILIY7hXxG/pT4AQgS/+3TN8/xYUlC/6T5A R+EXq2CR9WfFowJZVsvHYDaUARLXJDffSqNTn4jlGu/xAJdxPxvz0joJFo+2nbeK8k mXVq0LSHQJ84Gae7kQqa4YKiizQvkgiuLdmKxMYQ= 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 To: Pedro Alves 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-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: , From: Lancelot SIX via Gdb-patches Reply-To: Lancelot SIX Cc: gdb-patches@sourceware.org Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" > +/* 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)