| IDA SDK

Modules | Classes | Typedefs | Enumerations | Functions
Breakpoints
Debugger 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 | bptaddrs_t
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< movbpt_info_t > | movbpt_infos_t
typedef qvector< const bpt_t * > | bpt_constptr_vec_t
typedef qvector< bpt_t * > | bptptr_vec_t
typedef qvector< bpt_t > | bpt_vec_t
| vector of breakpoints
typedef qvector< movbpt_code_t > | movbpt_codes_t
typedef qvector< bptaddrs_t > | bpteas_t

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

## Functions
int idaapi | set_bptloc_string (const char *s)
const char *idaapi | get_bptloc_string (int i)
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=nullptr, 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
Type | Synchronous function - available as request
Notification | none (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

## ◆ movbpt_code_t

enum movbpt_code_t

Enumerator
MOVBPT_OK | moved ok
MOVBPT_NOT_FOUND | source bpt not found
MOVBPT_DEST_BUSY | destination location is busy (we already have such a bpt)
MOVBPT_BAD_TYPE | BPLT_ABS is not supported.

## ◆ bpt_loctype_t

enum bpt_loctype_t

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

## ◆ get_bpt_qty()

int idaapi get_bpt_qty | ( | void |  | ) |
| inline

Get number of breakpoints.

Type | Synchronous function
Notification | none (synchronous function)

## ◆ getn_bpt()

bool idaapi getn_bpt | ( | int | n,
|  | bpt_t * | bpt
| ) |  |
| inline

Get the characteristics of a breakpoint.

Type | Synchronous function
Notification | none (synchronous function)

Parameters

  | n | number of breakpoint, is in range 0..get_bpt_qty()-1
  [out] | bpt | filled with the characteristics.

Returns
  false if no breakpoint exists

## ◆ get_bpt()

bool idaapi get_bpt | ( | ea_t | ea,
|  | bpt_t * | bpt
| ) |  |
| inline

Get the characteristics of a breakpoint.

Type | Synchronous function
Notification | none (synchronous function)

Parameters

  | ea | any address in the breakpoint range
  [out] | bpt | if not nullptr, is filled with the characteristics.

Returns
  false if no breakpoint exists

## ◆ add_bpt() [1/2]

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.

Type | Synchronous function - available as request
Notification | none (synchronous function)

Note
  Only one breakpoint can exist at a given address.

Parameters

  ea | any 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.
  size | size of the breakpoint (irrelevant for software breakpoints): As for the address, hardware breakpoints can't always be setup with random size.
  type | type 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

## ◆ add_bpt() [2/2]

bool idaapi add_bpt | ( | const bpt_t & | bpt | ) |
| inline

Add a new breakpoint in the debugged process.

Type | Synchronous function - available as request
Notification | none (synchronous function)

Parameters

  bpt | Breakpoint to add. It describes the break condition, type, flags, location (module relative, source breakpoint or absolute) and other attributes.

## ◆ del_bpt() [1/2]

bool idaapi del_bpt | ( | ea_t | ea | ) |
| inline

Delete an existing breakpoint in the debugged process.

Type | Synchronous function - available as request
Notification | none (synchronous function)

Parameters

  ea | any address in the breakpoint range

## ◆ del_bpt() [2/2]

bool idaapi del_bpt | ( | const bpt_location_t & | bptloc | ) |
| inline

Delete an existing breakpoint in the debugged process.

Type | Synchronous function - available as request
Notification | none (synchronous function)

Parameters

  bptloc | Breakpoint location

## ◆ update_bpt()

bool idaapi update_bpt | ( | const bpt_t * | bpt | ) |
| inline

Update modifiable characteristics of an existing breakpoint.

To update the breakpoint location, use change_bptlocs()

Type | Synchronous function
Notification | none (synchronous function)

Note
  Only the following fields can be modified:
  - bpt_t::cndbody
  - bpt_t::pass_count
  - bpt_t::flags
  - bpt_t::size
  - bpt_t::type
  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:
  - bpt_t::size is modified
  - bpt_t::type is modified
  - bpt_t::flags's BPT_ENABLED is modified
  - bpt_t::flags's BPT_LOWCND is changed
  - bpt_t::flags's BPT_LOWCND remains set, but cndbody changed

## ◆ find_bpt()

bool idaapi find_bpt | ( | const bpt_location_t & | bptloc,
|  | bpt_t * | bpt
| ) |  |
| inline

Find a breakpoint by location.

Type | Synchronous function - available as request
Notification | none (synchronous function)

Parameters

  bptloc | Breakpoint location
  bpt | bpt is filled if the breakpoint was found

## ◆ change_bptlocs()

int idaapi change_bptlocs | ( | const movbpt_infos_t & | movinfo,
|  | movbpt_codes_t * | codes = `nullptr`,
|  | bool | del_hindering_bpts = `true`
| ) |  |
| inline

Move breakpoint(s) from one location to another.

Parameters

  movinfo | what bpts to move and where to
  codes | vector of return codes, if detailed error info is required
  del_hindering_bpts | should delete hindering breakpoints?

Returns
  number of moved bpts

## ◆ check_bpt()

int idaapi check_bpt | ( | ea_t | ea | ) |
| inline

Check the breakpoint at the specified address.

Returns
  one of Breakpoint status codes