Examples of LocalVariableTableAttribute


Examples of alt.jiapi.file.LocalVariableTableAttribute

//         if (!Modifier.isStatic(getModifiers())) {
//             maxLocals++; // 'this'
//         }
       
        LocalVariableTableAttribute lvta = (LocalVariableTableAttribute)getAttribute(LocalVariableTableAttribute.ATTRIBUTE_NAME);

        // Add local variables other than ones in method signature
        if (lvta != null) {
            maxLocals += lvta.getLocalVariables().size();
        }


        short maxLocalsInInstructions = 0;
        for(int i = 0; i < il.size(); i++) {
View Full Code Here

Examples of com.strobel.assembler.ir.attributes.LocalVariableTableAttribute

        b.position(0);

        final InstructionCollection body = _methodBody.getInstructions();
        final VariableDefinitionCollection variables = _methodBody.getVariables();

        final LocalVariableTableAttribute localVariableTable = SourceAttribute.find(
            AttributeNames.LocalVariableTable,
            _code.getAttributes()
        );

        final LocalVariableTableAttribute localVariableTypeTable = SourceAttribute.find(
            AttributeNames.LocalVariableTypeTable,
            _code.getAttributes()
        );

        final boolean hasThis = !Modifier.isStatic(_modifiers);
View Full Code Here

Examples of com.strobel.assembler.ir.attributes.LocalVariableTableAttribute

        b.position(0);

        final InstructionCollection body = _methodBody.getInstructions();
        final VariableDefinitionCollection variables = _methodBody.getVariables();

        final LocalVariableTableAttribute localVariableTable = SourceAttribute.find(
            AttributeNames.LocalVariableTable,
            _code.getAttributes()
        );

        final LocalVariableTableAttribute localVariableTypeTable = SourceAttribute.find(
            AttributeNames.LocalVariableTypeTable,
            _code.getAttributes()
        );

        final boolean hasThis = !Modifier.isStatic(_modifiers);
View Full Code Here

Examples of com.techtrader.modules.tools.bytecode.LocalVariableTableAttribute

        // Get the Code object, which contains the local variable table.
        Code code = bmeth.getCode();
        if (code == null)
            return null;

        LocalVariableTableAttribute attr =
                (LocalVariableTableAttribute)code.getAttribute(Constants.ATTR_LOCALS);

        if (attr == null)
            return null;

        // OK, found it.  Now scan through the local variables and record
        // the names in the right indices.
        LocalVariable [] vars = attr.getLocalVariables();

        String [] argNames = new String[numParams + 1];
        argNames[0] = null; // don't know return name

        // NOTE: we scan through all the variables here, because I have been
View Full Code Here

Examples of com.techtrader.modules.tools.bytecode.LocalVariableTableAttribute

        // Get the Code object, which contains the local variable table.
        Code code = bmeth.getCode();
        if (code == null)
            return null;

        LocalVariableTableAttribute attr =
                (LocalVariableTableAttribute)code.getAttribute(Constants.ATTR_LOCALS);

        if (attr == null)
            return null;

        // OK, found it.  Now scan through the local variables and record
        // the names in the right indices.
        LocalVariable [] vars = attr.getLocalVariables();

        String [] argNames = new String[numParams + 1];
        argNames[0] = null; // don't know return name

        // NOTE: we scan through all the variables here, because I have been
View Full Code Here

Examples of net.sf.rej.java.attribute.LocalVariableTableAttribute

                } else {
                  sd.drawDefault(m.getName());
                }

                CodeAttribute ca = m.getAttributes().getCode();
                LocalVariableTableAttribute lvs = null;
                if (ca != null) {
                  lvs = ca.getAttributes().getLocalVariableTable();
                }

                int paramLVDefOffset = 0;
                if (!AccessFlags.isStatic(m.getAccessFlags())) {
                  paramLVDefOffset = 1;
                }

                sd.drawDefault("(");
                List<JavaType> params = m.getDescriptor().getParamList();
                List<GenericJavaType> genParams = null;
                if (methodSig != null) {
                  genParams = methodSig.getParameters();
                }
            boolean displayVarargs = SystemFacade.getInstance().getPreferences().isSettingTrue(Settings.DISPLAY_VARARGS);
            for (int i = 0; i < params.size(); i++) {
                    if (i > 0) {
                        sd.drawDefault(", ");
                    }
                    JavaType item = params.get(i);
                    // last time, method has varargs flag and type is a one dimensional array
                    boolean isLastItem = (i == params.size()-1);
                    if (displayVarargs
                     && isLastItem
                     && AccessFlags.isVarArgs(m.getAccessFlags())
                     && (item.getDimensionCount() > 0)) {
                      item.dropDimension();
                      if (methodSig == null) {
                        if (item.isPrimitive()) {
                          sd.drawKeyword(item.getType());
                        } else {
                          sd.drawDefault(ia.getShortName(item.getType()));
                        }
                        sd.drawDefault(item.getDimensions());
                      } else {
                        GenericJavaType genType = genParams.get(i);
                        genType.getBaseType().dropDimension();
                        renderGenericJavaType(sd, ia, genType);
                      }

                      sd.drawDefault(" ... ");
                      LocalVariable lv = null;
                      if (lvs != null) {
                        lv = lvs.getLocalVariable(paramLVDefOffset + i, 0);
                      }
                      if (lv != null) {
                        sd.drawDefault(lv.getName());
                      } else {
                        sd.drawDefault("p" + i);
                      }
                     
                    } else {
                      if (methodSig == null) {
                        if (item.isPrimitive()) {
                          sd.drawKeyword(item.getType());
                        } else {
                          sd.drawDefault(ia.getShortName(item.getType()));
                        }
                        sd.drawDefault(item.getDimensions());
                      } else {
                        renderGenericJavaType(sd, ia, genParams.get(i));
                      }
                      sd.drawDefault(" ");
                      LocalVariable lv = null;
                      if (lvs != null) {
                        lv = lvs.getLocalVariable(paramLVDefOffset + i, 0);
                      }
                      if (lv != null) {
                        sd.drawDefault(lv.getName());
                      } else {
                        sd.drawDefault("p" + i);
                      }
                    }
                }

                sd.drawDefault(")");
                List exc = m.getExceptions();
                for (int i = 0; i < exc.size(); i++) {
                    if (i == 0) {
                        sd.drawKeyword(" throws ");
                    } else {
                        sd.drawDefault(", ");
                    }
                    sd.drawDefault(ia.getShortName(((ExceptionDescriptor) exc.get(i)).getName()));
                }
                if (mdr.hasBody()) {
                  sd.drawDefault(" {");
                } else {
                  sd.drawDefault(";");
                }
            }
        } else if (er instanceof LocalVariableDefRow) {
            LocalVariableDefRow lvdr = (LocalVariableDefRow)er;
            LocalVariable lv = lvdr.getLocalVariable();
            JavaType ret = lv.getDescriptor().getReturn();
          sd.drawIndent();
          sd.drawIndent();

            if (ret.isPrimitive()) {
                sd.drawKeyword(ret.getType());
            } else {
                sd.drawDefault(ia.getShortName(ret.getType()));
            }
            sd.drawDefault(ret.getDimensions() + " " + lv.getName() + " (#" + lv.getIndex() + " " + lv.getStartPc() + " - " + lv.getEndPc() + ")");
        } else if (er instanceof LabelRow) {
            LabelRow lr = (LabelRow)er;
          sd.drawIndent();
          sd.drawIndent();
            sd.drawDefault(lr.getLabel().getId() + ":");
        } else if (er instanceof CodeRow) {
            CodeRow cr = (CodeRow)er;
           
            // execution row
            if (cr.isExecutionRow()) {
              sd.setExecutionBackground();
            }
            // breakpoint
            if (cr.getBreakpoint() != null) {
              sd.drawBreakpoint();
            }
           
            // line identifier
            LineIdentifierMode mode = EditorFacade.getInstance().getLineIdentifierMode();
            switch (mode.getMode()) {
                case LineIdentifierMode.MODE_OFF:
                    break;
                case LineIdentifierMode.MODE_PC:
                    sd.drawSmall(String.valueOf(cr.getPosition()), 15);
                    break;
                case LineIdentifierMode.MODE_SOURCELINE:
                    if (cr.hasLineNumber()) {
                        sd.drawSmall(String.valueOf(cr.getLineNumber()), 0);
                    }
                    break;
            }

            sd.setOffset(0);

            Instruction inst = cr.getInstruction();
            DecompilationContext dc = cr.getDecompilationContext();
            LocalVariableTableAttribute lvs = dc.getLocalVariableTable();
            ConstantPool pool = dc.getConstantPool();
          sd.drawIndent();
          sd.drawIndent();
            sd.drawInstruction(inst.getMnemonic());
            Parameters params = inst.getParameters();
            for (int i = 0; i < params.getCount(); i++) {
                try {
                    switch (params.getType(i)) {
                        case TYPE_LOCAL_VARIABLE:
                        case TYPE_LOCAL_VARIABLE_WIDE:
                        case TYPE_LOCAL_VARIABLE_READONLY:
                            if (lvs == null) {
                                sd.drawDefault(" " + params.getInt(i));
                            } else {
                                LocalVariable lv = lvs.getLocalVariable(params.getInt(i), cr.getPosition());
                                if (lv == null) {
                                    sd.drawDefault(" " + params.getInt(i));
                                } else {
                                    sd.drawDefault(" " + lv.getName());
                                }
View Full Code Here

Examples of net.sf.rej.java.attribute.LocalVariableTableAttribute

    Attributes attr = method.getAttributes();
    CodeAttribute codeAttr = attr.getCode();

    LineNumberTableAttribute lnAttr = null;
    LocalVariableTableAttribute lvs = null;
    if (codeAttr != null) {
      if (codeAttr.getAttributes() != null) {
        lnAttr = codeAttr.getAttributes().getLineNumberTable();
        lvs = codeAttr.getAttributes().getLocalVariableTable();
      }
      Code code = codeAttr.getCode();
      DecompilationContext dc = code.createDecompilationContext();
      List instructions = code.getInstructions();
      dc.setPosition(0);
      for (int j = 0; j < instructions.size(); j++) {
        Instruction instruction = (Instruction) instructions.get(j);

        if (instruction instanceof Label) {
          LabelRow lr = new LabelRow((Label) instruction, mdr);
          lr.setParentCode(code);
          list.add(lr);
          mdr.addCodeRow(lr);
        } else {
          int lineNumber = -1;

          if (lnAttr != null) {
            lineNumber = lnAttr.getLineNumber(dc.getPosition());
          }
          if (lvs != null) {
            List locals = lvs
                .getLocalVariable(dc.getPosition());
            for (int k = 0; k < locals.size(); k++) {
              LocalVariable lv = (LocalVariable) locals
                  .get(k);
              LocalVariableDefRow lvdr = new LocalVariableDefRow(
View Full Code Here

Examples of net.sf.rej.java.attribute.LocalVariableTableAttribute

    CodeAttribute codeAttrA = attrA.getCode();
    CodeAttribute codeAttrB = attrB.getCode();

    LineNumberTableAttribute lnAttrA = null;
    LineNumberTableAttribute lnAttrB = null;
    LocalVariableTableAttribute lvsA = null;
    LocalVariableTableAttribute lvsB = null;
    if (codeAttrA != null && codeAttrB != null) {
      // TODO: deal with the case where only one is null
      // ie, one method has code, the other doesn't
     
      if (codeAttrA.getAttributes() != null) {
View Full Code Here

Examples of net.sf.rej.java.attribute.LocalVariableTableAttribute

          ic.setCodeAttribute(ca);
          if (ca != null) {
            processAttributes(ic, ca.getAttributes(), agent);
          }
          // method variables
          LocalVariableTableAttribute lvt = null;
          if (ca != null) {
            lvt = ca.getAttributes().getLocalVariableTable();
          }
          if (lvt != null) {
            List<LocalVariable> lvs = lvt.getLocalVariables();

            for (LocalVariable lv : lvs) {
              agent.processLocalVariable(ic, lv);
            }
          }
View Full Code Here

Examples of net.sf.rej.java.attribute.LocalVariableTableAttribute

  }

  @Override
  public void processAttribute(IterationContext ic, Attribute attr) {
    if (attr instanceof LocalVariableTableAttribute) {
      LocalVariableTableAttribute lvAttr = (LocalVariableTableAttribute) attr;
      Attributes attrs = ic.getCodeAttribute().getAttributes();
      Undoable u = new RemoveAttributeAction(attrs, lvAttr);
      if (this.batchMode) {
        u.execute();
      } else {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.