From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) by sourceware.org (Postfix) with ESMTPS id 382E23858422 for ; Fri, 7 Jul 2023 17:18:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 382E23858422 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-f49.google.com with SMTP id ffacd0b85a97d-31297125334so1893100f8f.0 for ; Fri, 07 Jul 2023 10:18:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688750287; x=1691342287; h=content-transfer-encoding:in-reply-to:from:references: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=rKwpUcOyrvV1oyGMczPwVTNVnw1sObJkvCyK3O2IS14=; b=eRGKod6fW8pgcCw96d6EGCCdhVUCNdwjS+CcqTI//PVOQF6syoR/1SqfMHZkMSaNAc 08ocjjv/tCXAB0nFZ6ix1m7yUqoNZBfs296y9YhIvOrtGDwHsPw9TXbr5LUW1t1VJ+Ad Ca8SeNGwz+meR2yr9Likk4SQ8Df+jWYsmbe9L7JCXZFeR0rvTL1OFIqNzGOErMsZMZAj tltJnrIjXsB2c7TRf/xIX45noCvI2TsDn5p/1m5Y334HkotuDXdFU+PBPuPLV3wv+FC9 PA27qxn9QhdOuSPJRsrPBPnlPY4PjUYSsigDqXxSx24c2XwlSPnUolhVYZJJNGRivXcC 1+Dg== X-Gm-Message-State: ABy/qLbOYSYv7a11bhcbazkpezJEc9Z4GxKcxwHFHdg/tlMYJkINzas7 t61GWgsy/79uFZYPGl3yT0oaCY7deIM= X-Google-Smtp-Source: APBJJlFaRuXs6rF9/2KB3/b+TBR/NREiw0IDviKmFLwRt/foG8NSa5xlVnKuTRJQnd/yAvg3eh4scg== X-Received: by 2002:adf:de83:0:b0:314:3108:500a with SMTP id w3-20020adfde83000000b003143108500amr9344845wrl.0.1688750286998; Fri, 07 Jul 2023 10:18:06 -0700 (PDT) Received: from ?IPV6:2001:8a0:f91d:bc00:1b6e:208c:60cc:dcc? ([2001:8a0:f91d:bc00:1b6e:208c:60cc:dcc]) by smtp.gmail.com with ESMTPSA id k12-20020a7bc30c000000b003fba92fad35sm2971865wmj.26.2023.07.07.10.18.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 07 Jul 2023 10:18:06 -0700 (PDT) Message-ID: <0db81ff7-c2ca-0cf2-cd3a-6bb9704303f2@palves.net> Date: Fri, 7 Jul 2023 18:18:04 +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: [PATCHv8 4/6] gdb/remote: avoid SIGINT after calling remote_target::stop Content-Language: en-US To: Andrew Burgess , gdb-patches@sourceware.org References: <0d839e4d9288c80fb4cba0b7f02ea6fd52b20fc6.1686131880.git.aburgess@redhat.com> From: Pedro Alves In-Reply-To: <0d839e4d9288c80fb4cba0b7f02ea6fd52b20fc6.1686131880.git.aburgess@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.0 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: (I'll go back to reviewing the other patches in the series, but I wanted to reply to this one immediately.) I think this patch is just incorrect, design wise, and we should not merge it. There is absolutely no connection between any selected thread in GDB to the thread that eventually reports the SIGINT, because the \x03 packet carries no thread context. So GDB could ask for target_stop({pid=123, lwpid=999}), and if we end up sending \x03, the thread that gets the SIGINT could be say, {pid=123, lwpid=123}, or even {pid=666, lwpid=666}. On Windows, both GenerateConsoleCtrlEvent and DebugBreakProcess (the functions used by win32_process_target::request_interrupt()) inject a new thread in the inferior and has _thread_ thread report the event. So the thread that reports the interrupt is completely unknown to GDB at the time the \x03 is sent. Also, there's even no guarantee that you'll get a SIGINT instead of some other signal. On Windows, DebugBreakProcess results in SIGTRAP. We should just not assume that target_stop with an all-stop backend is able to stop a specific thread. Pedro Alves