ffi: don't use C for obtaining an address of a haskell function
[mate.git] / ffi / trap.c
index e0878b2bb0a296989934bf48b9314c355fb0d0df..1058004a1046afe6432f82fbceb9ab3b4194066a 100644 (file)
@@ -21,7 +21,6 @@
 
 #include <sys/ucontext.h>
 
-unsigned int mallocObject(int);
 unsigned int mateHandler(unsigned int, unsigned int, unsigned int, unsigned int);
 
 #ifdef DBG_TRAP
@@ -30,11 +29,6 @@ unsigned int mateHandler(unsigned int, unsigned int, unsigned int, unsigned int)
 #define dprintf(args...)
 #endif
 
-void mainresult(unsigned int a)
-{
-       dprintf("mainresult: 0x%08x\n", a);
-}
-
 void chandler(int nSignal, siginfo_t *info, void *ctx)
 {
        mcontext_t *mctx = &((ucontext_t *) ctx)->uc_mcontext;
@@ -43,6 +37,9 @@ void chandler(int nSignal, siginfo_t *info, void *ctx)
        unsigned int eax = (unsigned int) mctx->gregs[REG_EAX];
        unsigned int ebx = (unsigned int) mctx->gregs[REG_EBX];
        unsigned int esp = (unsigned int) mctx->gregs[REG_ESP];
+       dprintf("trap: type %d, eip 0x%08x, eax 0x%08x, ebx 0x%08x, "
+                       "esp 0x%08x, *esp 0x%08x\n", nSignal, eip,
+                       eax, ebx, esp, *(unsigned int*) esp);
 
        mctx->gregs[REG_EIP] = mateHandler(eip, eax, ebx, esp);
 }
@@ -61,13 +58,3 @@ void register_signal(void)
        segvaction.sa_flags = SA_SIGINFO | SA_RESTART | SA_NODEFER;
        sigaction(SIGSEGV, &segvaction, NULL);
 }
-
-unsigned int getaddr(void)
-{
-       return (unsigned int) mainresult;
-}
-
-unsigned int getMallocObjectAddr(void)
-{
-       return (unsigned int) mallocObject;
-}