bytecode

getting the number of local variables in a method

微笑、不失礼 提交于 2020-01-05 09:15:37
问题 So I have some classes into which "dummy method calls" have been inserted; i.e. static methods in a dedicated class that have an empty body. The idea is to take the arguments that were pushed to the stack prior to the method invokation, store them in local variables, then replace the method invocation with the actual implementation. To see how locals are handled, I run A.java package asmvisit; public class A { long y; public long doSomething(int x, A a){ if(a == null){ this.y = (long)x;

getting the number of local variables in a method

与世无争的帅哥 提交于 2020-01-05 09:14:42
问题 So I have some classes into which "dummy method calls" have been inserted; i.e. static methods in a dedicated class that have an empty body. The idea is to take the arguments that were pushed to the stack prior to the method invokation, store them in local variables, then replace the method invocation with the actual implementation. To see how locals are handled, I run A.java package asmvisit; public class A { long y; public long doSomething(int x, A a){ if(a == null){ this.y = (long)x;

ASM - strange localVar index using newLocal from LocalVariableSorter

徘徊边缘 提交于 2020-01-04 09:22:43
问题 I'm adding new locals via newLocal from LocalVariableSorter . The method I'm adding the locals to is an instance method with a long parameter. I'm adding two locals; one long, one object. There are no other local vars in the sample code. As a result I would have expected the following slots / indexes: 0 - this 1 - the long param 3 - my 1st local added via `newLocal` - using two slots as it is a long 5 - my 2nd local added via `newLocal` What I do get as return from newLocal is 3 and 7 though.

How to create a local variable with ASM?

余生颓废 提交于 2020-01-04 06:49:51
问题 I'm trying to patch a class with ASM. I need to add some logic in a function. This logic needs a new local variable. Here is what I've done: class CreateHashTableMethodAdapter extends MethodAdapter { @Override public void visitMethodInsn(int opcode, String owner,String name, String desc){ System.out.println(opcode + "/" + owner + "/" + name + "/" + desc); if(opcode == Opcodes.INVOKESPECIAL && "javax/naming/InitialContext".equals(owner) && "<init>".equals(name) && "()V".equals(desc)){ System

Are there any FreeRTOS interpreted language libraries available?

怎甘沉沦 提交于 2020-01-03 07:19:10
问题 I work for a company that created firmware for several device using FreeRTOS. Lately our request for new features has surpassed how much work our firmware engineers are capable of, but we can't afford to hire anyone new right now either. Making even tiny changes requires firmware people to go in and modify things at a very low level. I've been looking for some sort of interpreted language project for FreeRTOS that would let us implement new features at a higher level. Ideally I would like to

Are there any FreeRTOS interpreted language libraries available?

无人久伴 提交于 2020-01-03 07:19:05
问题 I work for a company that created firmware for several device using FreeRTOS. Lately our request for new features has surpassed how much work our firmware engineers are capable of, but we can't afford to hire anyone new right now either. Making even tiny changes requires firmware people to go in and modify things at a very low level. I've been looking for some sort of interpreted language project for FreeRTOS that would let us implement new features at a higher level. Ideally I would like to

Marshal loading and exec-ing

廉价感情. 提交于 2020-01-03 05:25:09
问题 I have this Python code: import marshal, imp if imp.get_magic() == '\x03\xf3\r\n': __code = marshal.loads('c\x00\x00\x00\x00.....\x00d\x01\x00k\x00.....\t\t\r\x01') del marshal, imp exec __code The if condition checks wheter the Python version is the "right" version. Then marshal is used to load a string containing some code. First question: How was that string generated? Maybe compile() ? But how exactly? and second question: Can I decompile that string? How? 回答1: As far as how its created,

Interception on constructor causes ClassNotFoundException

社会主义新天地 提交于 2020-01-02 10:18:58
问题 I'm trying to intercept constructors annotated with @Inject . That worked fine in the context of a small unit test. However in the context of a DI container like Spring it fails with a ClassNotFoundException . I managed to narrow down on the root cause. Calling getDeclaredConstructors on the instrumented class will trigger this exception. Interestingly enough, if we first create an instance of that class, the problem disappears. For example: public class InterceptConstructorTest { @Test

What's the difference between java bytecode astore_1 and astore_2

白昼怎懂夜的黑 提交于 2020-01-02 08:53:48
问题 What's the difference between java bytecode astore_1 and astore_2 ? 回答1: The instructions astore_n , for small values of n , are just shorthand equivalents for astore n . Either version stores what's on top of the stack into local variable n . 回答2: astore_1 is the same as astore 1 , and astore_2 is the same as astore 2 , except that astore_1 and astore_2 are one byte each, whereas astore is a two-byte instruction. 来源: https://stackoverflow.com/questions/6983641/whats-the-difference-between

What's the difference between java bytecode astore_1 and astore_2

半世苍凉 提交于 2020-01-02 08:52:33
问题 What's the difference between java bytecode astore_1 and astore_2 ? 回答1: The instructions astore_n , for small values of n , are just shorthand equivalents for astore n . Either version stores what's on top of the stack into local variable n . 回答2: astore_1 is the same as astore 1 , and astore_2 is the same as astore 2 , except that astore_1 and astore_2 are one byte each, whereas astore is a two-byte instruction. 来源: https://stackoverflow.com/questions/6983641/whats-the-difference-between