- -- TODO: remove ;-)
- -- small example how to get information about
- -- exceptions of a method
- let (Just m) = lookupMethodSig methodname sig cls
- case attrByName m "Code" of
- Nothing ->
- printfBb $ printf "exception: no handler for this method\n"
- Just exceptionstream ->
- printfBb $ printf "exception: \"%s\"\n" (show $ codeExceptions $ decodeMethod exceptionstream)
- -- [/remove]
+ let exceptionMap :: ExceptionMap
+ exceptionMap = foldl f M.empty $ codeExceptions decoded
+ where
+ f emap ce =
+ if M.member key emap
+ then M.adjust (value:) key emap
+ else M.insert key [value] emap
+ where
+ key = (&&&) eStartPC eEndPC ce
+ value = (&&&) (buildClassID cls . eCatchType) eHandlerPC ce
+