From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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> From: Roy Qu 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 Cc: gdb-patches@sourceware.org X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_00, BODY_8BITS, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, 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 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: , X-List-Received-Date: Tue, 06 Oct 2020 13:13:19 -0000 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.