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

Thibault Beziers la fosse thiblf at gmail.com
Mon Mar 6 04:13:07 EST 2017


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/20170306/a7ea930b/attachment.html>


More information about the Soot-list mailing list