congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
BuilderExceptionHandler.getHandlerCodeAddress
Code IndexAdd Tabnine to your IDE (free)

How to use
getHandlerCodeAddress
method
in
org.jf.dexlib2.builder.BuilderExceptionHandler

Best Java code snippets using org.jf.dexlib2.builder.BuilderExceptionHandler.getHandlerCodeAddress (Showing top 4 results out of 315)

origin: CalebFenton/simplify

private static BuilderExceptionHandler buildHandler(int codeAddress, VirtualClass exceptionType) {
  BuilderExceptionHandler handler = mock(BuilderExceptionHandler.class);
  String name = exceptionType.getName();
  when(handler.getExceptionType()).thenReturn(name);
  when(handler.getHandlerCodeAddress()).thenReturn(codeAddress);
  return handler;
}
origin: CalebFenton/simplify

private static Set<Integer> getExceptionHandlerAddresses(ExecutionGraphManipulator manipulator) {
  int[] allAddresses = manipulator.getAddresses();
  Arrays.sort(allAddresses);
  int highestAddress = allAddresses[allAddresses.length - 1];
  Set<Integer> handlerAddresses = new HashSet<>();
  List<BuilderTryBlock> tryBlocks = manipulator.getTryBlocks();
  for (BuilderTryBlock tryBlock : tryBlocks) {
    List<? extends BuilderExceptionHandler> handlers = tryBlock.getExceptionHandlers();
    for (BuilderExceptionHandler handler : handlers) {
      int address = handler.getHandlerCodeAddress();
      BuilderInstruction instruction = manipulator.getInstruction(address);
      while (address < highestAddress) {
        // Add all instructions until return, goto, etc.
        handlerAddresses.add(address);
        address += instruction.getCodeUnits();
        instruction = manipulator.getInstruction(address);
        if (!instruction.getOpcode().canContinue()) {
          break;
        }
      }
    }
  }
  return handlerAddresses;
}
origin: testwhat/SmaliEx

@Test
public void testNewLabelByAddress() {
  MethodImplementationBuilder builder = new MethodImplementationBuilder(10);
  builder.addInstruction(new BuilderInstruction10x(Opcode.NOP));
  builder.addInstruction(new BuilderInstruction10x(Opcode.NOP));
  builder.addInstruction(new BuilderInstruction10x(Opcode.NOP));
  builder.addInstruction(new BuilderInstruction10x(Opcode.NOP));
  builder.addInstruction(new BuilderInstruction10x(Opcode.NOP));
  builder.addInstruction(new BuilderInstruction32x(Opcode.MOVE_16, 0, 0));
  MutableMethodImplementation mutableMethodImplementation =
      new MutableMethodImplementation(builder.getMethodImplementation());
  mutableMethodImplementation.addCatch(
      mutableMethodImplementation.newLabelForAddress(0),
      mutableMethodImplementation.newLabelForAddress(8),
      mutableMethodImplementation.newLabelForAddress(1));
  Assert.assertEquals(0, mutableMethodImplementation.getTryBlocks().get(0).getStartCodeAddress());
  Assert.assertEquals(8, mutableMethodImplementation.getTryBlocks().get(0).getCodeUnitCount());
  Assert.assertEquals(1, mutableMethodImplementation.getTryBlocks().get(0).getExceptionHandlers().get(0)
      .getHandlerCodeAddress());
}
origin: testwhat/SmaliEx

  @Test
  public void testNewLabelByIndex() {
    MethodImplementationBuilder builder = new MethodImplementationBuilder(10);

    builder.addInstruction(new BuilderInstruction10x(Opcode.NOP));
    builder.addInstruction(new BuilderInstruction10x(Opcode.NOP));
    builder.addInstruction(new BuilderInstruction10x(Opcode.NOP));
    builder.addInstruction(new BuilderInstruction10x(Opcode.NOP));
    builder.addInstruction(new BuilderInstruction10x(Opcode.NOP));
    builder.addInstruction(new BuilderInstruction32x(Opcode.MOVE_16, 0, 0));

    MutableMethodImplementation mutableMethodImplementation =
        new MutableMethodImplementation(builder.getMethodImplementation());

    mutableMethodImplementation.addCatch(
        mutableMethodImplementation.newLabelForIndex(0),
        mutableMethodImplementation.newLabelForIndex(6),
        mutableMethodImplementation.newLabelForIndex(1));

    Assert.assertEquals(0, mutableMethodImplementation.getTryBlocks().get(0).getStartCodeAddress());
    Assert.assertEquals(8, mutableMethodImplementation.getTryBlocks().get(0).getCodeUnitCount());
    Assert.assertEquals(1, mutableMethodImplementation.getTryBlocks().get(0).getExceptionHandlers().get(0)
        .getHandlerCodeAddress());
  }
}
org.jf.dexlib2.builderBuilderExceptionHandlergetHandlerCodeAddress

Popular methods of BuilderExceptionHandler

  • <init>
  • newExceptionHandler
  • getExceptionType

Popular in Java

  • Reactive rest calls using spring rest template
  • runOnUiThread (Activity)
  • getSharedPreferences (Context)
  • getSupportFragmentManager (FragmentActivity)
  • Socket (java.net)
    Provides a client-side TCP socket.
  • Path (java.nio.file)
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now