protected void internalTransform(Body b, String phaseName, Map<String, String> options) { int idx = 0; PatchingChain<Unit> units = b.getUnits(); Iterator<Unit> it = units.iterator(); while (it.hasNext()) { Inst i = (Inst) it.next(); List<Tag> tags = i.getTags(); for (int k = 0; k < tags.size(); k++) { Tag t = (Tag) tags.get(k); if (t instanceof LineNumberTag) { tags.remove(k); break; } } if (i instanceof IdentityInst) { continue; } i.addTag(new LineNumberTag(idx++)); } } }
void setUnit(AbstractInsnNode insn, Unit u) { if (Options.v().keep_line_number() && lastLineNumber >= 0) { Tag lineTag = u.getTag("LineNumberTag"); if (lineTag == null) { lineTag = new LineNumberTag(lastLineNumber); u.addTag(lineTag); } else if (((LineNumberTag) lineTag).getLineNumber() != lastLineNumber) { throw new RuntimeException("Line tag mismatch"); } } Unit o = units.put(insn, u); if (o != null) { throw new AssertionError(insn.getOpcode() + " already has a unit, " + o); } }
private void createTag(soot.Value value, ASTNode node) { if(node == null || tagMap.containsKey(value)) return; if(node.getStart() != 0 && node.getEnd() != 0) { int line = node.getLine(node.getStart()); int column = node.getColumn(node.getStart()); int endLine = node.getLine(node.getEnd()); int endColumn = node.getColumn(node.getEnd()); String s = node.sourceFile(); s = s != null ? s.substring(s.lastIndexOf(java.io.File.separatorChar)+1) : "Unknown"; tagMap.put(value, new soot.tagkit.SourceLnNamePosTag(s, line, endLine, column, endColumn)); } else { tagMap.put(value, new soot.tagkit.LineNumberTag(node.lineNumber())); } }
/** * Fixes the line numbers. If there is a unit without a line number, it gets the line number of the last (transitive) * predecessor that has a line number. */ protected void fixLineNumbers() { int prevLn = -1; for (DexlibAbstractInstruction instruction : instructions) { Unit unit = instruction.getUnit(); int lineNumber = unit.getJavaSourceStartLineNumber(); if (lineNumber < 0) { if (prevLn >= 0) { unit.addTag(new LineNumberTag(prevLn)); unit.addTag(new SourceLineNumberTag(prevLn)); } } else { prevLn = lineNumber; } } }
meth.addTag(new LineNumberTag(line_num + 1)); meth.addTag(new LineNumberTag(line_num));
LineNumberTag lntag = new LineNumberTag(element0.line_number); stmtstags.put(start_stmt, lntag); startstmts.add(start_stmt);
public void setLine(ASTNode node) { if(node.getStart() != 0 && node.getEnd() != 0) { int line = node.getLine(node.getStart()); int column = node.getColumn(node.getStart()); int endLine = node.getLine(node.getEnd()); int endColumn = node.getColumn(node.getEnd()); String s = node.sourceFile(); s = s != null ? s.substring(s.lastIndexOf(java.io.File.separatorChar)+1) : "Unknown"; lineTag = new soot.tagkit.SourceLnNamePosTag(s, line, endLine, column, endColumn); } else { lineTag = new soot.tagkit.LineNumberTag(node.lineNumber()); } }
/** * Tag the passed host with: - this instructions line number (if one is set) - the original bytecode offset * * @param host * the host to tag */ protected void addTags(Host host) { Options options = Options.v(); if (options.keep_line_number() && lineNumber != -1) { host.addTag(new LineNumberTag(lineNumber)); host.addTag(new SourceLineNumberTag(lineNumber)); } if (options.keep_offset()) { host.addTag(new BytecodeOffsetTag(codeAddress)); } }
meth.addTag(new LineNumberTag(line_num + 1)); meth.addTag(new LineNumberTag(line_num));
meth.addTag(new LineNumberTag(line_num + 1)); meth.addTag(new LineNumberTag(line_num));
LineNumberTag lntag= new LineNumberTag( element0.line_number); stmtstags.put(start_stmt, lntag);
LineNumberTag lntag= new LineNumberTag( element0.line_number); stmtstags.put(start_stmt, lntag);