This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java 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]

Re: [patch 3.4/3.5] libffi & libjava port for hppa-linux


> It should do.  There's a test in the libgcj test suite for exactly
> this case.

here's a test case:

compile with g++ -o exctest exctest.cc, this causes an abort on x86.
if you change the "if 0" to "if 1" then it works.

I guess the gcj test you are talking about is Throw_2.exe, right? I got
that to work for hppa now...

thanks
randolph
-- 
Randolph Chung
Debian GNU/Linux Developer, hppa/ia64 ports
http://www.tausq.org/

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <iostream>
#include <stdlib.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/ucontext.h>

using namespace std;

void sighandler(int sig, siginfo_t *si, void *data)
{
        cout << "In signal handler; sig = " << sig << endl;
        throw sig;
}

void dosigsegv(void)
{
        char *p = 0;
        void *faultaddr = &&here;

        printf("Triggering SIGSEGV at %p\n", faultaddr);
here:
        *p = 0;
}

int main(int argc, char **argv)
{
        try {
                struct sigaction sact;

                memset(&sact, 0, sizeof(struct sigaction));
                sact.sa_flags = SA_SIGINFO;
                sact.sa_sigaction = sighandler;
                sigaction(SIGSEGV, &sact, NULL);
                cout << "Signal handler installed. Waiting 1 seconds" << endl;
                sleep(1);

#if 1
		{
			char *p = 0;

			*p = 0;
		}
#else

                dosigsegv();
#endif
        }
        catch (int sig)
        {
                cout << "OK; caught expected exception; sig = " << sig << endl;
        }
        catch (...)
        {
                cout << "Oops, got some other exception" << endl;
        }

        return 0;
}


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