public interface

IDTryData

com.pnfsoftware.jeb.core.units.code.android.ir.IDTryData

Class Overview

dexdec exception handling information, optionally provided by an IR method context.

Summary

Public Methods
abstract boolean addProtectionFromBlock(int srcBlkOffset, int dstBlkOffset)
Append the protection of the source block on to the destination block.
abstract boolean compareHandlers(int blkOffset1, int blkOffset2)
Compare the protection information of two blocks.
abstract IDTryData copy()
Perform a deep-copy this object.
abstract boolean copyProtectedBlock(int srcBlkOffset, int dstBlkOffset)
Copy the protection information of a block to another block.
abstract boolean copyProtectionFromBlock(int blkOffset, int srcBlkOffset)
This method is deprecated. use copyProtectedBlock(int, int) instead, however be careful with the parameter order, which has been switched: source block first, destination block second
abstract List<IDExceptionHandler> getBlockHandlers(int blkOffset)
Retrieve the handlers protecting the provided block.
abstract Set<Integer> getHandledExceptionTypesAt(int handlerOffset)
Retrieve all the exception types handled by the provided handler.
abstract List<IDExceptionHandler> getHandlersForBlock(int blkOffset)
This method is deprecated. use getBlockHandlers(int) instead
abstract List<Integer> getProtectedBlocks()
Retrieve a copy of the list of protected blocks.
abstract boolean hasProtectedBlocks()
Determine whether this object carries some protection information.
abstract boolean isEmpty()
Determine whether this object carries some protection information.
abstract boolean isProtectedBlock(int blkOffset)
Determine whether a block is protected.
abstract boolean moveProtectedBlock(int srcBlkOffset, int dstBlkOffset)
Move the protection information of a block to another block.
abstract boolean protectBlock(int blkOffset, int exTypeIndex, int handlerOffset, int position)
Add a handler to the list of exception handlers protecting the provided block.
abstract void setBlockHandlers(int blkOffset, Collection<IDExceptionHandler> handlers)
Set the handlers for the provided block.
abstract boolean unprotectBlock(int blkOffset, int handlerOffset, int exTypeIndex)
Remove a specific specific protection for a block.
abstract boolean unprotectBlock(int blkOffset, int handlerOffset)
Remove a specific protection for a block.
abstract boolean unprotectBlock(int blkOffset)
Unprotect a block.
abstract void updateOffsets(Map<Integer, Integer> oldToNewOffsets)
This method is deprecated. use updateTargets(Map) or updateTargets(Map, boolean) instead
abstract int updateTargets(Map<Integer, Integer> oldToNewOffsets)
Update the targets of this object.
abstract int updateTargets(Map<Integer, Integer> oldToNewOffsets, boolean failOnMissedEntry)
Update the targets of this object.

Public Methods

public abstract boolean addProtectionFromBlock (int srcBlkOffset, int dstBlkOffset)

Append the protection of the source block on to the destination block.

Parameters
srcBlkOffset source block
dstBlkOffset destination block
Returns
  • true if some protection information was appended; false if the source block was not protected (false does not indicate a failure, but simply that the source block was not in any try-block)

public abstract boolean compareHandlers (int blkOffset1, int blkOffset2)

Compare the protection information of two blocks.

Parameters
blkOffset1 a block
blkOffset2 another block
Returns
  • true if the blocks are protected in the exact same way (same handlers, same order, etc.), false otherwise

public abstract IDTryData copy ()

Perform a deep-copy this object.

Returns
  • a copy of this object

public abstract boolean copyProtectedBlock (int srcBlkOffset, int dstBlkOffset)

Copy the protection information of a block to another block.

Parameters
srcBlkOffset source block
dstBlkOffset destination block
Returns
  • true if some protection information was copied over; false if the source block was not protected (false does not indicate a failure, but simply that the source block was not in any try-block)

public abstract boolean copyProtectionFromBlock (int blkOffset, int srcBlkOffset)

This method is deprecated.
use copyProtectedBlock(int, int) instead, however be careful with the parameter order, which has been switched: source block first, destination block second

Copy the protection information (exception handlers) of a block to another block.

Parameters
blkOffset block to be protected (if it was protected, the original protection information will be overwritten)
srcBlkOffset source block, whose protection information will be copied over to the source block
Returns
  • true if some protection information was copied over; false if the source block was not protected (false does not indicate a failure, but simply that the source block was not in any try-block)

public abstract List<IDExceptionHandler> getBlockHandlers (int blkOffset)

Retrieve the handlers protecting the provided block.

Parameters
blkOffset block
Returns
  • the list of handlers protecting the provided block

public abstract Set<Integer> getHandledExceptionTypesAt (int handlerOffset)

Retrieve all the exception types handled by the provided handler.

Parameters
handlerOffset offset of the handler block (an entry-point block when an exception is caught)
Returns
  • a set of exception type indices; the special value -1 denotes the lowest-level throwable type (java.lang.Throwable)

public abstract List<IDExceptionHandler> getHandlersForBlock (int blkOffset)

This method is deprecated.
use getBlockHandlers(int) instead

public abstract List<Integer> getProtectedBlocks ()

Retrieve a copy of the list of protected blocks.

Returns
  • a copy of the list of block offsets, possibly empty

public abstract boolean hasProtectedBlocks ()

Determine whether this object carries some protection information. The reverse of isEmpty().

Returns
  • true if at least one block is protected

public abstract boolean isEmpty ()

Determine whether this object carries some protection information. The reverse of hasProtectedBlocks().

Returns
  • true if not a single block is protected

public abstract boolean isProtectedBlock (int blkOffset)

Determine whether a block is protected.

Parameters
blkOffset block
Returns
  • true if the block is protected (by at least one handler)

public abstract boolean moveProtectedBlock (int srcBlkOffset, int dstBlkOffset)

Move the protection information of a block to another block. The source block will be left unprotected. The destination block will be protected as the source block was.

Parameters
srcBlkOffset source block
dstBlkOffset destination
Returns
  • true if some protection information was copied over; false if the source block was not protected (false does not indicate a failure, but simply that the source block was not in any try-block)

public abstract boolean protectBlock (int blkOffset, int exTypeIndex, int handlerOffset, int position)

Add a handler to the list of exception handlers protecting the provided block. If no handler protects the block, a new list is created.

Parameters
blkOffset block
exTypeIndex exception type index
handlerOffset offset of the handler entry-point
position insertion index (negative value is allowed, e.g. -1 means append)
Returns
  • true if the handler was created; false if a previous handler (before the insertion point) for the same type was found in the list of handlers for the block

public abstract void setBlockHandlers (int blkOffset, Collection<IDExceptionHandler> handlers)

Set the handlers for the provided block. The list of provided handlers will be copied.

Parameters
blkOffset block
handlers a list of handlers; empty to unprotect the block

public abstract boolean unprotectBlock (int blkOffset, int handlerOffset, int exTypeIndex)

Remove a specific specific protection for a block.

Parameters
blkOffset block
handlerOffset offset of the handler
exTypeIndex expected handled exception type
Returns
  • true if the handler was removed; false otherwise (no change)

public abstract boolean unprotectBlock (int blkOffset, int handlerOffset)

Remove a specific protection for a block. All handling leading to the provided handler offset will be removed.

Parameters
blkOffset block
handlerOffset offset of the handler
Returns
  • true if some changes took place; false otherwise (no change)

public abstract boolean unprotectBlock (int blkOffset)

Unprotect a block.

Parameters
blkOffset block
Returns
  • true if the block was protected and is now unprotected; false means the block was not protected

public abstract void updateOffsets (Map<Integer, Integer> oldToNewOffsets)

This method is deprecated.
use updateTargets(Map) or updateTargets(Map, boolean) instead

public abstract int updateTargets (Map<Integer, Integer> oldToNewOffsets)

Update the targets of this object. All block offsets (protected blocks, handler blocks) will be updated.

Parameters
oldToNewOffsets a map of old block offsets to new block offsets
Returns
  • the number of updated targets

public abstract int updateTargets (Map<Integer, Integer> oldToNewOffsets, boolean failOnMissedEntry)

Update the targets of this object. All block offsets (protected blocks, handler blocks) will be updated.

Parameters
oldToNewOffsets a map of old block offsets to new block offsets
failOnMissedEntry if true, the method will raise if a (current) branch target cannot be mapped to a new target (i.e., if there is no entry for a branch target in the map)
Returns
  • the number of updated targets