Hi!
The logic for creating LineNumberTag is very simple. The code in
coffi.CFG between line 1613 to 1659 does this conversion. It might be
messed up in the middle of some other transformations. Eric should be
about to trace down using his example.
I tried to track down this problem but was not very successful. There are
some really weird thing going on:
The code in the section you pointed me to _is_ apparently attaching the
linenumbers to all the statements. But when they are lateron read out again,
some units do not have these tags:
void foo()
{
C r0, r3, $r4;
B $r1, r2;
A $r6;
r0 := @this: C;
$r1 = new B;
26
specialinvoke $r1.<B: void <init>()>();
26
r2 = $r1;
26
$r4 = new C;
27
specialinvoke $r4.<C: void <init>()>();
27
r3 = $r4;
27
virtualinvoke r3.<A: java.lang.String m()>();
$r6 = r0.<C: A d>;
29
virtualinvoke $r6.<A: java.lang.String m()>();
virtualinvoke r0.<C: void foo()>();
30
return;
31
}
As you can see, the two virtualinvoke statements to m() do not have numbers
attached.
What I realized is, that when the tags are added, they are added to a
JAssignmentStmt, e.g.
$stack0 = virtualinvoke $stack0.<A: java.lang.String m()>()
however when I reach the later stage of printing the enclosing SootMethod
(or processing it somehow else), these statements seem to be
JInvokeStatements (probably they are also broken down in two statements, I
am not sure here). And I suppose that during this creation process, tags are
not copied. Now I think the only places, where JInvokeStatements are created
at all are 4 lines inf coffi.CFG, that all state:
stmt = Jimple.v().newInvokeStmt((InvokeExpr) rvalue);
Probably that might tell you something...
So does anybody has an idea now of where that could go wrong?
Cheers,
Eric