Problems calling native code from QUIT handler

Gary Howland gary at systemics.com
Wed May 14 07:06:42 PDT 1997


Hi,


I have been having problems calling Java functions from native code.

This is what I have tried:

	do_execute_java_method(0, (Hjava_lang_Object*)currentThread, "dumpStack", "()V;", 0, true);

but I get a java.lang.NoSuchMethodError.

Any clues?


If it is relevant, I am doing something a little strange.  I have
modifed kaffe to intercept the QUIT signal, and am attempting to
display a trace of all the threads - just like the Sun VM does.

For those interested, here are the changes I have made so far:


Added to exception.c: (silly function name, I know)

	/*
	 * Display the status after catching a quit
	 */
	void
	quitStatus(EXCEPTIONPROTO)
	{
		sigset_t nsig;

	#if !defined(DEBUG)
		/* Reset signal handler */
		signal(sig, (SIG_T)quitStatus);
		sigemptyset(&nsig);
		sigaddset(&nsig, sig);
		sigprocmask(SIG_UNBLOCK, &nsig, 0);
	#endif

		displayThreads();
	}


Added to thread.c:

	void
	displayThreads(void)
	{
		do_execute_java_method(0, (Hjava_lang_Object*)currentThread, "dumpStack", "()V;", 0, true);
	}


Modified  baseClasses.c:

	void
	initExceptions(void)
	{
	DBG(	printf("initExceptions()\n");				)
	#if !defined(DEBUG)
		/* Catch signal we need to convert to exceptions */
	#if defined(SIGQUIT)
		signal(SIGQUIT, (SIG_T)quitStatus);
	#endif
	#if defined(SIGSEGV)
		signal(SIGSEGV, (SIG_T)nullException);
	#endif
	#if defined(SIGBUS)
		signal(SIGBUS, (SIG_T)nullException);
	#endif
	#if defined(SIGFPE)
		signal(SIGFPE, (SIG_T)arithmeticException);
	#endif
	#if defined(SIGPIPE)
		signal(SIGPIPE, SIG_IGN);
	#endif
	#endif
	}

And of course all of the relevant .h files have been modifed too.


Gary



More information about the kaffe mailing list