开发者

java trace of all runtime variable access

开发者 https://www.devze.com 2023-03-16 21:04 出处:网络
I need to log all run-time access to any variable or object My current direction is to markup the classfile with modified 开发者_高级运维bytecode

I need to log all run-time access to any variable or object My current direction is to markup the classfile with modified 开发者_高级运维bytecode Performance is not currently an issue

BCEL looks nice to add some trace instructions to each relevant opcode in the bytecode

However, i would also like to add some semantic information from the source file e.g. this variable is a for-loop counter This would require some AST / parsing tree manipulation.

So are ASM / JavaAssist better choices ???

Logging the variable-usage is the key requirement - so bytecode looks like the right level to handle this. But eventually i will have to access the source parse tree to get more semantic information

Any thoughts ?

p.s. this will be a large prolonged project


Look into JavaSnoop (https://www.aspectsecurity.com/research/appsec_tools/javasnoop/). It will help you monitor function calls.

0

精彩评论

暂无评论...
验证码 换一张
取 消