I was looking at the byteman implementation to understand how they work specifically for cases like tracking variables AT/AFTER nth read, AT/AFTER nth write etc. In their implementation they read a class two times once for checking if it matches with the Rule specified by the user using RuleCheckMethodAdapter and second time for actually injecting the bytecode (trigger) at the interested place in the class using RuleTriggerAdapter. What I failed to understand is why do we need 2 passes, Why can't in the first pass itself we could add the trigger if there is a match with the rule? Any insights on the same would be helpful.
Byteman Implementation Details
129 Views Asked by Sumit Maheshwari At
1
There are 1 best solutions below
Related Questions in BYTECODE-MANIPULATION
- Reloading classes with maniupulated bytecode from rt.jar
- Bytecode instrumentation using ASM 5.0 . inject a tracer to trace local variables
- ClassWriter COMPUTE_FRAMES in ASM
- How can I pass a name/value pair during runtime via ASM(Instrumentation) in a remote EJB call?
- Dynamic Bytecode Instrumentation fails without any error
- JVMTI RetransformClasses() is taking a lot of time
- AspectJ - How to instruemt methods that are very very big
- Is jack and jill for android compatible with byte code weaving?
- Alter value of a static field during class loading using a Java agent
- Add field to Proxy class created with Javassist
- classPool.get(className) throws RuntimeException cannot find class
- Retro-actively add Java annotations to methods?
- Difference between build time instrumentation and load time instrumentation
- Remember JVM state before executing a specific instruction
- What programming languages will let me manipulate the sequence of instructions in a method?
Related Questions in BYTEMAN
- Byteman JUnit Runner - impossible to trigger IOException on auto-closed InputStream#close
- org.jboss.byteman.agent.Transformer : invalid text outside of RULE/ENDRULE at line 1 in script
- Tracing a class in WAR file deployed in Wildfly 18
- Write stack trace of an exception into a file with Byteman
- Instrumentation to count every statement in a Scala function
- Is it possible to intercept array constructor with ByteBuddy?
- Byteman - trace all classes and methods in a given package
- ByteBuddy 1.10.2 throws `java.lang.IllegalStateException: Cannot resolve type description for java.lang.Exception`, and similar
- byteman rule: return 10.001, got invalid expression error
- Byteman Implementation Details
- bmsubmit is not working due to Bad Request 400. Why?
- Byteman 4.0.14 verification commands after installation
- Modifying method arguments using byteman
- How to set environment setting?
- Can byteman trigger a rule on a lambda?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
All the injection stages for all location types use two passes. The first pass is a verification step that ensures the location actually matches the code at a specific point in the method bytecode. It records information needed to allow injection to be performed appropriately for that location and saves it for use by the second pass. n.b. this first stage is invariably a very cheap and quick code scan.
The second stage tracks a lot more information about the code structure, abstract machine stack layouts and types, etc. This is partly to ensure that it does the injection correctly but it also has to do a lot of work to ensure that it can correctly route exceptions out of the injected regions. There is no point incurring this overhead until it is clear that the rule applies.