IDA SDK
Modules | Classes | Typedefs | Enumerations | Functions

Detailed Description

Work with debugger breakpoints.

Modules

 Breakpoint status codes
 Return values for check_bpt()
 
 Breakpoint visitor flags
 Passed as 'bvflags' parameter to bpt_visitor_t::_for_all_bpts()
 

Classes

struct  bpt_location_t
 Describes a breakpoint location. More...
 
struct  bpt_t
 Characteristics of a breakpoint. More...
 
struct  movbpt_info_t
 
struct  bpt_visitor_t
 Visit all breakpoints. More...
 

Typedefs

typedef qvector< bpt_tbpt_vec_t
 vector of breakpoints
 
typedef qvector< movbpt_code_t > movbpt_codes_t
 
typedef qvector< movbpt_info_tmovbpt_infos_t
 

Enumerations

enum  bpt_loctype_t { BPLT_ABS, BPLT_REL, BPLT_SYM, BPLT_SRC }
 Breakpoint location types. More...
 
enum  movbpt_code_t { MOVBPT_OK, MOVBPT_NOT_FOUND, MOVBPT_DEST_BUSY, MOVBPT_BAD_TYPE }
 

Functions

int idaapi set_bptloc_string (const char *s)
 Helper function for bpt_location_t.
 
const char *idaapi get_bptloc_string (int i)
 Helper function for bpt_location_t. More...
 
int idaapi get_bpt_qty (void)
 Get number of breakpoints. More...
 
bool idaapi getn_bpt (int n, bpt_t *bpt)
 Get the characteristics of a breakpoint. More...
 
bool idaapi get_bpt (ea_t ea, bpt_t *bpt)
 Get the characteristics of a breakpoint. More...
 
bool exist_bpt (ea_t ea)
 Does a breakpoint exist at the given location?
 
bool idaapi add_bpt (ea_t ea, asize_t size=0, bpttype_t type=BPT_DEFAULT)
 Add a new breakpoint in the debugged process. More...
 
bool idaapi request_add_bpt (ea_t ea, asize_t size=0, bpttype_t type=BPT_DEFAULT)
 Post an add_bpt(ea_t, asize_t, bpttype_t) request.
 
bool idaapi add_bpt (const bpt_t &bpt)
 Add a new breakpoint in the debugged process. More...
 
bool idaapi request_add_bpt (const bpt_t &bpt)
 Post an add_bpt(const bpt_t &) request.
 
bool idaapi del_bpt (ea_t ea)
 Delete an existing breakpoint in the debugged process. More...
 
bool idaapi request_del_bpt (ea_t ea)
 Post a del_bpt(ea_t) request.
 
bool idaapi del_bpt (const bpt_location_t &bptloc)
 Delete an existing breakpoint in the debugged process. More...
 
bool idaapi request_del_bpt (const bpt_location_t &bptloc)
 Post a del_bpt(const bpt_location_t &) request.
 
bool idaapi update_bpt (const bpt_t *bpt)
 Update modifiable characteristics of an existing breakpoint. More...
 
bool idaapi find_bpt (const bpt_location_t &bptloc, bpt_t *bpt)
 Find a breakpoint by location. More...
 
int idaapi change_bptlocs (const movbpt_infos_t &movinfo, movbpt_codes_t *codes=NULL, bool del_hindering_bpts=true)
 Move breakpoint(s) from one location to another. More...
 
int idaapi check_bpt (ea_t ea)
 Check the breakpoint at the specified address. More...
 

enable/disable breakpoints

TypeSynchronous function - available as request
Notificationnone (synchronous function)

Enable or disable an existing breakpoint. A disabled breakpoint isn't available anymore in the process.

bool idaapi enable_bpt (ea_t ea, bool enable=true)
 
bool idaapi enable_bpt (const bpt_location_t &bptloc, bool enable=true)
 
bool disable_bpt (ea_t ea)
 
bool disable_bpt (const bpt_location_t &bptloc)
 
bool idaapi request_enable_bpt (ea_t ea, bool enable=true)
 
bool idaapi request_enable_bpt (const bpt_location_t &bptloc, bool enable=true)
 
bool request_disable_bpt (ea_t ea)
 
bool request_disable_bpt (const bpt_location_t &bptloc)
 

Enumeration Type Documentation

Breakpoint location types.

Enumerator
BPLT_ABS 

absolute address: ea

BPLT_REL 

relative address: module_path, offset

BPLT_SYM 

symbolic: symbol_name, offset

BPLT_SRC 

source level: filename, lineno

Function Documentation

const char *idaapi get_bptloc_string ( int  i)
inline

Helper function for bpt_location_t.

int idaapi get_bpt_qty ( void  )
inline

Get number of breakpoints.

TypeSynchronous function
Notificationnone (synchronous function)
bool idaapi getn_bpt ( int  n,
bpt_t bpt 
)
inline

Get the characteristics of a breakpoint.

TypeSynchronous function
Notificationnone (synchronous function)
Parameters
nnumber of breakpoint, is in range 0..get_bpt_qty()-1
[out]bptfilled with the characteristics.
Returns
false if no breakpoint exists
bool idaapi get_bpt ( ea_t  ea,
bpt_t bpt 
)
inline

Get the characteristics of a breakpoint.

TypeSynchronous function
Notificationnone (synchronous function)
Parameters
eaany address in the breakpoint range
[out]bptif not NULL, is filled with the characteristics.
Returns
false if no breakpoint exists
bool idaapi add_bpt ( ea_t  ea,
asize_t  size = 0,
bpttype_t  type = BPT_DEFAULT 
)
inline

Add a new breakpoint in the debugged process.

TypeSynchronous function - available as request
Notificationnone (synchronous function)
Note
Only one breakpoint can exist at a given address.
Parameters
eaany address in the process memory space. Depending on the architecture, hardware breakpoints always be setup at random address. For example, on x86, hardware breakpoints should be aligned depending on their size. Moreover, on the x86 architecture, it is impossible to setup more than 4 hardware breakpoints.
sizesize of the breakpoint (irrelevant for software breakpoints): As for the address, hardware breakpoints can't always be setup with random size.
typetype of the breakpoint (BPT_SOFT for software breakpoint) special case BPT_DEFAULT (BPT_SOFT|BPT_EXEC): try to add instruction breakpoint of the appropriate type as follows: software bpt if supported, hwbpt otherwise
bool idaapi add_bpt ( const bpt_t bpt)
inline

Add a new breakpoint in the debugged process.

TypeSynchronous function - available as request
Notificationnone (synchronous function)
Parameters
bptBreakpoint to add. It describes the break condition, type, flags, location (module relative, source breakpoint or absolute) and other attributes.
bool idaapi del_bpt ( ea_t  ea)
inline

Delete an existing breakpoint in the debugged process.

TypeSynchronous function - available as request
Notificationnone (synchronous function)
Parameters
eaany address in the breakpoint range
bool idaapi del_bpt ( const bpt_location_t bptloc)
inline

Delete an existing breakpoint in the debugged process.

TypeSynchronous function - available as request
Notificationnone (synchronous function)
Parameters
bptlocBreakpoint location
bool idaapi update_bpt ( const bpt_t bpt)
inline

Update modifiable characteristics of an existing breakpoint.

To update the breakpoint location, use change_bptlocs()

TypeSynchronous function
Notificationnone (synchronous function)
Note
Only the following fields can be modified:
Changing some properties will require removing and then re-adding the breakpoint to the process memory (or the debugger backend), which can lead to race conditions (i.e., breakpoint(s) can be missed) in case the process is not suspended. Here are a list of scenarios that will require the breakpoint to be removed & then re-added:
bool idaapi find_bpt ( const bpt_location_t bptloc,
bpt_t bpt 
)
inline

Find a breakpoint by location.

TypeSynchronous function - available as request
Notificationnone (synchronous function)
Parameters
bptlocBreakpoint location
bptbpt is filled if the breakpoint was found
int idaapi change_bptlocs ( const movbpt_infos_t movinfo,
movbpt_codes_t codes = NULL,
bool  del_hindering_bpts = true 
)
inline

Move breakpoint(s) from one location to another.

Parameters
movinfowhat bpts to move and where to
codesvector of return codes, if detailed error info is required
del_hindering_bptsshould delete hindering breakpoints?
Returns
number of moved bpts
int idaapi check_bpt ( ea_t  ea)
inline

Check the breakpoint at the specified address.

Returns
one of Breakpoint status codes