[Soot-list] how to get the initial value of sootField

Tobias Gutzmann tobias.gutzmann at lnu.se
Wed May 19 17:00:57 EDT 2010


Hi,

only static fields have attributes (named "ConstantValue") with them. Initialization of instance fields must be inlined into the constructors. Confer http://java.sun.com/docs/books/jvms/second_edition/html/ClassFile.doc.html#1405 for this. 

For class fields (i.e., implicitly/explicitly "static"), you should be able to query a field's tags and look for this tag: 
http://www.sable.mcgill.ca/soot/doc/soot/tagkit/ConstantValueTag.html  (I have no idea, though, why it does not implement the "Attribute" interface)

I hope this helps; I haven't actually tried it.

Best regards,
Tobias
________________________________________
From: soot-list-bounces at sable.mcgill.ca [soot-list-bounces at sable.mcgill.ca] On Behalf Of dingsun [xyz031702 at hotmail.com]
Sent: Wednesday, May 19, 2010 8:35 PM
To: soot-list at sable.mcgill.ca
Subject: [Soot-list] how to get the initial value of sootField

Dear All
       If I have a program as below, how can I get the initial value of the field "x" , which is 999? Because I checked the API, it seems sootField doesn't provide methods to obtain such initial values.

Best Regards,
Ding Sun

Class A{
    public int x=999;

    public void f1(){

    ......
   }


}



________________________________
聊天+搜索+邮箱 想要轻松出游,手机MSN帮你搞定! 立刻下载!<http://3g.msn.cn/>


More information about the Soot-list mailing list