From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id z/QNC3JtfF8FIwAAWB0awg (envelope-from ) for ; Tue, 06 Oct 2020 09:13:22 -0400 Received: by simark.ca (Postfix, from userid 112) id 1FF361EE0F; Tue, 6 Oct 2020 09:13:22 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_REPLYTO_END_DIGIT,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 ED1491E58E for ; Tue, 6 Oct 2020 09:13:20 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 762EE3953819; Tue, 6 Oct 2020 13:13:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 762EE3953819 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1601990000; bh=FgI3rbXhj4sZpDMVemZkMVxITLwWRRyPn25n8m14894=; h=References:In-Reply-To:Date:Subject:To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=E9KB87t5cJsxjI3RhZmnaXqoHBkqX3g7oKagxLr7pGjrbE6cT/arQrX5h/iHIjAQL WiHLqD+DtNzVUHexZJOI8cVcVovz7tsYH8tMSXwaERul5vVXMSurAEPwcMhIyeoyMe KTyVnxtop9/QES6soHErs/A/0jTdbB30zcQUn4mM= Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com [IPv6:2a00:1450:4864:20::52c]) by sourceware.org (Postfix) with ESMTPS id DD70E3857C69 for ; Tue, 6 Oct 2020 13:13:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org DD70E3857C69 Received: by mail-ed1-x52c.google.com with SMTP id n22so13481545edt.4 for ; Tue, 06 Oct 2020 06:13:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=KQPnJQXtA1oUSsv+Xj0MNhFvwnQ/CFpEVfkPGHywkNk=; b=uTseIxN1nltRTl9Us/X9kLTVx6rADvsEVs+NP9tfmf2dqWmvP0zgS9b5OfHNXutWVU 7qH4/0p5kp7WoePWSHw02KMUel+vYSLlBDFnZZPTaontt9FITsGfbbYRPaM5wG6CAZXg iu/A/TdfkAbzeRkcJohQTcOmP/iZQ8Kp1L3/ZWdl9XN6udg3vDw68QGQFO61ABdce9tX Nd5tN8XshGQIvFFdDmE0lfGwslo+2dTqHuYDfOpnhIKoFnZXt41GuKtub+KQ/F1ckuK8 2+Pzr1PRZduiz9hvxWBRLjuEPmzrX6ybSKg34PEATk8k4AqzP5vTy3kconBdGXUTGS3V pOGQ== X-Gm-Message-State: AOAM532UiZSo03k6k4F07tzAQjEYKvXqbnMzdXP9WeDnBnPostP3SD04 Fq87ezFtTAoufuGNEpRlZLAWj9430kuJxT9z68U= X-Google-Smtp-Source: ABdhPJzyEEEzklCcT5qGzBlLa1CDCK7E9G4Kmlu55u1UlNLgPP1Zc7Xtj8UlUoM0N2cB/CebZkdcqjPF8aaQoM6vlks= X-Received: by 2002:a50:8e43:: with SMTP id 3mr5520486edx.178.1601989995982; Tue, 06 Oct 2020 06:13:15 -0700 (PDT) MIME-Version: 1.0 References: <83a6xam5uv.fsf@gnu.org> <83blhkg6v1.fsf@gnu.org> <83zh54el8g.fsf@gnu.org> <83h7rce7bq.fsf@gnu.org> In-Reply-To: <83h7rce7bq.fsf@gnu.org> Date: Tue, 6 Oct 2020 21:13:05 +0800 Message-ID: Subject: Re: the redirected stdin/out/err for new console is wrong when the gdb's stdin/out/err is already redirected To: Eli Zaretskii Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 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: Roy Qu via Gdb-patches Reply-To: Roy Qu Cc: gdb-patches@sourceware.org Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" Eli Zaretskii =E4=BA=8E2020=E5=B9=B410=E6=9C=883=E6=97=A5=E5= =91=A8=E5=85=AD =E4=B8=8A=E5=8D=883:50=E5=86=99=E9=81=93=EF=BC=9A > [Please use Reply All to reply, so that the list is CC'ed.] > > > From: Roy Qu > > Date: Sat, 3 Oct 2020 00:22:46 +0800 > > > > Eli Zaretskii =E4=BA=8E2020=E5=B9=B410=E6=9C=882=E6=97= =A5=E5=91=A8=E4=BA=94 =E4=B8=8B=E5=8D=8810:49=E5=86=99=E9=81=93=EF=BC=9A > > > > [Please use Reply All to reply, so that the list is CC'ed.] > > Please do, you continue replying only to me, which requires me to > quote the entire message sent by you to the list, and also prevents > others from replying in a timely manner. > > Sorry. > > > > > From: Roy Qu > > > Date: Fri, 2 Oct 2020 21:58:13 +0800 > > > > > > > > > https://stackoverflow.com/questions/30494945/createprocess-with-new-conso= le-window-but-override-some-std-i-o-handles > > > > > > > > Point 1.You are right, NULL doesn't work under windows 7. > > > So we need a better solution here. > > > > OK. > > > > > Point 2. When GDB's standard output is not redirected (started in > console) , the inferior's ouput will > > go to it's > > > own console, not the gdb's console. > > > > Really? I thought this happens only if you say > > > > (gdb) set new-console 1 > > > > If I'm wrong, then where is the code which causes that other console > > to be created for the inferior? > > > > Yes. Can we add a check here to see if there should be a new console ? > > Probably, but I hope someone else will explain how to do that. > > And if we do have such a test, how will that affect the issue you > would like to solve? Does the problem only happen when the inferior > has a separate console? > I think only console programs use STDIN/STDOUT for I/O. So only console programs have this problem. And if the inferior don't have its own console (it redirect its STDIN/STDOUT to gdb's main console) , there's no such problem either.