parseMethod cls method = do
let maybe_bb = testCFG $ lookupMethod method cls
let msig = methodSignature $ (classMethods cls) !! 1
- printf_bb "BB: analysing \"%s\"\n" $ toString (method `B.append` ": " `B.append` (encode msig))
+ printfBb "BB: analysing \"%s\"\n" $ toString (method `B.append` ": " `B.append` (encode msig))
#ifdef DBG_BB
printMapBB maybe_bb
#endif
-- TODO: remove ;-)
let (Just m) = lookupMethod method cls
case attrByName m "Code" of
- Nothing -> printf_bb "exception: no handler for this method\n"
- Just exceptionstream -> printf_bb "exception: \"%s\"\n" (show $ codeExceptions $ decodeMethod exceptionstream)
+ Nothing -> printfBb "exception: no handler for this method\n"
+ Just exceptionstream -> printfBb "exception: \"%s\"\n" (show $ codeExceptions $ decodeMethod exceptionstream)
return maybe_bb
let w32_iftable = fromIntegral $ ptrToIntPtr iftable :: Word32
-- store interface-table at offset 0 in method-table
pokeElemOff (intPtrToPtr $ fromIntegral mbase) 0 w32_iftable
- printf_cp "staticmap: %s @ %s\n" (show staticmap) (toString path)
- printf_cp "fieldmap: %s @ %s\n" (show fieldmap) (toString path)
- printf_cp "methodmap: %s @ %s\n" (show methodmap) (toString path)
- printf_cp "mbase: 0x%08x\n" mbase
- printf_cp "interfacemethod: %s @ %s\n" (show immap) (toString path)
- printf_cp "iftable: 0x%08x\n" w32_iftable
+ printfCp "staticmap: %s @ %s\n" (show staticmap) (toString path)
+ printfCp "fieldmap: %s @ %s\n" (show fieldmap) (toString path)
+ printfCp "methodmap: %s @ %s\n" (show methodmap) (toString path)
+ printfCp "mbase: 0x%08x\n" mbase
+ printfCp "interfacemethod: %s @ %s\n" (show immap) (toString path)
+ printfCp "iftable: 0x%08x\n" w32_iftable
virtual_map <- get_virtualmap >>= ptr2virtualmap
let virtual_map' = M.insert mbase path virtual_map
virtualmap2ptr virtual_map' >>= set_virtualmap
case M.lookup path imap of
Just _ -> return ()
Nothing -> do
- printf_cp "interface: loading \"%s\"\n" $ toString path
+ printfCp "interface: loading \"%s\"\n" $ toString path
let ifpath = toString $ path `B.append` ".class"
cfile <- parseClassFile ifpath
-- load "superinterfaces" first
let mi = (MethodInfo "<clinit>" path (methodSignature m))
entry <- compileBB hmap' mi
addMethodRef entry mi [path]
- printf_cp "executing static initializer from %s now\n" (toString path)
+ printfCp "executing static initializer from %s now\n" (toString path)
executeFuncPtr entry
- printf_cp "static initializer from %s done\n" (toString path)
+ printfCp "static initializer from %s done\n" (toString path)
Nothing -> error $ "loadClass: static initializer not found (WTF?). abort"
Nothing -> return ()
instance (Show a, VarArgsFake r) => VarArgsFake (a -> r) where
varFake _ = \_ -> varFake []
-printf_fake :: String -> (VarArgsFake t) => t
-printf_fake _ = varFake []
+printfFake :: String -> (VarArgsFake t) => t
+printfFake _ = varFake []
-- see counterpart at `debug.h'
#ifndef DBG_JIT
-printf_jit :: String -> (VarArgsFake t) => t
-printf_jit = printf_fake
+printfJit :: String -> (VarArgsFake t) => t
+printfJit = printfFake
#endif
#ifndef DBG_BB
-printf_bb :: String -> (VarArgsFake t) => t
-printf_bb = printf_fake
+printfBb :: String -> (VarArgsFake t) => t
+printfBb = printfFake
#endif
#ifndef DBG_MP
-printf_mp :: String -> (VarArgsFake t) => t
-printf_mp = printf_fake
+printfMp :: String -> (VarArgsFake t) => t
+printfMp = printfFake
#endif
#ifndef DBG_CP
-printf_cp :: String -> (VarArgsFake t) => t
-printf_cp = printf_fake
+printfCp :: String -> (VarArgsFake t) => t
+printfCp = printfFake
#endif
#ifndef DBG_STR
-printf_str :: String -> (VarArgsFake t) => t
-printf_str = printf_fake
+printfStr :: String -> (VarArgsFake t) => t
+printfStr = printfFake
#endif
case M.lookup mi' mmap of
Nothing -> do
cls <- getClassFile cm
- printf_mp "getMethodEntry(from 0x%08x): no method \"%s\" found. compile it\n" w32_from (show mi')
+ printfMp "getMethodEntry(from 0x%08x): no method \"%s\" found. compile it\n" w32_from (show mi')
mm <- lookupMethodRecursive method [] cls
case mm of
Just (mm', clsnames, cls') -> do
True -> do
-- TODO(bernhard): cleaner please... *do'h*
let symbol = (replace "/" "_" $ toString cm) ++ "__" ++ (toString method) ++ "__" ++ (replace ";" "_" $ replace "/" "_" $ replace "(" "_" (replace ")" "_" $ toString $ encode sig))
- printf_mp "native-call: symbol: %s\n" symbol
+ printfMp "native-call: symbol: %s\n" symbol
nf <- loadNativeFunction symbol
let w32_nf = fromIntegral nf
let mmap' = M.insert mi' w32_nf mmap
let tmap' = M.union tmap new_tmap -- prefers elements in cmap
trapmap2ptr tmap' >>= set_trapmap
- printf_jit "generated code of \"%s\":\n" (toString $ methName methodinfo)
- mapM_ (printf_jit "%s\n" . showAtt) (snd right)
- printf_jit "\n\n"
+ printfJit "generated code of \"%s\":\n" (toString $ methName methodinfo)
+ mapM_ (printfJit "%s\n" . showAtt) (snd right)
+ printfJit "\n\n"
-- UNCOMMENT NEXT LINE FOR GDB FUN
-- _ <- getLine
-- (1) start it with `gdb ./mate' and then `run <classfile>'
BI.memset newstr 0 (fromIntegral $ strlen + 1)
copyBytes newstr arr strlen
let w32_ptr = fromIntegral $ ptrToIntPtr newstr
- printf_str "new str ptr: 0x%08x (%s)@%d\n" w32_ptr (toString str) strlen
+ printfStr "new str ptr: 0x%08x (%s)@%d\n" w32_ptr (toString str) strlen
return w32_ptr
* DBG_MP ..... MethodPool.hs
* DBG_CP ..... ClassPool.hs
* DBG_STR .... Strings.hs
- * // no printf_* defined
+ * // no printf* defined
* DBG_TRAP ... show information @ trap.c
* DBG_CLASS .. dump classfile
*/
#endif
/* it would be awesome if we could just write
- * > printf_fake = printf
+ * > printfFake = printf
* here, but the type can't be infered, since `PrintfType'
* isn't visible (at least this is my explanation :/).
* if I'm wrong, move this to `Mate/Debug.hs'
*/
#ifdef DBG_JIT
-#define printf_jit printf
+#define printfJit printf
#endif
#ifdef DBG_BB
-#define printf_bb printf
+#define printfBb printf
#endif
#ifdef DBG_MP
-#define printf_mp printf
+#define printfMp printf
#endif
#ifdef DBG_CP
-#define printf_cp printf
+#define printfCp printf
#endif
#ifdef DBG_STR
-#define printf_str printf
+#define printfStr printf
#endif