From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io1-xd32.google.com (mail-io1-xd32.google.com [IPv6:2607:f8b0:4864:20::d32]) by sourceware.org (Postfix) with ESMTPS id 1ECAF3858CDA for ; Fri, 2 Dec 2022 22:22:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1ECAF3858CDA Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-io1-xd32.google.com with SMTP id b2so3968429iof.12 for ; Fri, 02 Dec 2022 14:22:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; h=mime-version:user-agent:message-id:in-reply-to:date:references :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=x6uOrVVO4Ji2+oVuolHQjqVwwJAzoSRZ+OKZ+veISLg=; b=C8vShFd7ldyKORNFs/SWuSGONMTs6Suq2Ojb4ivFuL9NppcklFqHgFRXChH2Ogunjx 4ac6azyS5Hj3H8KVUeGro0KY0sTd8BPr7PyKcqtPwp/j568xNoabmNYBbMuOCsq5ytYZ kb1SNtUAQ8KAEJHSM+j9/rCPk+OHZW0E1WyZ7g1LJBNppeDOCh3qwDAOfObJvFBh3Cps lRKQPLxab3gVTdj3Zf5XN9w0c8ar90DM+qAtknIaXEbhiGuUn7yf5T24oMZyt+llvH8s MJj7xBMHHehsiGX8fANYZA6tRzGLM/EIxzjDVHgGR44hc3AI8bZyyyfDNcsOkPrruCEx IfnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:message-id:in-reply-to:date:references :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=x6uOrVVO4Ji2+oVuolHQjqVwwJAzoSRZ+OKZ+veISLg=; b=JlsBpP96n7D6CdB2XEgT+TE5nCbstI4hLJGc1zfVRzi+SHEq9xnPPjf1tV/1MlZyh5 c44nbVW5zVxff6sA4RLVaa7QPiU1tb6m18xqPh0utHqW1lu6/fzvVVlgHB5pUPea92z5 BrHhOAVWAKj1HnjBCcaINgCfoR8oXQYtNqsDP9/OXu3ecJ/EKjceB8PjlU//ksZ7CwIp EPbtnKf7jHBo+AWoBlwRB8MoftNOPDi7HxkPbeHUDu+iTjmmSUpsUVxN2q8Mx5m7MBR/ YS5y7kA3/Hu3VvJzhW1gxF7fBoRHq9MM9lK6LeW6YU8wvSaVgYBaPmA0jjPhUcAfzCEe MAlg== X-Gm-Message-State: ANoB5plD4btS3wq64fGl916R55XAcX6bwODITvClA3a8KvMJn/wpvv7Y xH9Jo2ftnpWa5sR8EF34cm+rVw== X-Google-Smtp-Source: AA0mqf7+UErL4eEkz2ShQr2GI0l9o/hEV9YFAwWylXT1conh/rvzMv/FVM2i4CLAyZPlEW29S6PtjA== X-Received: by 2002:a02:7306:0:b0:374:f967:4187 with SMTP id y6-20020a027306000000b00374f9674187mr35065894jab.130.1670019741223; Fri, 02 Dec 2022 14:22:21 -0800 (PST) Received: from murgatroyd (97-122-76-186.hlrn.qwest.net. [97.122.76.186]) by smtp.gmail.com with ESMTPSA id h13-20020a056602154d00b006ca9e36fec8sm3075384iow.54.2022.12.02.14.22.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Dec 2022 14:22:20 -0800 (PST) From: Tom Tromey To: Tom Tromey Cc: Hannes Domani , Hannes Domani via Gdb-patches Subject: Re: [PATCH] [RFC] Move SetConsoleCtrlHandler calls to async thread References: <20221128191526.1426-1-ssbssa.ref@yahoo.de> <20221128191526.1426-1-ssbssa@yahoo.de> <87edtjm3pm.fsf@tromey.com> <1754067492.12464828.1669921602659@mail.yahoo.com> <87zgc6lszn.fsf@tromey.com> <87o7sllr7j.fsf@tromey.com> X-Attribution: Tom Date: Fri, 02 Dec 2022 15:22:19 -0700 In-Reply-To: <87o7sllr7j.fsf@tromey.com> (Tom Tromey's message of "Fri, 02 Dec 2022 09:12:48 -0700") Message-ID: <877cz9la3o.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Tom> Another problem I thought of is what should happen with these interrupt Tom> sequences when the user puts the inferior in the background, like with Tom> "continue &". Having them stop the inferior seems wrong, the user might Tom> be trying to interrupt some gdb command instead. Tom> I don't know how this area is supposed to work. I looked into how Linux handles this. Of course, it turns out to be super complicated. I did learn some things, though. First, windows_nat_target doesn't override pass_ctrlc. However, the one it inherits calls child_pass_ctrlc, which does: #ifndef _WIN32 kill (inf->pid, SIGINT); #endif ... oops for this case. However, this function is pretty interesting because it looks for a foreground process to interrupt, and if it doesn't find one: gdb_assert_not_reached ("no inferior resumed in the fg found"); This leads me to think that if we can integrate windows_nat_target into the pass_ctrlc codepath, things should work. I have some patches to attempt this, but of course they don't really work. The main mystery right now is that in some scenarios (like the new-console scenario), when I type C-c, default_quit_handler doesn't seem to be called at all. C-break does still work. (I have this working on my branch by installing a signal handler for SIGBREAK.) So I thought maybe SIGINT is being redirected somewhere, but I couldn't find that. So once again, not sure what's going on. Maybe closer though. Tom