From: Nikolay Molchanov <Nikolay.Molchanov@Sun.COM>
To: gdb@sourceware.org
Cc: Nikolay Molchanov <Nikolay.Molchanov@Sun.COM>
Subject: Re: Can I use -exec-interrupt to stop the inferior program?
Date: Wed, 11 Oct 2006 06:47:00 -0000 [thread overview]
Message-ID: <452C936F.2080704@sun.com> (raw)
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
next reply other threads:[~2006-10-11 6:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-11 6:47 Nikolay Molchanov [this message]
2006-10-11 13:49 ` Daniel Jacobowitz
2006-10-11 17:32 ` Eli Zaretskii
-- strict thread matches above, loose matches on Subject: below --
2006-05-15 21:51 Nikolay Molchanov
2006-05-16 11:35 ` Nick Roberts
2006-05-18 16:19 ` Carlos Eduardo Rodrigues de Almeida
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=452C936F.2080704@sun.com \
--to=nikolay.molchanov@sun.com \
--cc=gdb@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox