本文整理汇总了Java中soot.tagkit.LineNumberTag类的典型用法代码示例。如果您正苦于以下问题:Java LineNumberTag类的具体用法?Java LineNumberTag怎么用?Java LineNumberTag使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LineNumberTag类属于soot.tagkit包,在下文中一共展示了LineNumberTag类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: internalTransform
import soot.tagkit.LineNumberTag; //导入依赖的package包/类
protected void internalTransform(Body b, String phaseName, Map<String,String> options) {
System.out.println("Printing Line Numbers for: " + b.getMethod().getSignature());
PatchingChain<Unit> units = b.getUnits(); // get the method code
Iterator<Unit> it = units.iterator();
while (it.hasNext()) { // for each jimple statement or baf instruction
Unit u = (Unit)it.next();
if (u.hasTag("LineNumberTag")) { // see if a LineNumberTag exists (it will if you use -keep-line-number)
LineNumberTag tag = (LineNumberTag)u.getTag(("LineNumberTag"));
System.out.println(u + " has Line Number: " + tag.getLineNumber()); // print out the unit and line number
} else {
System.out.println(u + " has no Line Number");
}
}
System.out.println("\n");
}
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:19,代码来源:LineNumberGenerator.java
示例2: parseAnnotations
import soot.tagkit.LineNumberTag; //导入依赖的package包/类
public void parseAnnotations(Unit u, int indx){
Set<String> annotationName = LogicBloxAnnotExporter.annotationName;
Map<Integer, List<Trio<String, String, String>>> pgmPtAnnot = LogicBloxAnnotExporter.pgmPtAnnot;
if(pgmPtAnnot.containsKey(indx))
return;
List<Trio<String, String, String>> annots = new ArrayList<Trio<String, String, String>>();
for(Tag t : u.getTags()){
if(t instanceof VisibilityAnnotationTag){
Map<String,List<Pair<String,String>>> parsed = SootUtilities.parseVisibilityAnnotationTag((VisibilityAnnotationTag)t);
for(String annotName : parsed.keySet()){
annotationName.add(annotName);
List<Pair<String,String>> keyValues = parsed.get(annotName);
for(Pair<String,String> p : keyValues){
annots.add(new Trio<String,String,String>(annotName,p.val0,p.val1));
}
}
}else if(t instanceof LineNumberTag){
LineNumberTag lnt = (LineNumberTag)t;
annotationName.add("LineNumberTag");
annots.add(new Trio<String,String,String>("LineNumberTag","LineNumber",Integer.toString(lnt.getLineNumber())) );
}
}
pgmPtAnnot.put(indx, annots);
}
开发者ID:petablox-project,项目名称:petablox,代码行数:25,代码来源:DomP.java
示例3: getLineNumFromSoot
import soot.tagkit.LineNumberTag; //导入依赖的package包/类
public int getLineNumFromSoot() {
Stmt context = null;
if (mRootSink != null) {
context = mRootSink.getContext();
} else if (mRootSource != null) {
context = mRootSource.getContext();
}
if (context == null) {
System.err.println("Context was not obtained neither from Sink nor from Source.");
return -1;
}
if (context.hasTag("LineNumberTag")) {
return ((LineNumberTag)context.getTag("LineNumberTag")).getLineNumber();
}
return -1;
}
开发者ID:SeoulTech,项目名称:Manal,代码行数:21,代码来源:ApiDescriptor.java
示例4: highlightJavaSource
import soot.tagkit.LineNumberTag; //导入依赖的package包/类
/**
* Highlights units in java source.
* @param unit The unit which needs to be highlighted.
*/
public void highlightJavaSource(VFUnit unit) {
try {
ServiceUtil.getService(DataModel.class).filterGraph(new ArrayList<VFNode>(), false, true, null);
} catch (Exception e) {
e.printStackTrace();
}
LineNumberTag ln = (LineNumberTag) unit.getUnit().getTag("LineNumberTag");
String className = unit.getVfMethod().getVfClass().getSootClass().getName();
if (ln != null) {
highLightJavaSourceCode(ln.getLineNumber(), className);
}
}
开发者ID:VisuFlow,项目名称:visuflow-plugin,代码行数:17,代码来源:NavigationHandler.java
示例5: getSelectedUnit
import soot.tagkit.LineNumberTag; //导入依赖的package包/类
/**
* This function filters the units of a class according to the function name and class name and content.
* We need to filter this based on methods, because different function might contain similar lines of code and
* hence their contents will be similar.
* @param className The name of the class.
* @param document The document which the user is currently interacting with
* @param content The contents of the document.
* @param lineNumber The linenumber on which the user has right-clicked.
* @return Map of filtered unit and the function it belongs to.
*/
private HashMap<VFUnit, VFMethod> getSelectedUnit(String className, IDocument document, int lineNumber) {
DataModel dataModel = ServiceUtil.getService(DataModel.class);
HashMap<VFUnit, VFMethod> map = new HashMap<VFUnit, VFMethod>();
for (VFClass vfClass : dataModel.listClasses()) {
if (vfClass.getSootClass().getShortJavaStyleName().equals(className)) {
List<VFMethod> vfMethods = vfClass.getMethods();
Map<String, Integer> methodLines = getMethodLineNumbers(document, vfMethods);
Collection<Integer> allMethodLines = methodLines.values();
List<Integer> lesserThanCuurent = allMethodLines.stream().filter(x -> x.intValue() < lineNumber).collect(Collectors.toList());
int toBeCompared = lesserThanCuurent.get(lesserThanCuurent.size() - 1);
for (VFMethod method : vfMethods) {
int methodLine = methodLines.getOrDefault(method.getSootMethod().getDeclaration(), 0);
if (methodLine != 0 && toBeCompared == methodLine) {
for (VFUnit unit : method.getUnits()) {
LineNumberTag ln = (LineNumberTag) unit.getUnit().getTag("LineNumberTag");
if (ln != null && ln.getLineNumber() == lineNumber + 1) {
map.put(unit, method);
}
}
}
}
}
}
return map;
}
开发者ID:VisuFlow,项目名称:visuflow-plugin,代码行数:38,代码来源:JavaToCFGHandler.java
示例6: toString
import soot.tagkit.LineNumberTag; //导入依赖的package包/类
@Override
public String toString() {
StringBuilder sb = new StringBuilder(sink == null
? accessPath.toString() : sink.toString());
if (sink != null && sink.hasTag("LineNumberTag"))
sb.append(" on line ").append(((LineNumberTag)sink.getTag("LineNumberTag")).getLineNumber());
return sb.toString();
}
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:11,代码来源:ResultSinkInfo.java
示例7: toString
import soot.tagkit.LineNumberTag; //导入依赖的package包/类
@Override
public String toString(){
StringBuilder sb = new StringBuilder(source.toString());
if (source.hasTag("LineNumberTag"))
sb.append(" on line ").append(((LineNumberTag) source.getTag("LineNumberTag")).getLineNumber());
return sb.toString();
}
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:10,代码来源:ResultSourceInfo.java
示例8: getLineNumber
import soot.tagkit.LineNumberTag; //导入依赖的package包/类
private static int getLineNumber(Stmt s) {
Iterator ti = s.getTags().iterator();
while (ti.hasNext()) {
Object o = ti.next();
if (o instanceof LineNumberTag)
return Integer.parseInt(o.toString());
}
return -1;
}
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:10,代码来源:PointsToAnalysis.java
示例9: addTags
import soot.tagkit.LineNumberTag; //导入依赖的package包/类
/**
* 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) {
if (lineNumber != -1) {
host.addTag(new LineNumberTag(lineNumber));
host.addTag(new SourceLineNumberTag(lineNumber));
}
host.addTag(new BytecodeOffsetTag(codeAddress));
}
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:15,代码来源:DexlibAbstractInstruction.java
示例10: getJavaLnOfHost
import soot.tagkit.LineNumberTag; //导入依赖的package包/类
private int getJavaLnOfHost(Host h){
Iterator<Tag> it = h.getTags().iterator();
while (it.hasNext()){
Tag t = it.next();
if (t instanceof SourceLnPosTag) {
return ((SourceLnPosTag)t).startLn();
}
else if (t instanceof LineNumberTag){
return (new Integer(((LineNumberTag)t).toString())).intValue();
}
}
return 0;
}
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:14,代码来源:Attribute.java
示例11: getJavaLnOfHost
import soot.tagkit.LineNumberTag; //导入依赖的package包/类
private int getJavaLnOfHost(Host h){
Iterator<Tag> it = h.getTags().iterator();
while (it.hasNext()){
Tag t = it.next();
//G.v().out.println(t.getClass().toString());
if (t instanceof SourceLnPosTag) {
//G.v().out.println("t is LineNumberTag");
return ((SourceLnPosTag)t).startLn();
}
else if (t instanceof LineNumberTag){
return (new Integer(((LineNumberTag)t).toString())).intValue();
}
}
return 0;
}
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:16,代码来源:JavaAttribute.java
示例12: toXMLAttrsString
import soot.tagkit.LineNumberTag; //导入依赖的package包/类
@Override
public String toXMLAttrsString(Object o) {
if (o instanceof Unit) {
Unit u = (Unit) o;
Type t = getType(u);
String type = (t != null) ? t.toString() : "null";
SootMethod m = SootUtilities.getMethod(u);
//String file = ((SourceFileTag)m.getDeclaringClass().getTags().get(0)).getSourceFile();
List<Tag> tags = m.getDeclaringClass().getTags();
String file = null;
for(Tag x : tags) {
if( x instanceof SourceFileTag) {
file = ((SourceFileTag)x).getSourceFile();
break;
}
}
int line = -1; // ((LineNumberTag)u.getTag("LineNumberTag")).getLineNumber();
Tag tg = u.getTag("LineNumberTag");
if(tg != null && tg instanceof LineNumberTag) {
line = ((LineNumberTag) tg).getLineNumber();
}
int mIdx = domM.indexOf(m);
return "file=\"" + file + "\" " + "line=\"" + line + "\" " +
"Mid=\"M" + mIdx + "\"" + " type=\"" + type + "\"";
}
return "";
}
开发者ID:petablox-project,项目名称:petablox,代码行数:28,代码来源:DomH.java
示例13: toXMLAttrsString
import soot.tagkit.LineNumberTag; //导入依赖的package包/类
@Override
public String toXMLAttrsString(Unit u) {
SootMethod m = SootUtilities.getMethod(u);
String file = ((SourceFileTag)m.getDeclaringClass().getTags().get(0)).getSourceFile();
int line = ((LineNumberTag)u.getTag("LineNumberTag")).getLineNumber();
int mIdx = domM.indexOf(m);
return "file=\"" + file + "\" " + "line=\"" + line + "\" " + "Mid=\"M" + mIdx + "\"";
//return "";
}
开发者ID:petablox-project,项目名称:petablox,代码行数:10,代码来源:DomP.java
示例14: toXMLAttrsString
import soot.tagkit.LineNumberTag; //导入依赖的package包/类
@Override
public String toXMLAttrsString(Unit u) {
SootMethod m = SootUtilities.getMethod(u);
//String file = ((SourceFileTag)m.getDeclaringClass().getTags().get(0)).getSourceFile();
LineNumberTag tag = (LineNumberTag)u.getTag("LineNumberTag");
int line = -1;
if(tag != null) line = tag.getLineNumber();
//int line = ((LineNumberTag)u.getTag("LineNumberTag")).getLineNumber();
int mIdx = domM.indexOf(m);
//return "file=\"" + file + "\" " + "line=\"" + line + "\" " + "Mid=\"M" + mIdx + "\"";
return "line=\"" + line + "\" " + "Mid=\"M" + mIdx + "\"";
}
开发者ID:petablox-project,项目名称:petablox,代码行数:13,代码来源:DomL.java
示例15: toXMLAttrsString
import soot.tagkit.LineNumberTag; //导入依赖的package包/类
@Override
public String toXMLAttrsString(Unit o) {
SootMethod m = SootUtilities.getMethod(o);
String file = ((SourceFileTag)m.getDeclaringClass().getTags().get(0)).getSourceFile();
int line = ((LineNumberTag)o.getTag("LineNumberTag")).getLineNumber();
int mIdx = domM.indexOf(m);
return "file=\"" + file + "\" " + "line=\"" + line + "\" " + "Mid=\"M" + mIdx + "\"";
}
开发者ID:petablox-project,项目名称:petablox,代码行数:9,代码来源:DomR.java
示例16: toJavaLocStr
import soot.tagkit.LineNumberTag; //导入依赖的package包/类
public static String toJavaLocStr(Unit u) {
SootClass c = SootUtilities.getMethod(u).getDeclaringClass();
SourceFileTag filetag = (SourceFileTag) c.getTag("SourceFileTag");
LineNumberTag linetag = ((LineNumberTag)u.getTag("LineNumberTag"));
if (filetag == null || linetag == null)
return "UNKNOWN location";
else
return filetag.getSourceFile() + ":" + linetag.getLineNumber();
}
开发者ID:petablox-project,项目名称:petablox,代码行数:10,代码来源:SootUtilities.java
示例17: stmtLineNum
import soot.tagkit.LineNumberTag; //导入依赖的package包/类
public int stmtLineNum(Stmt s) {
for(Tag tag : s.getTags()){
if(tag instanceof JimpleLineNumberTag) {
return ((JimpleLineNumberTag) tag).getLineNumber();
} else if(tag instanceof LineNumberTag) {
return ((LineNumberTag) tag).getLineNumber();
}
}
return 0;
}
开发者ID:petablox-project,项目名称:petablox,代码行数:11,代码来源:JimpleSourceInfo.java
示例18: stmtLineNum
import soot.tagkit.LineNumberTag; //导入依赖的package包/类
public int stmtLineNum(Stmt s) {
for(Tag tag : s.getTags()){
if(tag instanceof SourceLineNumberTag){
return ((SourceLineNumberTag) tag).getLineNumber();
} else if(tag instanceof LineNumberTag){
return ((LineNumberTag) tag).getLineNumber();
}
}
return 0;
}
开发者ID:petablox-project,项目名称:petablox,代码行数:11,代码来源:JavaSourceInfo.java
示例19: getLineNumber
import soot.tagkit.LineNumberTag; //导入依赖的package包/类
public static int getLineNumber(Stmt stmt)
{
Tag tag = stmt.getTag("LineNumberTag");
if(tag==null)
return 0;
else
return ((LineNumberTag)tag).getLineNumber();
}
开发者ID:parasol-aser,项目名称:tsa,代码行数:9,代码来源:Util.java
示例20: toString
import soot.tagkit.LineNumberTag; //导入依赖的package包/类
@Override
public String toString(){
StringBuilder sb = new StringBuilder(context.toString());
if (context.hasTag("LineNumberTag"))
sb.append(" on line ").append(((LineNumberTag) context.getTag("LineNumberTag")).getLineNumber());
return sb.toString();
}
开发者ID:0-14N,项目名称:soot-inflow,代码行数:10,代码来源:InfoflowResults.java
注:本文中的soot.tagkit.LineNumberTag类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论