--- /dev/null
+handle SIGILL nostop
+handle SIGSEGV nostop
+run
for testing with a release build, use
$ make tests/Fib
+
for testing a release build against OpenJDK output, use
$ make tests/Fib.test
+
for testing with a debug build, use
$ DBGFLAGS='-DDBG_JIT -DDBG_BB' make tests/Fib.dbg
`make clean' is needed if you change $DBGFLAGS.
for all available flags, see `debug.h'.
+
+
+for debugging with gdb, modify Mate/MethodPool.hs and make a debug build with at
+least -DDBG_JIT enabled, then use
+$ make tests/Fib.gdb
+and follow the instructions in the source file.
PACKAGES_ := bytestring harpy hs-java plugins
PACKAGES := $(addprefix -package ,$(PACKAGES_))
-GHC_OPT := -I. -Wall -O0 -fno-warn-unused-do-bind
+GHC_OPT := -I. -Wall -O0 -fno-warn-unused-do-bind -rtsopts
GHC_LD := -optl-Xlinker -optl-x
%.dbg: %.class mate.dbg
./mate.dbg $(basename $<)
+%.gdb: %.class mate.dbg
+ gdb -x .gdbcmds -q --args mate.dbg $(basename $<) +RTS -V0 --install-signal-handlers=no
+
ifeq (${DBGFLAGS},)
DEBUGFLAGS = -DDBG_JIT -DDBG_MP
else
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