[Joeq-devel] Question on quad operand
Status: Alpha
Brought to you by:
joewhaley
|
From: Yang Z. <uzh...@gm...> - 2012-10-09 00:48:52
|
Hi,
I have a class Test which includes a method with a synchronized block
1. public class Test{
2. String a = null;
3. public void test(){
4. synchronized(a){ ...
5. }
6. }
7. }
I want to iterator this class, and find the synchronized block and
synchronized object 'a', I write the following code:
1. public class SyncBlockVisitor extends QuadVisitor.EmptyVisitor {
2. Operator operator = q.getOperator();
3. if (operator instanceof Monitor) {
4. Operand operand = Monitor.getSrc(q);
5. if (operand instanceof RegisterOperand) {
6. // get the monitor register
7. }
8. }
9. *// Could I get another operator here?*
10. Operand o2 = Getfield.getBase(q);
11. if(o2 instanceof FieldOperand){
12. //* Could I get the class field 'a' here? and
How? *
13. }
14. }
My question is in line 9 and 12. If my code is wrong, how to correct it to
get the synchronized object 'a'?
Please help me.
--
*Yang Zhang
*
*School of Information Science and Engineering*
*Hebei University of Science and Technology*
*Shijiazhuang, Hebei, China
050018
*
|