From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11268 invoked by alias); 11 Oct 2006 06:47:17 -0000 Received: (qmail 11257 invoked by uid 22791); 11 Oct 2006 06:47:16 -0000 X-Spam-Check-By: sourceware.org Received: from nwk-ea-fw-1.sun.com (HELO nwk-ea-fw-1.sun.com) (192.18.42.249) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 11 Oct 2006 06:47:13 +0000 Received: from d1-sfbay-09.sun.com ([192.18.39.119]) by nwk-ea-fw-1.sun.com (8.13.6+Sun/8.12.9) with ESMTP id k9B6lCaE000818 for ; Tue, 10 Oct 2006 23:47:12 -0700 (PDT) Received: from conversion-daemon.d1-sfbay-09.sun.com by d1-sfbay-09.sun.com (Sun Java System Messaging Server 6.2-6.01 (built Apr 3 2006)) id <0J6Y00301LI45300@d1-sfbay-09.sun.com> (original mail from Nikolay.Molchanov@Sun.COM) for gdb@sourceware.org; Tue, 10 Oct 2006 23:47:12 -0700 (PDT) Received: from [172.16.1.35] ([69.106.235.6]) by d1-sfbay-09.sun.com (Sun Java System Messaging Server 6.2-6.01 (built Apr 3 2006)) with ESMTPSA id <0J6Y00DWPLINVO0T@d1-sfbay-09.sun.com> for gdb@sourceware.org; Tue, 10 Oct 2006 23:47:12 -0700 (PDT) Date: Wed, 11 Oct 2006 06:47:00 -0000 From: Nikolay Molchanov Subject: Re: Can I use -exec-interrupt to stop the inferior program? To: gdb@sourceware.org Cc: Nikolay Molchanov Message-id: <452C936F.2080704@sun.com> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 7BIT User-Agent: Thunderbird 1.5.0.7 (Windows/20060909) Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2006-10/txt/msg00058.txt.bz2 Hello GDB developers and users! I asked this question some time ago (in May 2006), and I implemented a solution for Unix (it is based on signal), but I still cannot find a good solution for Windows. Here is my original question: I'm looking for a solution how to stop the inferior program, which is running under gdb. I can stop it using ^C, but I need a solution, that will work for the following case on Windows (Cygwin): Java application | ^ stdin | | stdout v | GDB debugger (gdb --i mi --tty /dev/pts/2 ...) | ^ v | Inferior program <--> External terminal (/dev/pts/28) The action to stop the program is initiated by Java application, which cannot send ^C to the external terminal. Nick Roberts suggested to use signals to implement "interrupt" action, and it really works very well on Unix (Solaris and Linux), but unfortunately it does not work properly on Windows. If I send SIGTSTP, gdb does not show that the program is stopped (and it really does not stop), so it looks like this signal is ignored. If I send SIGINT, the program is really interrupted, but it seems to cause SIGSEGV (Segmentation Fault), and there is no way to continue the debugging. Here is a scenario (I use Cygwin): Window 1: start debugging, set breakpoint, continue =================================== $ gdb --i mi ~"GNU gdb 6.5.50.20060706-cvs (cygwin-special)\n" ~"Copyright (C) 2006 Free Software Foundation, Inc.\n" ~"GDB is free software, covered by the GNU General Public License, and you are\n" ~"welcome to change it and/or distribute copies of it under certain conditions.\n" ~"Type \"show copying\" to see the conditions.\n" ~"There is absolutely no warranty for GDB. Type \"show warranty\" for details.\n" ~"This GDB was configured as \"i686-pc-cygwin\"." ~"\n" (gdb) -file-exec-and-symbols C:/tmp/nikm/samples/LongLoop1/dist/Debug/GNU-Windows/longloop1 ^done (gdb) -break-insert main ^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x004011b 5",func="main",file="main.cc",fullname="/cygdrive/c/tmp/nikm/samples/LongLoop1/m ain.cc",line="33",times="0"} (gdb) -exec-run ^running (gdb) *stopped,reason="breakpoint-hit",bkptno="1",thread-id="1",frame={addr="0x004011b 5",func="main",args=[{name="argc",value="1"},{name="argv",value="0x6c1f50"}],fil e="main.cc",fullname="/cygdrive/c/tmp/nikm/samples/LongLoop1/main.cc",line="33"} (gdb) -exec-continue ^running (gdb) Window 2: send signal =============== $ ps PID PPID PGID WINPID TTY UID STIME COMMAND 1520 1 1520 1520 con 1005 23:22:26 /usr/bin/bash 884 1 884 884 con 1005 23:23:47 /usr/bin/bash 1832 1520 1832 3880 con 1005 23:24:17 /usr/bin/gdb 4036 1 4036 4036 con 1005 23:27:14 /cygdrive/c/tmp/nikm/sam ples/LongLoop1/dist/Debug/GNU-Windows/longloop1 2380 884 2380 2336 con 1005 23:27:16 /usr/bin/ps $ kill -INT 4036 Window 1: caught signal ================= ~"\n" ~"[Switching to thread 4036.0x784]\n" *stopped,reason="signal-received",signal-name="SIGSEGV",signal-meaning="Segmenta tion fault",thread-id="2",frame={addr="0x000007d4",func="??",args=[]} (gdb) After that there is no way to continue: ========================= -exec-continue ^running (gdb) *stopped,reason="signal-received",signal-name="SIGSEGV",signal-meaning="Segmenta tion fault",thread-id="2",frame={addr="0x000007d4",func="??",args=[]} (gdb) Could you please tell me if there any other way to interrupt program on Windows, so that gdb will show where it is stopped, and will allow to continue? Thanks in advance, Nikolay Molchanov