From mboxrd@z Thu Jan 1 00:00:00 1970 From: Keith Seitz To: leonp@plris.com Cc: Insight Subject: Re: Ctrl-C strange behavior Date: Thu, 04 May 2000 09:10:00 -0000 Message-id: <3911A0F2.86750022@firetalk.com> References: <390F039B.4DE491@plris.com> X-SW-Source: 2000-q2/msg00178.html Leon Pollak wrote: > > Hello, gurus. > Please, can somebody describe rather strange behavior of Ctrl-C that I have? > I run Insight from xterm and the program downloads to the target and starts to run. > When I press Ctrl-C in command window, press "STOP" button or try close Insignt - > nothing happens. > Even the windows are not redrawn and remain blank if I minimize them. > But when I press Ctrl-C from the xterm window, Insignt says that it received > SGINT interrupt and stops the target. > Sigh. Read my previous message to this group under the same subject for a basic description of the things going on behind the scenes and Chris Faylor's message for a possible solution. Now, onto the "weird" behavior: gdbtk does not know how to deal with terminals very well. For example, stdin/stdout/stderr all map to gdbtk's controlling terminal (usually the xterm from which you launched gdbtk). So an interrupt to this controlling terminal will cause gdbtk to attempt to interrupt the target. Just think of gdbtk rerouting all output to stdout (gdb's stdout) to the console window. The problem is that all inferior I/O still goes through the xterm, just like when you use the command line. So when you hit ^C in the terminal from which gdbtk was launched, you are sending the inferior a signal, SIGINT, which gdb catches. Fun, eh? No one has yet to attempt to fix this properly (for remotes), but Tom Tromey had a solution to this for natives quite some time ago. (This is also the reason why you cannot use gdbtk by double-clicking it in a window manager. Gdbtk MUST have a controlling terminal, so you MUST launch it from a shell. Code Fusion works around this problem by giving gdbtk a controlling terminal. Tom's solution is the similar, but it teaches gdb how to get its own controlling terminal.) Boy, I sound like the bearer of bad news today... Keith -- Why chat when you can Firetalk? Firetalk ID: Keith (10320) www.firetalk.com