| IDA SDK

Modules | Enumerations | Functions
High level functions
Debugger functions

## Detailed Description

These functions can be used from scripts.

## Modules
| Wait for debugger event flags
| Passed as 'wfne' parameter to wait_for_next_event()
| Debugger options
| Passed as 'options' parameter to set_debugger_options()

## Enumerations
enum | dbg_event_code_t { DEC_NOTASK = -2 , DEC_ERROR = -1 , DEC_TIMEOUT = 0 }
| Wait for the next debugger event. More...

## Functions
dbg_event_code_t idaapi | wait_for_next_event (int wfne, int timeout)
| Wait for the next event. More...
const debug_event_t *idaapi | get_debug_event (void)
| Get the current debugger event.
uint idaapi | set_debugger_options (uint options)
| Set debugger options. More...
void idaapi | set_remote_debugger (const char *host, const char *pass, int port=-1)
| Set remote debugging options. More...
void idaapi | get_process_options (qstring *path, qstring *args, launch_env_t *out_envs, qstring *sdir, qstring *host, qstring *pass, int *port)
| Get process options. More...
void idaapi | set_process_options (const char *path, const char *args, const launch_env_t *envs, const char *sdir, const char *host, const char *pass, int port)
| Set process options. More...
excvec_t *idaapi | retrieve_exceptions (void)
| Retrieve the exception information. More...
bool idaapi | store_exceptions (void)
| Update the exception information stored in the debugger module by invoking its dbg->set_exception_info callback.
const char *idaapi | define_exception (uint code, const char *name, const char *desc, int flags)
| Convenience function: define new exception code. More...
THREAD_SAFE bool | have_set_options (const debugger_t *_dbg)
| Is set_dbg_options() implemented in debugger_t?
const char *idaapi | set_dbg_options (debugger_t *_dbg, const char *keyword, int pri, int value_type, const void *value)
| Convenience function to set debugger specific options. More...
const char *idaapi | set_dbg_default_options (debugger_t *_dbg, const char *keyword, int value_type, const void *value)
const char *idaapi | set_int_dbg_options (debugger_t *_dbg, const char *keyword, int32 value)
const char *idaapi | set_dbg_options (const char *keyword, int pri, int value_type, const void *value)
| Set options for dbg.
const char *idaapi | set_dbg_default_options (const char *keyword, int value_type, const void *value)
| Set dbg options with #IDPOPT_PRI_DEFAULT.
const char *idaapi | set_int_dbg_options (const char *keyword, int32 value)
| Set an integer value option for dbg.

## Enumeration Type Documentation

## ◆ dbg_event_code_t

enum dbg_event_code_t

Wait for the next debugger event.

See also get_process_state() to get info about the current state of the debugged application Debugger event codes

Enumerator
DEC_NOTASK | process does not exist
DEC_ERROR | error
DEC_TIMEOUT | timeout

## Function Documentation

## ◆ wait_for_next_event()

dbg_event_code_t idaapi wait_for_next_event | ( | int | wfne,
|  | int | timeout
| ) |  |
| inline

Wait for the next event.

This function (optionally) resumes the process execution, and waits for a debugger event until a possible timeout occurs.

Parameters

  wfne | combination of Wait for debugger event flags constants
  timeout | number of seconds to wait, -1-infinity

Returns
  either an event_id_t (if > 0), or a dbg_event_code_t (if <= 0)

## ◆ set_debugger_options()

uint idaapi set_debugger_options | ( | uint | options | ) |
| inline

Set debugger options.

Replaces debugger options with the specification combination Debugger options

Returns
  the old debugger options

## ◆ set_remote_debugger()

void idaapi set_remote_debugger | ( | const char * | host,
|  | const char * | pass,
|  | int | port = `-1`
| ) |  |
| inline

Set remote debugging options.

Should be used before starting the debugger.

Parameters

  host | If empty, IDA will use local debugger. If nullptr, the host will not be set.
  pass | If nullptr, the password will not be set
  port | If -1, the default port number will be used

## ◆ get_process_options()

void idaapi get_process_options | ( | qstring * | path,
|  | qstring * | args,
|  | launch_env_t * | out_envs,
|  | qstring * | sdir,
|  | qstring * | host,
|  | qstring * | pass,
|  | int * | port
| ) |  |
| inline

Get process options.

Any of the arguments may be nullptr

## ◆ set_process_options()

void idaapi set_process_options | ( | const char * | path,
|  | const char * | args,
|  | const launch_env_t * | envs,
|  | const char * | sdir,
|  | const char * | host,
|  | const char * | pass,
|  | int | port
| ) |  |
| inline

Set process options.

Any of the arguments may be nullptr, which means 'do not modify'

## ◆ retrieve_exceptions()

excvec_t *idaapi retrieve_exceptions | ( | void |  | ) |
| inline

Retrieve the exception information.

You may freely modify the returned vector and add/edit/delete exceptions You must call store_exceptions() after any modifications Note: exceptions with code zero, multiple exception codes or names are prohibited

## ◆ define_exception()

const char *idaapi define_exception | ( | uint | code,
|  | const char * | name,
|  | const char * | desc,
|  | int | flags
| ) |  |
| inline

Convenience function: define new exception code.

Parameters

  code | exception code (cannot be 0)
  name | exception name (cannot be empty or nullptr)
  desc | exception description (maybe nullptr)
  flags | combination of Exception info flags

Returns
  failure message or nullptr. You must call store_exceptions() if this function succeeds

## ◆ set_dbg_options()

const char *idaapi set_dbg_options | ( | debugger_t * | _dbg,
|  | const char * | keyword,
|  | int | pri,
|  | int | value_type,
|  | const void * | value
| ) |  |
| inline

Convenience function to set debugger specific options.

It checks if the debugger is present and calls function.