bytecode

Bytebuddy - Intercept java.net.ServerSocket constructor

你离开我真会死。 提交于 2021-02-10 14:51:10
问题 Iam Trying to Intercept two methods and one constructor of java.net.ServerSocket . Intercepting the two methods getLocalPort and getInetAddress works fine. However, the class which should handle the constructor ServerSocket(int) is not triggered. My code to instrument (inside a different jar-file which is included to the mainproject): package instrumenting; public class Instrumenting { private static final String CLASS_NAME = "java.net.ServerSocket"; public static void instrument

What does the visitLocalVariable() method of the MethodVisitor class in the ASM bytecode engineering library do?

心已入冬 提交于 2021-02-09 05:38:23
问题 I am using ASM (for the first time) in an application to create Java class files. This is for the backend of a compiler I am writing. I read the relevant parts of the ASM documentation and have a question about stack map frames. ASM says it can automatically compute those frames if the class writer is initialized with the appropriate flags. My question is, does that mean I will not ever have to call the visitLocalVariable() method on the method visitors myself? I am not sure what that method

Decompiling obfuscated java bytecode [closed]

余生颓废 提交于 2021-02-08 12:59:12
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 9 years ago . I work on a platform which runs Java apps. Those apps are often obfuscated, most of them using ProGuard, which makes debugging issues

How to transform bytecodes to initialize primitive constants in static block with ASM?

冷暖自知 提交于 2021-02-08 09:57:10
问题 I need to transform Java bytecode with ASM to initialize public static final fields inside a static {...} block in the class. For example: Input: public static final int CONSTANT = 10; Output: public static final int CONSTANT; static { CONSTANT = 10; } I need this transformation because the compiler replaces primitive constants by their actual value in the bytecode, so their usage becomes untraceable. This transformation allows tracing the usage of constants. 回答1: For such a transformation,

How to transform bytecodes to initialize primitive constants in static block with ASM?

让人想犯罪 __ 提交于 2021-02-08 09:56:55
问题 I need to transform Java bytecode with ASM to initialize public static final fields inside a static {...} block in the class. For example: Input: public static final int CONSTANT = 10; Output: public static final int CONSTANT; static { CONSTANT = 10; } I need this transformation because the compiler replaces primitive constants by their actual value in the bytecode, so their usage becomes untraceable. This transformation allows tracing the usage of constants. 回答1: For such a transformation,

How to transform bytecodes to initialize primitive constants in static block with ASM?

谁说我不能喝 提交于 2021-02-08 09:56:51
问题 I need to transform Java bytecode with ASM to initialize public static final fields inside a static {...} block in the class. For example: Input: public static final int CONSTANT = 10; Output: public static final int CONSTANT; static { CONSTANT = 10; } I need this transformation because the compiler replaces primitive constants by their actual value in the bytecode, so their usage becomes untraceable. This transformation allows tracing the usage of constants. 回答1: For such a transformation,

How does the Garbage Collector update the references pushed to the operand stack?

Deadly 提交于 2021-02-08 03:36:11
问题 The JVM can easily update the references of local variables, static references, class instances or object array instances when moving an object in heap. But how can it update the references pushed to the operand stack? 回答1: There is no fundamental difference between a local variable and an entry in the operand stack. Both live in the same stack frame. Neither is formally declared and both need the JVM to perform inference to recognize their actual use. The following code public static void

How does the Garbage Collector update the references pushed to the operand stack?

余生长醉 提交于 2021-02-08 03:35:28
问题 The JVM can easily update the references of local variables, static references, class instances or object array instances when moving an object in heap. But how can it update the references pushed to the operand stack? 回答1: There is no fundamental difference between a local variable and an entry in the operand stack. Both live in the same stack frame. Neither is formally declared and both need the JVM to perform inference to recognize their actual use. The following code public static void

Why does Python only save the bytecode for a script if it is imported?

。_饼干妹妹 提交于 2021-02-07 20:20:54
问题 Given that executing Python bytecode will be faster than running the original source code because Python does not have to recompile, why does Python only save the compiled bytecode when a script is imported? Wouldn't it be better to save the .pyc file for every script that's executed? 回答1: The startup time of your Python interpreter takes time anyway (even if you might not notice it that much), so it simply doesn't matter and it is more convenient to start a script that might have been