From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id m12PAe7ZcV/kJAAAWB0awg (envelope-from ) for ; Mon, 28 Sep 2020 08:41:18 -0400 Received: by simark.ca (Postfix, from userid 112) id E85C81E590; Mon, 28 Sep 2020 08:41:17 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 254F51E58A for ; Mon, 28 Sep 2020 08:41:17 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 94C543851C2E; Mon, 28 Sep 2020 12:41:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 94C543851C2E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1601296876; bh=cTc2A9fYLvmWKH368xKZzou3yeZp5DssABk0QB7t22M=; h=Date:To:In-Reply-To:Subject:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=bcr6FP164QL28uas16Zj48ej9XFs39maglnQvuv7cYXfpMWccogCCGtQE4QOoeTyI ZwX461gblMOS6rdTF+vOIhWHEPtCQdV0K0nGBghGi+aa5/PZHnoS+CgilNFxEDhzt/ LgONqeIuTGH/NCDcPzLe2PsY7rUdvtxvAln48S6A= 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> To: Roy Qu 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-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: , From: Eli Zaretskii via Gdb-patches Reply-To: Eli Zaretskii Cc: gdb-patches@sourceware.org Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" > 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?)