microbat icon indicating copy to clipboard operation
microbat copied to clipboard

Question for isInstrumentable in UserFilters

Open SongXueZhi opened this issue 4 years ago • 0 comments

Q1: In my understanding, this functionisInstrumentable(String className, Method method, LineNumberGen[] lineNumbers) is using to check whether a method need to filter. image But now it is exactly the same as the function body of isInstrumentable(String className), and the function isInstrumentableMethod(String className, Method method, LineNumberGen[] lineNumbers) in CodeRangeUserFilter is never been used. So here should be called filter.isInstrumentableMethod instead of filter.isInstrumentable(String className)?

Q2: scene 1: If there still filter.isInstrumentable(String className), given a code range (16, 17)the result as follows: image The instrument result as follows: image We can see that line 8 is recorded. This is because although the main method is not in the code scope, the instrument tracer is still started at the beginning of the method and hitline is called in ExecutionTracer._getTracer()

scene 2: if the function filter.isInstrumentableMethod(String className, Method method, LineNumberGen[] lineNumbers) instead of filter.isInstrumentable(String className)
the result as follows: image We can see that the "setup" method was hit by the range (16, 17) and successfully instrument tracer and hitline, but 0 traces will be obtained, I don't know if I missed anything?

SongXueZhi avatar Apr 02 '20 15:04 SongXueZhi