[Soot-list] Decoding CodeAttribute in the VM
Sébastien
sebastien.adam at gmail.com
Wed Apr 12 11:07:23 EDT 2006
Hi,
I do an analysis and I want to insert my result in a class file using a
CodeAttribute. Since I have some tags associate with some units, I use a
TagAggregator.
In the following class, my analysis associates a tag with the instructions
<c4.toto = o> and <c41.tata = c4.toto>. Each tag has an one byte array
containing the value 0.
public class C4 {
private Object toto;
private Object tata;
public static void main(String[] args) {
Object o = new Integer(4);
C4 c4 = new C4();
c4.toto = o;
C4 c41 = new C4();
c41.tata = c4.toto;
o = c41.tata;
}
}
Here is my class file containing my new attribute. I used ClassParser from
Apache to get this result. The tag aggregator associates each tag with the
putfield bytecode.
0: new <java.lang.Integer> (26)
3: dup
4: iconst_4
5: invokespecial java.lang.Integer.<init> (I)V (10)
8: astore_0
9: new <C4> (16)
12: dup
13: invokespecial C4.<init> ()V (17)
16: dup
17: aload_0
18: putfield C4.toto Ljava/lang/Object; (13)
21: new <C4> (16)
24: dup
25: invokespecial C4.<init> ()V (17)
28: astore_0
29: getfield C4.toto Ljava/lang/Object; (13)
32: astore_1
33: aload_0
34: aload_1
35: putfield C4.tata Ljava/lang/Object; (27)
38: aload_0
39: getfield C4.tata Ljava/lang/Object; (27)
42: astore_0
43: return
Attribute(s) =
...
(Unknown attribute WriteBarrier: 00 02 00 12 00 00 23 00)
If I print each byte of my aggregated attribute data array, I get the
following:
0 2 0 18 0 0 35 0
So, I want to use this result in the VM. The only thing I need is my 0
values. How can I decode (0 2 0 18 0 0 35 0) in the VM? I understand the
number 18 and 35 (the line number of the bytecode associated with my tag)
but where do come from 2 for example?
Thanks for your help
Séb
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20060412/3c354d71/attachment.htm
More information about the Soot-list
mailing list