ida_tryblks

Architecture independent exception handling info.

Try blocks have the following general properties: * A try block specifies a possibly fragmented guarded code region. * Each try block has always at least one catch/except block description * Each catch block contains its boundaries and a filter. * Additionally a catch block can hold sp adjustment and the offset to the exception object offset (C++). * Try blocks can be nested. Nesting is automatically calculated at the retrieval time. * There may be (nested) multiple try blocks starting at the same address.

See examples in tests/input/src/eh_tests.

Attributes

SWIG_PYTHON_LEGACY_BOOL

TBERR_OK

ok

TBERR_START

bad start address

TBERR_END

bad end address

TBERR_ORDER

bad address order

TBERR_EMPTY

empty try block

TBERR_KIND

illegal try block kind

TBERR_NO_CATCHES

no catch blocks at all

TBERR_INTERSECT

range would intersect inner tryblk

TBEA_TRY

is EA within a c++ try block?

TBEA_CATCH

is EA the start of a c++ catch/cleanup block?

TBEA_SEHTRY

is EA within a seh try block

TBEA_SEHLPAD

is EA the start of a seh finally/except block?

TBEA_SEHFILT

is EA the start of a seh filter?

TBEA_ANY

TBEA_FALLTHRU

is there a fall through into provided ea from an unwind region

Classes

tryblks_t

catchvec_t

try_handler_t

seh_t

catch_t

tryblk_t

Functions

get_tryblks(→ size_t)

------------------------------------------------------------------------- Retrieve try block information from the specified address range. Try blocks are sorted by starting address and their nest levels calculated.

del_tryblks(→ None)

Delete try block information in the specified range.

add_tryblk(→ int)

Add one try block information.

find_syseh(→ ida_idaapi.ea_t)

Find the start address of the system eh region including the argument.

is_ea_tryblks(→ bool)

Check if the given address ea is part of tryblks description.

Module Contents

ida_tryblks.SWIG_PYTHON_LEGACY_BOOL
class ida_tryblks.tryblks_t(*args)

Bases: object

thisown
push_back(*args) tryblk_t &
pop_back() None
size() size_t
empty() bool
at(_idx: size_t) tryblk_t const &
qclear() None
clear() None
resize(*args) None
grow(*args) None
capacity() size_t
reserve(cnt: size_t) None
truncate() None
swap(r: tryblks_t) None
extract() tryblk_t *
inject(s: tryblk_t, len: size_t) None
begin(*args) qvector< tryblk_t >::const_iterator
end(*args) qvector< tryblk_t >::const_iterator
insert(it: tryblk_t, x: tryblk_t) qvector< tryblk_t >::iterator
erase(*args) qvector< tryblk_t >::iterator
find(*args) qvector< tryblk_t >::const_iterator
has(x: tryblk_t) bool
add_unique(x: tryblk_t) bool
append(x: tryblk_t) None
extend(x: tryblks_t) None
front
back
class ida_tryblks.catchvec_t(*args)

Bases: object

thisown
push_back(*args) catch_t &
pop_back() None
size() size_t
empty() bool
at(_idx: size_t) catch_t const &
qclear() None
clear() None
resize(*args) None
grow(*args) None
capacity() size_t
reserve(cnt: size_t) None
truncate() None
swap(r: catchvec_t) None
extract() catch_t *
inject(s: catch_t, len: size_t) None
begin(*args) qvector< catch_t >::const_iterator
end(*args) qvector< catch_t >::const_iterator
insert(it: catch_t, x: catch_t) qvector< catch_t >::iterator
erase(*args) qvector< catch_t >::iterator
find(*args) qvector< catch_t >::const_iterator
has(x: catch_t) bool
add_unique(x: catch_t) bool
append(x: catch_t) None
extend(x: catchvec_t) None
front
back
class ida_tryblks.try_handler_t

Bases: ida_range.rangevec_t

thisown
disp: int
fpreg: int
clear() None
class ida_tryblks.seh_t

Bases: try_handler_t

thisown
filter: rangevec_t
seh_code: ida_idaapi.ea_t
clear() None
class ida_tryblks.catch_t

Bases: try_handler_t

thisown
obj: int
type_id: int
class ida_tryblks.tryblk_t(*args)

Bases: ida_range.rangevec_t

thisown
level: uchar
cpp() catchvec_t &
seh() seh_t &
get_kind() uchar
empty() bool
is_seh() bool
is_cpp() bool
clear() None
set_seh() seh_t &
set_cpp() catchvec_t &
ida_tryblks.get_tryblks(tbv: tryblks_t, range: range_t) size_t

————————————————————————- Retrieve try block information from the specified address range. Try blocks are sorted by starting address and their nest levels calculated.

Parameters:
  • tbv – output buffer; may be nullptr

  • range – address range to change

Returns:

number of found try blocks

ida_tryblks.del_tryblks(range: range_t) None

Delete try block information in the specified range.

Parameters:

range – the range to be cleared

ida_tryblks.add_tryblk(tb: tryblk_t) int

Add one try block information.

Parameters:

tb – try block to add.

Returns:

error code; 0 means good

ida_tryblks.TBERR_OK

ok

ida_tryblks.TBERR_START

bad start address

ida_tryblks.TBERR_END

bad end address

ida_tryblks.TBERR_ORDER

bad address order

ida_tryblks.TBERR_EMPTY

empty try block

ida_tryblks.TBERR_KIND

illegal try block kind

ida_tryblks.TBERR_NO_CATCHES

no catch blocks at all

ida_tryblks.TBERR_INTERSECT

range would intersect inner tryblk

ida_tryblks.find_syseh(ea: ida_idaapi.ea_t) ida_idaapi.ea_t

Find the start address of the system eh region including the argument.

Parameters:

ea – search address

Returns:

start address of surrounding tryblk, otherwise BADADDR

ida_tryblks.TBEA_TRY

is EA within a c++ try block?

ida_tryblks.TBEA_CATCH

is EA the start of a c++ catch/cleanup block?

ida_tryblks.TBEA_SEHTRY

is EA within a seh try block

ida_tryblks.TBEA_SEHLPAD

is EA the start of a seh finally/except block?

ida_tryblks.TBEA_SEHFILT

is EA the start of a seh filter?

ida_tryblks.TBEA_ANY
ida_tryblks.TBEA_FALLTHRU

is there a fall through into provided ea from an unwind region

ida_tryblks.is_ea_tryblks(ea: ida_idaapi.ea_t, flags: int) bool

Check if the given address ea is part of tryblks description.

Parameters:
  • ea – address to check

  • flags – combination of flags for is_ea_tryblks()