import Mate.Utilities
import Mate.Types
+#ifdef DEBUG
+import Text.Printf
+#endif
-- for immediate representation to determine BBs
type Offset = (Int, Maybe BBEnd) -- (offset in bytecode, offset to jump target)
let msig = methodSignature $ (classMethods cls) !! 1
putStrLn $ toString (method `B.append` ": " `B.append` (encode msig))
printMapBB maybe_bb
+#endif
+#ifdef DEBUG
+ -- small example how to get information about
+ -- exceptions of a method
+ -- TODO: remove ;-)
+ let (Just m) = lookupMethod method cls
+ case attrByName m "Code" of
+ Nothing -> printf "exception: no handler for this method\n"
+ Just exceptionstream -> printf "exception: \"%s\"\n" (show $ codeExceptions $ decodeMethod exceptionstream)
#endif
return maybe_bb
--- /dev/null
+package tests;
+
+public class Exception1 {
+ public static void main(String []args) {
+ try {
+ System.out.printf("hello exception stuff\n");
+ } catch (NullPointerException _) {
+ System.out.printf("NullPointerException\n");
+ }
+ }
+}