This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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.

Attachment: cbreak.cc
Description: Binary data




--
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/

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]