From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id D92AB3851C2E for ; Mon, 28 Sep 2020 12:41:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D92AB3851C2E Received: from fencepost.gnu.org ([2001:470:142:3::e]:42460) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kMsSv-0006Eh-JH; Mon, 28 Sep 2020 08:41:13 -0400 Received: from [176.228.60.248] (port=3453 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kMsSr-0005es-Af; Mon, 28 Sep 2020 08:41:13 -0400 Date: Mon, 28 Sep 2020 15:40:56 +0300 Message-Id: <83a6xam5uv.fsf@gnu.org> From: Eli Zaretskii To: Roy Qu Cc: gdb-patches@sourceware.org In-Reply-To: (message from Roy Qu via Gdb-patches on Mon, 28 Sep 2020 20:21:38 +0800) Subject: Re: the redirected stdin/out/err for new console is wrong when the gdb's stdin/out/err is already redirected References: X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham 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: Mon, 28 Sep 2020 12:41:16 -0000 > Date: Mon, 28 Sep 2020 20:21:38 +0800 > From: Roy Qu via Gdb-patches > > I'm using gdb 9.2 of mingw.org. (not mingw-w64) > With "set new-console on", gdb will create a new console and run the > debugged program in it. > Commands like "run < somefile" will redirect STDIN to the input of > 'somefile', and the STDOUT should leave to the created console. > > but when the gdb is running embedded in some IDE such as Dev-CPP and its > STDIN/STDOUT/STDERR is already redirected into the host IDE, > Console created by commands like "run < somefile" will inherit gdb's > STDOUT/STDERR value and redirect all the output to host IDE too. > (The running result should show in the debugged console, not in the IDE's > debug log window) > > So I create a patch to fix it. Thanks. I admit that I don't understand how the patch fixes the problem, and what other effects it could have. Could elaborate on each part of the changes? (Also, (HANDLE)0 is the same as NULL, isn't it?)