gdb: disable ghc's rts timer and disable signal handlers
[mate.git] / Mate / MethodPool.hs
index 5a0144521ad241e626b110726612de27ade683bd..1403eaea045745436919ce5c90755c0bd283722c 100644 (file)
@@ -45,12 +45,15 @@ getMethodEntry signal_from methodtable = do
   let mi = tmap M.! w32_from
   let mi'@(MethodInfo method cm sig) =
         case mi of
-          (MI x) -> x
-          (VI (MethodInfo methname _ msig)) ->
-              MethodInfo methname (vmap M.! fromIntegral methodtable) msig
-          (II (MethodInfo methname _ msig)) ->
-              MethodInfo methname (vmap M.! fromIntegral methodtable) msig
-          _ -> error "getMethodEntry: no trapInfo. abort."
+          (StaticMethod x) -> x
+          (VirtualMethod   _ (MethodInfo methname _ msig)) -> newMi methname msig
+          (InterfaceMethod _ (MethodInfo methname _ msig)) -> newMi methname msig
+          _ -> error "getMethodEntry: no TrapCause found. abort."
+        where newMi mn = MethodInfo mn (vmap M.! fromIntegral methodtable)
+  -- bernhard (TODO): doesn't work with gnu classpath at some point. didn't
+  --                  figured out the problem yet :/ therefore, I have no
+  --                  testcase for replaying the situation.
+  -- setTrapMap $ M.delete w32_from tmap
   case M.lookup mi' mmap of
     Nothing -> do
       cls <- getClassFile cm
@@ -143,11 +146,12 @@ compileBB hmap methodinfo = do
   mapM_ (printfJit "%s\n" . showAtt) (snd right)
   printfJit "\n\n"
   -- UNCOMMENT NEXT LINES FOR GDB FUN
-  --if (toString $ methName methodinfo) == "thejavamethodIwant2debug"
-  --  then getLine
-  --  else return "foo"
-  -- (1) start it with `gdb ./mate' and then `run <classfile>'
-  -- (2) on getLine, press ctrl+c
+  -- if (toString $ methName methodinfo) == "thejavamethodIwant2debug"
+  --   then putStrLn "press CTRL+C now for setting a breakpoint. then `c' and ENTER for continue" >> getLine
+  --   else return "foo"
+  -- (1) build a debug build (see HACKING) and execute `make tests/Fib.gdb'
+  --     for example, where the suffix is important
+  -- (2) on getLine, press CTRL+C
   -- (3) `br *0x<addr>'; obtain the address from the disasm above
   -- (4) `cont' and press enter
   return $ fromIntegral $ ptrToIntPtr entry