private boolean coversLineNumber(int lineNumber, Host host) { { SourceLnPosTag tag = (SourceLnPosTag) host.getTag("SourceLnPosTag"); if (tag != null) { if (tag.startLn() <= lineNumber && tag.endLn() >= lineNumber) { return true; } } } { LineNumberTag tag = (LineNumberTag) host.getTag("LineNumberTag"); if (tag != null) { if (tag.getLineNumber() == lineNumber) { return true; } } } return false; }
private boolean hasColorTag(Host h) { for (Tag t : h.getTags()) { if (t instanceof ColorTag) { return true; } } return false; }
/** * Finds a VisibilityAnnotationTag attached to a given Host with the appropriate visibility, or adds one if no such tag is * attached. * * @param h * an Host * @param visibility * a visibility level, taken from soot.tagkit.AnnotationConstants * @return */ private VisibilityAnnotationTag findOrAdd(Host h, int visibility) { ArrayList<VisibilityAnnotationTag> va_tags = new ArrayList<VisibilityAnnotationTag>(); for (Tag t : h.getTags()) { if (t instanceof VisibilityAnnotationTag) { VisibilityAnnotationTag vat = (VisibilityAnnotationTag) t; if (vat.getVisibility() == visibility) { va_tags.add(vat); } } } if (va_tags.isEmpty()) { VisibilityAnnotationTag vat = new VisibilityAnnotationTag(visibility); h.addTag(vat); return vat; } // return the first visibility annotation with the right visibility return (va_tags.get(0)); }
if (Modifier.isSynthetic(modVal) || host.hasTag("SyntheticTag")) { modifier |= Opcodes.ACC_SYNTHETIC;
/** * Position Tag Adder */ public static void addPosTag(soot.tagkit.Host host, int sc, int ec) { host.addTag(new soot.tagkit.SourcePositionTag(sc, ec)); }
/** Adds all the tags from h to this host. */ @Override public void addAllTagsOf(Host h) { List<Tag> tags = h.getTags(); if (tags.isEmpty()) { return; } if (mTagList == null) { mTagList = new ArrayList<Tag>(tags.size()); } mTagList.addAll(tags); }
private boolean coversLineNumber(int lineNumber, Host host) { { SourceLnPosTag tag = (SourceLnPosTag) host.getTag("SourceLnPosTag"); if(tag!=null) { if(tag.startLn()<=lineNumber && tag.endLn()>=lineNumber) { return true; } } } { LineNumberTag tag = (LineNumberTag) host.getTag("LineNumberTag"); if(tag!=null) { if(tag.getLineNumber()==lineNumber) { return true; } } } return false; }
/** * Line Tag Adder */ public static void addLineTag(soot.tagkit.Host host, int sLine, int eLine) { host.addTag(new soot.tagkit.SourceLineNumberTag(sLine, eLine)); }
private int getJimpleLnOfHost(Host h) { Iterator<Tag> it = h.getTags().iterator(); while (it.hasNext()) { Tag t = it.next(); if (t instanceof JimpleLineNumberTag) { return ((JimpleLineNumberTag) t).getStartLineNumber(); } } return 0; } }
private boolean coversLineNumber(int lineNumber, Host host) { { SourceLnPosTag tag = (SourceLnPosTag) host.getTag("SourceLnPosTag"); if(tag!=null) { if(tag.startLn()<=lineNumber && tag.endLn()>=lineNumber) { return true; } } } { LineNumberTag tag = (LineNumberTag) host.getTag("LineNumberTag"); if(tag!=null) { if(tag.getLineNumber()==lineNumber) { return true; } } } return false; }
public static void addMethodPosTag(soot.tagkit.Host meth, int start, int end) { meth.addTag(new soot.tagkit.SourcePositionTag(start, end)); }
private int getJimpleLnOfHost(Host h) { Iterator<Tag> it = h.getTags().iterator(); while (it.hasNext()) { Tag t = it.next(); if (t instanceof JimpleLineNumberTag) { return ((JimpleLineNumberTag) t).getStartLineNumber(); } } return 0; }
/** * @see FieldVisitor#visitAttribute(Attribute) * @see MethodVisitor#visitAttribute(Attribute) * @see ClassVisitor#visitAttribute(Attribute) */ public void visitAttribute(Attribute attr) { // SA, 2017-07-21: As of ASM 5.1, there is no better way to obtain // attribute values. byte[] value = null; try { Field fld = Attribute.class.getDeclaredField("value"); fld.setAccessible(true); value = (byte[]) fld.get(attr); } catch (Exception ex) { // Just carry on } host.addTag(new GenericAttribute(attr.type, value)); } }
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; }
/** * Converts field annotations from Dexlib to Jimple * * @param h * @param f */ public void handleFieldAnnotation(Host h, Field f) { Set<? extends Annotation> aSet = f.getAnnotations(); if (aSet != null && !aSet.isEmpty()) { List<Tag> tags = handleAnnotation(aSet, null); if (tags != null) { for (Tag t : tags) { if (t != null) { h.addTag(t); } } } } }
private int getJavaLnOfHost(Host h) { Iterator<Tag> it = h.getTags().iterator(); while (it.hasNext()) { Tag t = it.next(); // logger.debug(""+t.getClass().toString()); if (t instanceof SourceLnPosTag) { // logger.debug("t is LineNumberTag"); return ((SourceLnPosTag) t).startLn(); } else if (t instanceof LineNumberTag) { return (new Integer(((LineNumberTag) t).toString())).intValue(); } } return 0; }
/** * 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)); } }
private boolean hasTag(Host h) { if (h instanceof Unit) { Iterator<ValueBox> usesAndDefsIt = ((Unit) h).getUseAndDefBoxes().iterator(); while (usesAndDefsIt.hasNext()) { if (hasTag(usesAndDefsIt.next())) { return true; } } } if (h.getTags().isEmpty()) { return false; } return true; }
/** * @see FieldVisitor#visitAnnotation(String, boolean) * @see MethodVisitor#visitAnnotation(String, boolean) * @see ClassVisitor#visitAnnotation(String, boolean) */ public AnnotationVisitor visitAnnotation(final String desc, boolean visible) { VisibilityAnnotationTag tag; if (visible) { tag = visibleTag; if (tag == null) { visibleTag = tag = new VisibilityAnnotationTag(AnnotationConstants.RUNTIME_VISIBLE); host.addTag(tag); } } else { tag = invisibleTag; if (tag == null) { invisibleTag = tag = new VisibilityAnnotationTag(AnnotationConstants.RUNTIME_INVISIBLE); host.addTag(tag); } } scb.addDep(AsmUtil.toQualifiedName(desc.substring(1, desc.length() - 1))); final VisibilityAnnotationTag _tag = tag; return new AnnotationElemBuilder() { @Override public void visitEnd() { AnnotationTag annotTag = new AnnotationTag(desc, elems); _tag.addAnnotation(annotTag); } }; }