From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4593 invoked by alias); 15 May 2012 06:20:58 -0000 Received: (qmail 4558 invoked by uid 22791); 15 May 2012 06:20:56 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,RCVD_IN_HOSTKARMA_NO X-Spam-Check-By: sourceware.org Received: from smtpgate01.nexlink.ch (HELO smtpgate01.nexlink.ch) (80.86.198.161) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 15 May 2012 06:20:42 +0000 Received: from [192.168.7.110] ([188.60.20.9]) by imp02.agrinet.ch with id A6Lg1j0030BlBSs036LgBi; Tue, 15 May 2012 08:20:40 +0200 X-IMP-FROM: _________ X-IMP-AUTH_USERNAME: X-Original-IP: 188.60.20.9 Message-ID: <4FB1F5B5.6090701@noobody.org> Date: Tue, 15 May 2012 06:20:00 -0000 From: Noobody User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 MIME-Version: 1.0 To: gdb@sourceware.org Subject: [mingw gdb/mi] Separating debuggee output from MI Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2012-05/txt/msg00062.txt.bz2 I'm currently writing a gdb frontend using the GDB/MI interface, but I have been experiencing difficulties with differentiating between output by the debuggee and output from gdb itself. The documentation mentions target-stream-output, which is prefixed with "@", but it seems it is not actually being used. Instead, target output appears interleaved with gdb output. This can cause various problems, so I would like to be able to safely separate target output/input from gdb output/input. Searching for a bit revealed that this is quite a common problem when writing gdb frontends on windows due to various limitations of the OS, but I was unable to find a good solution. I implemented a workaround to this which seems to work, however I am not quite sure whether it is safe to use. What I'm doing right now is start the debuggee process in suspended mode from the frontend (with CreateProcess and CREATE_SUSPENDED flag), create the gdb process separately, attach it to the suspended process and then resume it with ResumeThread (assuming a single-threaded program). Something like this: /* Start debug process */ CreateProcess(...) /* Start gdb */ gdb.exe -i mi >> -target-attach pid << *stopped >> -exec-continue << *running,thread-id="all" /* Resume suspended process */ ResumeThread(...) This seems to work, as I now have the debuggee input/output and the gdb input/output in separate pipes. However, I have not had the chance to test this any further, so I'm wondering - could this setup could cause any problems? Especially the fact that I'm doing -exec-continue on a suspended process seems like asking for trouble. Thanks! Benedikt Bitterli