[Soot-list] Stmt sourceStartColumnNumber and SourceStartLineNumber always at -1

Arzt, Steven steven.arzt at sit.fraunhofer.de
Tue Mar 7 13:40:20 EST 2017


Hi Thibault,

Have you enabled the --keep-line-numbers command-line option? Otherwise, source line numbers are not read in.

Best regards,
  Steven

From: Soot-list [mailto:soot-list-bounces at cs.mcgill.ca] On Behalf Of Thibault Beziers la fosse
Sent: Monday, March 6, 2017 10:13 AM
To: soot-list at cs.mcgill.ca
Subject: [Soot-list] Stmt sourceStartColumnNumber and SourceStartLineNumber always at -1

Hello,

I'm trying to instrument a class to display the columnNumbers and lineNumbers of the statement, during the execution.

I've made a simple BodyTransformer:
@Override
protected void internalTransform(Body body, String s, Map<String, String> map) {
Chain units = body.getUnits();
Iterator stmtIt = units.snapshotIterator();

while (stmtIt.hasNext()) {
Stmt stmt = (Stmt) stmtIt.next();

if (!stmt.containsInvokeExpr()) {
continue;
}
String value = "col: "+stmt.getJavaSourceStartColumnNumber()+" line:"+stmt.getJavaSourceStartLineNumber();

InvokeExpr newExp = Jimple.v().newStaticInvokeExpr(callMethod.makeRef(), StringConstant.v(value));

Stmt newInvokeStmt = Jimple.v().newInvokeStmt(newExp);

units.insertBefore(newInvokeStmt, stmt);
}
}

callMethod refers to a method executing a System.out.println(String value).

When I run the instrumented classes, the classes only display :
col: -1 line:-1

What should I do to get the exact values of the columns and line numbers ?

Thank you,

Best regards,

--
Thibault Béziers la Fosse

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20170307/82b79875/attachment.html>


More information about the Soot-list mailing list