Exemplo n.º 1
0
 protected static String getLoType(
     final Type type, String base, int index, Map<String, String> structs) {
   if (type instanceof StructureType) {
     StringBuilder sb = new StringBuilder();
     StructureType st = (StructureType) type;
     sb.append("{");
     String name = String.format("%s_%04d", base, index);
     for (int i = 0; i < st.getTypeCount(); i++) {
       Type t = st.getTypeAt(i);
       if (i == 0 && t instanceof StructureType) {
         if (((StructureType) t).getTypeCount() == 0) {
           // Skip empty structs as first member
           continue;
         }
       }
       // Only support arrays embedded in structs
       StringBuilder dims = new StringBuilder();
       while (t instanceof ArrayType) {
         ArrayType at = (ArrayType) t;
         dims.append('[').append(at.getSize()).append(']');
         t = ((ArrayType) t).getElementType();
       }
       sb.append(getLoType(t, name, i, structs)).append(" m" + i).append(dims).append(";");
     }
     sb.append("}");
     structs.put(name, sb.toString());
     return "struct " + name;
   } else {
     return getHiType(type);
   }
 }
Exemplo n.º 2
0
 public static String getDescriptor(List<soot.Type> paramTypes, soot.Type returnType) {
   StringBuilder sb = new StringBuilder();
   sb.append('(');
   for (soot.Type t : paramTypes) {
     sb.append(getDescriptor(t));
   }
   sb.append(')');
   sb.append(getDescriptor(returnType));
   return sb.toString();
 }
Exemplo n.º 3
0
 private static void nextDescriptor(CharBuffer cb, StringBuilder sb) {
   char c = cb.get();
   sb.append(c);
   if (c == 'L') {
     do {
       c = cb.get();
       sb.append(c);
     } while (c != ';');
   } else if (c == '[') {
     nextDescriptor(cb, sb);
   } else {
     // Must be a primitive
   }
 }
Exemplo n.º 4
0
 @Override
 public String toString() {
   StringBuilder builder = new StringBuilder();
   builder
       .append("Entry [index=")
       .append(index)
       .append(", name=")
       .append(name)
       .append(", desc=")
       .append(desc)
       .append("]");
   return builder.toString();
 }
Exemplo n.º 5
0
 @Override
 public String toString() {
   StringBuilder builder = new StringBuilder();
   builder
       .append("ResolvedEntry [modifiers=")
       .append(modifiers)
       .append(", declaringClass=")
       .append(declaringClass)
       .append(", index=")
       .append(index)
       .append(", name=")
       .append(name)
       .append(", desc=")
       .append(desc)
       .append("]");
   return builder.toString();
 }