From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) by sourceware.org (Postfix) with ESMTPS id EE9773858C27 for ; Thu, 6 Jul 2023 13:43:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EE9773858C27 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-31438512cafso641706f8f.2 for ; Thu, 06 Jul 2023 06:43:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688651025; x=1691243025; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=RQ6bGK6I8rjtbzl2sPUCmPwtkiVgIwg89MUMRfmWgqk=; b=D56QmgZpl5evg26cGS1I3+31FZSkpSvJYRWzvOeI37gAn74gE4k9dfrRcpUFzBQgkw gXoCAdydP5tiY2u0eDHWb1NGFJB7wYnr3u/ejUlW3FMa4vtZuRaMDK33SwWCZe1tA+4Q k31jcF/PmJ5exuUjJHobtfMw5iTcn70hXmvlhRm/zA/6ftYp47amiM5gz21DhLTgWEzy 7ikHsB2ob1JzPAtjnBBwBiTcOmsMYcO972YQF8A9OkWdXzqSZ8bPmyO59qev7wOYP8Fk X55QcLoXyqPmDVXWptslUDPGEBLs6s0nGzRkXWxVLqVP63QJHWn0PzbULblNuS+lr2+i 2Bpg== X-Gm-Message-State: ABy/qLZXns/G+90jLEWjoQKLCtEesVxwvFRiSMV6g8TJMLEMXbZjL8QR qh5BBHUiOg2jciZ1P5ti1nc= X-Google-Smtp-Source: APBJJlGuyu71s94YOWnkZ2UhDLibdDuHDdZUMwKX1/Ee1ySQc5UGI03j+xmu1n2ufe05EBgcdmZBJA== X-Received: by 2002:a5d:5505:0:b0:314:54f0:df35 with SMTP id b5-20020a5d5505000000b0031454f0df35mr802384wrv.16.1688651024565; Thu, 06 Jul 2023 06:43:44 -0700 (PDT) Received: from ?IPV6:2001:8a0:f91d:bc00:4994:a784:f998:13bf? ([2001:8a0:f91d:bc00:4994:a784:f998:13bf]) by smtp.gmail.com with ESMTPSA id v13-20020a5d43cd000000b00314427091a2sm1898913wrr.98.2023.07.06.06.43.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 06 Jul 2023 06:43:44 -0700 (PDT) Message-ID: Date: Thu, 6 Jul 2023 14:43:36 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH] Linux: Avoid pread64/pwrite64 for high memory addresses (PR gdb/30525) Content-Language: en-US To: Andrew Burgess , gdb-patches@sourceware.org Cc: Matt Turner References: <20230705134141.1441753-1-pedro@palves.net> <87a5wakzo4.fsf@redhat.com> From: Pedro Alves In-Reply-To: <87a5wakzo4.fsf@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi Andrew, On 2023-07-05 18:59, Andrew Burgess wrote: > Pedro Alves writes: >> + if ((off_t) offset >= 0) >> + { >> + ret = (readbuf != nullptr >> + ? pread64 (fd, readbuf, len, offset) >> + : pwrite64 (fd, writebuf, len, offset)); >> + } > > I haven't tested this, but the change looks good to me with one nit... > > I think the '{' and '}' here (and in gdbserver below) aren't GDB style, > as there's only a single statement? I don't really mind much either way, as we're not super consistent, but note that we do have a GDB-specific rule about this. Here: https://sourceware.org/gdb/wiki/Internals%20GDB-C-Coding-Standards It says: "Any two or more lines in code should be wrapped in braces, even if they are comments, as they look like separate statements:" As that says "Any two or more lines in code", I think it applies in this situation too. Pedro Alves