[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bus error -- core dumped



Hello all.  For my first question to the list, I submit the following:
-----------
#include <signal.h>
#include <stdio.h>

void panic(n) int n; {fprintf(stderr, "Received signal %d\n", n); exit(1);}

main()
{
char c, *p=0; __Sigfunc l;
  l=signal(SIGBUS, panic);			/* catch bus errors */
  fprintf(stderr, "%lu\n", (unsigned long)l);
  c=*p;						/* force a bus error */
}
-----------
which, when compiled with HSC and the MiNTlibs pl30 and run under MiNT
0.95, yields:
-----------
0
pid 41 (hmm): BUS ERROR: User PC=0 (basepage=14f670)
Bus error
-----------
to my great surprise (particularly when cpp started crashing with files
open -- so much for that partition).

If I replace the offending line with a raise(SIGBUS), all works as
expected.  Also, I can catch SIGINT and SIGQUIT with no problems.

Now, the signal dispatch table is (I assume) part of the process's state
information, and MiNT knows which process died, so it should have enough
information to invoke my signal handler.  So why doesn't it?

						-sbigham