2 Jul 2003 23:46
class loading and dynamic instrumentation
kalyan ram <ckalyan76 <at> yahoo.com>
2003-07-02 21:46:14 GMT
2003-07-02 21:46:14 GMT
Hai
I have implemented a class loader(not the one
provided with bcel) but in the java programming
language.I am using BCEL api to dynamically intercept
the loading process of class files and put in extra
instrumentation bytecodes.
1.Get the class file
2.Invoke bcel program which does instrumentation
3.turn them into bytes
4.call defineclass.
In the loadclass() function:
JavaClass jclazz = new
ClassParser(classFilename).parse();
InstrumentWithBcel insbcel = new
InstrumentWithBcel();
insbcel.instrumentClass(jclazz);
byte raw[] = jclazz.getBytes();
clas =
defineClass(jclazz.getClassName(),raw,0,raw.length);
Is this right way?In the instrumentation,the
bytecode injected is a static method call like
Instrument.invoke();
There are two problems:
1) the program is invoked as:
java myloader HelloWorld and nothing is getting
(Continue reading)
RSS Feed