From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by sourceware.org (Postfix) with ESMTPS id 87B1E3850429 for ; Fri, 4 Dec 2020 01:48:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 87B1E3850429 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=alves.ped@gmail.com Received: by mail-wm1-f68.google.com with SMTP id h21so5704936wmb.2 for ; Thu, 03 Dec 2020 17:48:46 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=BqwQtP8FY1ps4QqBS8hu79QDzdrW3g3UXRIisbQUs34=; b=fUYTFCT4ArrP/FK0mT0CxzLvMaJfEkdAZQPIqJ1EhpsAhc0U6pcLe6PoCqR4JMI9Mv tv183y511ETQ8Fzd9M120soqstPplZ1QfjOJBylc6swD+iS3mqaDWGLDk8XX5XoucXBa JvxynfO5EmLn6jo4rvPzX5PA3eo3JE0Hzi2A7Su/AHwukDbI/Rdi1Sx5MqJpkXrHg692 otXUJp3Hp9PTjIuWrGbhsqpMvtxjfKDDgxPEo1YfgycjRG9nHYw/IcNFxtGvC2h/1WId nwXEA+HdSPKkD58BcD0mIuFjPgHTeQNixTq0FC6MMyc+DLRx8NK4f+NVJtkaQtUHlQ1t f6gg== X-Gm-Message-State: AOAM531ozsjGZTWWpiOswiqZgeWTJ1bAh2/AHpGehkLitaQR1bvpVSYo 61FP1s+yTBUlFeUOMEP8KbzJZl99TuYB2g== X-Google-Smtp-Source: ABdhPJxPWoZ9LpADlR2P+d3b52TGeA09JXa+SnqpBZE7lnb0EB5Skmar6XrNxdSeGl8PAvpkryoyLA== X-Received: by 2002:a7b:c0d3:: with SMTP id s19mr1506910wmh.167.1607046525104; Thu, 03 Dec 2020 17:48:45 -0800 (PST) Received: from ?IPv6:2001:8a0:f91f:e900:1d90:d745:3c32:c159? ([2001:8a0:f91f:e900:1d90:d745:3c32:c159]) by smtp.gmail.com with ESMTPSA id f16sm1536043wrp.66.2020.12.03.17.48.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 03 Dec 2020 17:48:44 -0800 (PST) Subject: Re: [PATCH v2 03/14] gdb: restore displaced step buffer bytes when another thread forks To: Simon Marchi , gdb-patches@sourceware.org References: <20201202154805.1484317-1-simon.marchi@polymtl.ca> <20201202154805.1484317-4-simon.marchi@polymtl.ca> From: Pedro Alves Message-ID: <82999a95-0964-e769-a8e1-1ccd6aa56499@palves.net> Date: Fri, 4 Dec 2020 01:48:42 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20201202154805.1484317-4-simon.marchi@polymtl.ca> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.5 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 autolearn=no 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: Fri, 04 Dec 2020 01:48:47 -0000 On 12/2/20 3:47 PM, Simon Marchi via Gdb-patches wrote: > In handle_inferior_event, where we handle forks, we make sure to restore > the bytes of the displaced stepping buffer in the child's address > space. However, we only do it when the forking thread was the one > doing a displaced step. It could happen that a thread forks while > another one is doing a displaced step. In this case, we also need to > restore the bytes in the child. > > Move the byte-restoring code outside of the condition that checks > whether the event thread was displaced stepping. > > gdb/ChangeLog: > > * infrun.c (handle_inferior_event): Restore displaced step > buffer bytes in child process when handling fork, even if fork > happened in another thread than the displaced-stepping one. OK.