Package com.android.dx.dex.code

Examples of com.android.dx.dex.code.CatchHandlerList


      return;
    }
    for (int i= 0; i < catchTable.size(); ++i)
    {
      Entry entry= catchTable.get(i);
      CatchHandlerList catchHandlers= entry.getHandlers();
      for (int j= 0; j < catchHandlers.size(); ++j)
      {
        // TODO: Do we need these? Shouldn't they be handled by code, if
        // accessed?
        // dependencies.add(catchHandlers.get(j).getExceptionType().toHuman());
      }
View Full Code Here


            out.writeUnsignedLeb128(handlerOffsets.size());
       
        // Now write the lists out in order, noting the offset of each.
        for (Map.Entry<CatchHandlerList, Integer> mapping :
                 handlerOffsets.entrySet()) {
            CatchHandlerList list = mapping.getKey();
            int listSize = list.size();
            boolean catchesAll = list.catchesAll();

            // Set the offset before we do any writing.
            mapping.setValue(out.getCursor());

            if (catchesAll) {
                // A size <= 0 means that the list ends with a catch-all.
                out.writeSignedLeb128(-(listSize - 1));
                listSize--;
            } else {
                out.writeSignedLeb128(listSize);
            }

            for (int i = 0; i < listSize; i++) {
                CatchHandlerList.Entry entry = list.get(i);
                out.writeUnsignedLeb128(
                        typeIds.indexOf(entry.getExceptionType()));
                out.writeUnsignedLeb128(entry.getHandler());
            }

            if (catchesAll) {
                out.writeUnsignedLeb128(list.get(listSize).getHandler());
            }
        }

        encodedHandlers = out.toByteArray();
    }
View Full Code Here

            printTo.println(prefix + "tries:");
        }

        for (int i = 0; i < size; i++) {
            CatchTable.Entry entry = table.get(i);
            CatchHandlerList handlers = entry.getHandlers();
            String s1 = subPrefix + "try " + Hex.u2or4(entry.getStart())
                + ".." + Hex.u2or4(entry.getEnd());
            String s2 = handlers.toHuman(subPrefix, "");

            if (consume) {
                annotateTo.annotate(amt1, s1);
                annotateTo.annotate(amt2, s2);
            } else {
                printTo.println(s1);
                printTo.println(s2);
            }
        }

        if (! consume) {
            // Only emit the handler lists if we are consuming bytes.
            return;
        }

        annotateTo.annotate(0, prefix + "handlers:");
        annotateTo.annotate(encodedHandlerHeaderSize,
                subPrefix + "size: " + Hex.u2(handlerOffsets.size()));

        int lastOffset = 0;
        CatchHandlerList lastList = null;
       
        for (Map.Entry<CatchHandlerList, Integer> mapping :
                 handlerOffsets.entrySet()) {
            CatchHandlerList list = mapping.getKey();
            int offset = mapping.getValue();

            if (lastList != null) {
                annotateAndConsumeHandlers(lastList, lastOffset,
                        offset - lastOffset, subPrefix, printTo, annotateTo);
View Full Code Here

      Entry entry= catchTable.get(i);
      Element entryElement= new Element("entry", NS_DEX);
      entryElement.setAttribute("start", String.valueOf(entry.getStart()));
      entryElement.setAttribute("end", String.valueOf(entry.getEnd()));

      CatchHandlerList catchHandlers= entry.getHandlers();
      for (int j= 0; j < catchHandlers.size(); ++j)
      {
        com.android.dx.dex.code.CatchHandlerList.Entry handlerEntry= catchHandlers.get(j);
        String exceptionType= handlerEntry.getExceptionType().toHuman();

        // We can remove the exception because a red type exception
        // will never be created or thrown.
        // This change is in sync with the one in processMethod.
View Full Code Here

      tryCatchElement.addContent(tryElement);
      tryElements.add(tryElement);

      // For each handler create a catch element as the child of the
      // try-catch element.
      CatchHandlerList handlers= catches.get(i).getHandlers();
      for (int j= 0; j < handlers.size(); ++j)
      {
        String exceptionType= handlers.get(j).getExceptionType().toHuman();

        // We can remove the exception because a red type exception
        // will never be created or thrown.
        // This change is in sync with the one in processCatchTable
        if (!isRedType(exceptionType))
        {
          Element catchElement= new Element("catch", NS_DEX);
          catchElement.setAttribute("exception-type", exceptionType);
          catchElement.setAttribute("target", String.valueOf(handlers.get(j).getHandler()));
          tryCatchElement.addContent(catchElement);
        }
      }
      tryCatchElements.put(catches.get(i).getStart(), tryCatchElement);
    }
View Full Code Here

    // Then, add all catch-handler targets. We need this info, so using
    // Map.put will potentially override an existing target, so the
    // information about a potential catch-handler target is not lost.
    for (int i= 0; i < catches.size(); ++i)
    {
      CatchHandlerList handlers= catches.get(i).getHandlers();
      for (int j= 0; j < handlers.size(); ++j)
      {
        int handlerAddress= handlers.get(j).getHandler();
        targets.put(handlerAddress, new Target(handlerAddress, true));
      }
    }

    return targets;
View Full Code Here

TOP

Related Classes of com.android.dx.dex.code.CatchHandlerList

Copyright © 2018 www.massapicom. 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.