Code to use ctrl-break to get a java stack dump

Timothy Wall twall@users.sourceforge.net
Mon Jul 26 13:14:00 GMT 2004


Since cygwin will kill a subprocess if you hit ctrl-break manually, 
I've written a little utility that allows you to send ctrl-break 
directly to the java process from any other console on the same 
machine.

Note that if java is invoked directly from the shell, cygwin gets the 
ctrl-break and still kills java, but I usually run my java invocations 
from a makefile target, which somehow allows this to work.

e.g.

test:
	if  /bin/true; then java -cp . MyClass; fi


make test

Then, from some other console:

./cbreak

Hopefully someone else will find this of use.  The process walking code 
was taken from some gnarly MS example;  I'm sure there's got to be a 
better way.  This probably only works on XP and later (haven't tried it 
elsewhere, but some of the system calls used are marked XP+ only).

T.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: cbreak.cc
Type: application/octet-stream
Size: 8193 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20040726/85e56101/attachment.obj>
-------------- next part --------------



-------------- next part --------------
--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


More information about the Cygwin mailing list