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
compareHandlers
booleancompareHandlers(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
protectBlock
booleanprotectBlock(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 (-1 means untyped, i.e., all types)
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
newHandler - new handler (or null to remove the handler)
Returns:
true if the handler was replaced or removed
moveProtectedBlock
booleanmoveProtectedBlock(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)
copyProtectedBlock
booleancopyProtectedBlock(int srcBlkOffset,
int dstBlkOffset)
Copy the protection information of a block to another block.
Parameters:
srcBlkOffset - source block, whose protection information will be copied over to the
destination block
dstBlkOffset - destination block, to be protected (if it was protected, the original
protection information will be overwritten)
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)
addProtectionFromBlock
booleanaddProtectionFromBlock(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)
unprotectBlock
booleanunprotectBlock(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
unprotectBlock
booleanunprotectBlock(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)
unprotectBlock
booleanunprotectBlock(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)
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
updateHandlerAddress
booleanupdateHandlerAddress(int handlerAddress,
int newAddress)
Update the address of a handler.
Parameters:
handlerAddress -
newAddress -
Returns:
true if the handler was found and updated; false if no handler was found at that
address