IDA C++ SDK 9.2
Loading...
Searching...
No Matches
idd.hpp File Reference

Contains definition of the interface to IDD modules. More...

Go to the source code of this file.

Classes

struct  process_info_t
 Process information. More...
struct  debapp_attrs_t
 Runtime attributes of the debugger/process. More...
struct  register_info_t
 Debuggee register information. More...
struct  dynamic_register_set_t
struct  memory_info_t
 Used by debugger modules to report memory are information to IDA kernel. More...
struct  meminfo_vec_t
 vector of memory info objects More...
struct  scattered_segm_t
 Used by debugger modules to keep track of images that are not mapped uniformly into memory. More...
struct  launch_env_t
 Used by debugger modules to launching processes with environment variables. More...
struct  modinfo_t
 Describes a module load event. More...
struct  bptaddr_t
 Describes a breakpoint event. More...
struct  excinfo_t
 Describes an exception. More...
struct  debug_event_t
 This structure is used only when detailed information about a debug event is needed. More...
struct  exception_info_t
 Exception information. More...
struct  regval_t
 Structure to hold a register value. More...
struct  idd_opinfo_t
 Instruction operand information. More...
struct  call_stack_info_t
 Call stack trace information. More...
struct  call_stack_t
 defined as struct so it can be forward-declared More...
struct  update_bpt_info_t
 Input argument for update_bpts() More...
struct  lowcnd_t
 Input argument for update_lowcnds(). More...
struct  thread_name_t
 Output argument for ev_suspended New thread names. More...
struct  debugger_t
 This structure describes a debugger API module. More...

Typedefs

typedef int pid_t
 process id
typedef int thid_t
 thread id
typedef qvector< process_info_tprocinfo_vec_t
typedef unsigned char register_class_t
 Each register is associated to a register class.
typedef qvector< register_info_tregister_info_vec_t
typedef qvector< scattered_segm_tscattered_image_t
 vector of scattered segments
typedef qvector< modinfo_tmodinfovec_t
typedef int bpttype_t
 hardware breakpoint type (see Hardware breakpoint ids)
typedef qvector< exception_info_texcvec_t
 vector of exception info objects
typedef qvector< regval_tregvals_t
 vector register value objects
typedef qvector< update_bpt_info_tupdate_bpt_vec_t
 vector of update breakpoint info objects
typedef qvector< lowcnd_tlowcnd_vec_t
 vector of low-level breakpoint conditions
typedef qvector< thread_name_tthread_name_vec_t
 vector of thread names

Enumerations

enum  event_id_t {
  NO_EVENT = 0 , PROCESS_STARTED = 1 , PROCESS_EXITED = 2 , THREAD_STARTED = 3 ,
  THREAD_EXITED = 4 , BREAKPOINT = 5 , STEP = 6 , EXCEPTION = 7 ,
  LIB_LOADED = 8 , LIB_UNLOADED = 9 , INFORMATION = 10 , PROCESS_ATTACHED = 11 ,
  PROCESS_DETACHED = 12 , PROCESS_SUSPENDED = 13 , TRACE_FULL = 14 , STATUS_MASK = 0xF0000000 ,
  BITNESS_CHANGED = 0x80000000
}
 Debug event codes. More...
enum  gdecode_t { GDE_ERROR = -1 , GDE_NO_EVENT , GDE_ONE_EVENT , GDE_MANY_EVENTS }
 Return values for get_debug_event() More...
enum  resume_mode_t {
  RESMOD_NONE , RESMOD_INTO , RESMOD_OVER , RESMOD_OUT ,
  RESMOD_SRCINTO , RESMOD_SRCOVER , RESMOD_SRCOUT , RESMOD_USER ,
  RESMOD_HANDLE , RESMOD_BACKINTO , RESMOD_MAX
}
 How to resume the application. More...
enum  drc_t {
  DRC_EVENTS = 3 , DRC_CRC = 2 , DRC_OK = 1 , DRC_NONE = 0 ,
  DRC_FAILED = -1 , DRC_NETERR = -2 , DRC_NOFILE = -3 , DRC_IDBSEG = -4 ,
  DRC_NOPROC = -5 , DRC_NOCHG = -6 , DRC_ERROR = -7
}
 Debugger return codes. More...

Functions

 DECLARE_TYPE_AS_MOVABLE (process_info_t)
 DECLARE_TYPE_AS_MOVABLE (register_info_t)
idaman THREAD_SAFE void ida_export serialize_dynamic_register_set (bytevec_t *buf, dynamic_register_set_t &idaregs)
idaman THREAD_SAFE void ida_export deserialize_dynamic_register_set (dynamic_register_set_t *idaregs, memory_deserializer_t &mmdsr)
idaman THREAD_SAFE void ida_export serialize_insn (bytevec_t *s, const insn_t &insn)
idaman THREAD_SAFE void ida_export deserialize_insn (insn_t *insn, memory_deserializer_t &mmdsr)
 DECLARE_TYPE_AS_MOVABLE (memory_info_t)
 DECLARE_TYPE_AS_MOVABLE (scattered_segm_t)
idaman THREAD_SAFE void ida_export free_debug_event (debug_event_t *ev)
idaman THREAD_SAFE void ida_export copy_debug_event (debug_event_t *ev, const debug_event_t &r)
idaman THREAD_SAFE void ida_export set_debug_event_code (debug_event_t *ev, event_id_t id)
 DECLARE_TYPE_AS_MOVABLE (modinfo_t)
 DECLARE_TYPE_AS_MOVABLE (debug_event_t)
const char * get_debug_event_name (const debug_event_t &dev)
 get debug event name
 DECLARE_TYPE_AS_MOVABLE (exception_info_t)
 DECLARE_TYPE_AS_MOVABLE (regval_t)
 DECLARE_TYPE_AS_MOVABLE (call_stack_info_t)
THREAD_SAFE void append_regval (bytevec_t &s, const regval_t &value)
template<class T>
THREAD_SAFE void extract_regval (regval_t *out, T &v)
template<class T>
THREAD_SAFE void extract_regvals (regval_t *values, int n, T &v, const uchar *regmap)
THREAD_SAFE void unpack_regvals (regval_t *values, int n, const uchar *regmap, memory_deserializer_t &mmdsr)
idaman error_t ida_export dbg_appcall (idc_value_t *retval, ea_t func_ea, thid_t tid, const tinfo_t *ptif, idc_value_t *argv, size_t argnum)
 Call a function from the debugged application.
idaman error_t ida_export cleanup_appcall (thid_t tid)
 Cleanup after manual appcall.
 DECLARE_TYPE_AS_MOVABLE (update_bpt_info_t)
idaman int ida_export cpu2ieee (fpvalue_t *ieee_out, const void *cpu_fpval, int size)
 Convert a floating point number in CPU native format to IDA's internal format.
idaman int ida_export ieee2cpu (void *cpu_fpval_out, const fpvalue_t &ieee, int size)
 Convert a floating point number in IDA's internal format to CPU native format.

Variables

const bpttype_t BPT_WRITE = 1
 Write access.
const bpttype_t BPT_READ = 2
 Read access.
const bpttype_t BPT_RDWR = 3
 Read/write access.
const bpttype_t BPT_SOFT = 4
 Software breakpoint.
const bpttype_t BPT_EXEC = 8
 Execute instruction.
const bpttype_t BPT_DEFAULT = (BPT_SOFT|BPT_EXEC)
 Choose bpt type automatically.

Detailed Description

Contains definition of the interface to IDD modules.

The interface consists of structures describing the target debugged processor and a debugging API.

Typedef Documentation

◆ pid_t

typedef int pid_t

process id

◆ thid_t

typedef int thid_t

thread id

◆ procinfo_vec_t

◆ register_class_t

typedef unsigned char register_class_t

Each register is associated to a register class.

example: "segment", "mmx", ...

◆ register_info_vec_t

◆ scattered_image_t

vector of scattered segments

◆ modinfovec_t

◆ bpttype_t

typedef int bpttype_t

hardware breakpoint type (see Hardware breakpoint ids)

◆ excvec_t

vector of exception info objects

◆ regvals_t

vector register value objects

◆ update_bpt_vec_t

vector of update breakpoint info objects

◆ lowcnd_vec_t

vector of low-level breakpoint conditions

◆ thread_name_vec_t

vector of thread names

Enumeration Type Documentation

◆ event_id_t

enum event_id_t

Debug event codes.

Enumerator
NO_EVENT 

Not an interesting event.

This event can be used if the debugger module needs to return an event but there are no valid events.

PROCESS_STARTED 

New process has been started.

PROCESS_EXITED 

Process has been stopped.

THREAD_STARTED 

New thread has been started.

THREAD_EXITED 

Thread has been stopped.

BREAKPOINT 

Breakpoint has been reached.

IDA will complain about unknown breakpoints, they should be reported as exceptions.

STEP 

One instruction has been executed.

Spurious events of this kind are silently ignored by IDA.

EXCEPTION 

Exception.

LIB_LOADED 

New library has been loaded.

LIB_UNLOADED 

Library has been unloaded.

INFORMATION 

User-defined information.

This event can be used to return empty information This will cause IDA to call get_debug_event() immediately once more.

PROCESS_ATTACHED 

Successfully attached to running process.

PROCESS_DETACHED 

Successfully detached from process.

PROCESS_SUSPENDED 

Process has been suspended.

This event can be used by the debugger module to signal if the process spontaneously gets suspended (not because of an exception, breakpoint, or single step). IDA will silently switch to the 'suspended process' mode without displaying any messages.

TRACE_FULL 

The trace buffer of the tracer module is full and IDA needs to read it before continuing.

STATUS_MASK 

additional info about process state

BITNESS_CHANGED 

Debugger detected the process bitness changing.

◆ gdecode_t

enum gdecode_t

Return values for get_debug_event()

Enumerator
GDE_ERROR 

error

GDE_NO_EVENT 

no debug events are available

GDE_ONE_EVENT 

got one event, no more available yet

GDE_MANY_EVENTS 

got one event, more events available

◆ resume_mode_t

How to resume the application.

The corresponding bit for Debugger module features must be set in order to use a resume mode.

Enumerator
RESMOD_NONE 

no stepping, run freely

RESMOD_INTO 

step into call (the most typical single stepping)

RESMOD_OVER 

step over call

RESMOD_OUT 

step out of the current function (run until return)

RESMOD_SRCINTO 

until control reaches a different source line

RESMOD_SRCOVER 

next source line in the current stack frame

RESMOD_SRCOUT 

next source line in the previous stack frame

RESMOD_USER 

step out to the user code

RESMOD_HANDLE 

step into the exception handler

RESMOD_BACKINTO 

step backwards into call (in time-travel debugging)

RESMOD_MAX 

◆ drc_t

enum drc_t

Debugger return codes.

Success if positive (> DRC_NONE).

Enumerator
DRC_EVENTS 

success, there are pending events

DRC_CRC 

success, but the input file crc does not match

DRC_OK 

success

DRC_NONE 

reaction to the event not implemented

DRC_FAILED 

failed or false

DRC_NETERR 

network error

DRC_NOFILE 

file not found

DRC_IDBSEG 

use idb segmentation

DRC_NOPROC 

the process does not exist anymore

DRC_NOCHG 

no changes

DRC_ERROR 

unclassified error, may be complemented by errbuf

Function Documentation

◆ DECLARE_TYPE_AS_MOVABLE() [1/10]

DECLARE_TYPE_AS_MOVABLE ( process_info_t )

◆ DECLARE_TYPE_AS_MOVABLE() [2/10]

DECLARE_TYPE_AS_MOVABLE ( register_info_t )

◆ serialize_dynamic_register_set()

idaman THREAD_SAFE void ida_export serialize_dynamic_register_set ( bytevec_t * buf,
dynamic_register_set_t & idaregs )

◆ deserialize_dynamic_register_set()

idaman THREAD_SAFE void ida_export deserialize_dynamic_register_set ( dynamic_register_set_t * idaregs,
memory_deserializer_t & mmdsr )

◆ serialize_insn()

idaman THREAD_SAFE void ida_export serialize_insn ( bytevec_t * s,
const insn_t & insn )

◆ deserialize_insn()

idaman THREAD_SAFE void ida_export deserialize_insn ( insn_t * insn,
memory_deserializer_t & mmdsr )

◆ DECLARE_TYPE_AS_MOVABLE() [3/10]

DECLARE_TYPE_AS_MOVABLE ( memory_info_t )

◆ DECLARE_TYPE_AS_MOVABLE() [4/10]

DECLARE_TYPE_AS_MOVABLE ( scattered_segm_t )

◆ free_debug_event()

idaman THREAD_SAFE void ida_export free_debug_event ( debug_event_t * ev)

◆ copy_debug_event()

idaman THREAD_SAFE void ida_export copy_debug_event ( debug_event_t * ev,
const debug_event_t & r )

◆ set_debug_event_code()

idaman THREAD_SAFE void ida_export set_debug_event_code ( debug_event_t * ev,
event_id_t id )

◆ DECLARE_TYPE_AS_MOVABLE() [5/10]

DECLARE_TYPE_AS_MOVABLE ( modinfo_t )

◆ DECLARE_TYPE_AS_MOVABLE() [6/10]

DECLARE_TYPE_AS_MOVABLE ( debug_event_t )

◆ get_debug_event_name()

const char * get_debug_event_name ( const debug_event_t & dev)
inline

get debug event name

◆ DECLARE_TYPE_AS_MOVABLE() [7/10]

DECLARE_TYPE_AS_MOVABLE ( exception_info_t )

◆ DECLARE_TYPE_AS_MOVABLE() [8/10]

DECLARE_TYPE_AS_MOVABLE ( regval_t )

◆ DECLARE_TYPE_AS_MOVABLE() [9/10]

DECLARE_TYPE_AS_MOVABLE ( call_stack_info_t )

◆ append_regval()

THREAD_SAFE void append_regval ( bytevec_t & s,
const regval_t & value )
inline

◆ extract_regval()

template<class T>
THREAD_SAFE void extract_regval ( regval_t * out,
T & v )
inline

◆ extract_regvals()

template<class T>
THREAD_SAFE void extract_regvals ( regval_t * values,
int n,
T & v,
const uchar * regmap )
inline

◆ unpack_regvals()

THREAD_SAFE void unpack_regvals ( regval_t * values,
int n,
const uchar * regmap,
memory_deserializer_t & mmdsr )
inline

◆ dbg_appcall()

idaman error_t ida_export dbg_appcall ( idc_value_t * retval,
ea_t func_ea,
thid_t tid,
const tinfo_t * ptif,
idc_value_t * argv,
size_t argnum )

Call a function from the debugged application.

Parameters
[out]retvalfunction return value
  • for #APPCALL_MANUAL, r will hold the new stack point value
  • for #APPCALL_DEBEV, r will hold the exception information upon failure and the return code will be eExecThrow
func_eaaddress to call
tidthread to use. #NO_THREAD means to use the current thread
ptifpointer to type of the function to call
argvarray of arguments
argnumnumber of actual arguments
Returns
#eOk if successful, otherwise an error code

◆ cleanup_appcall()

idaman error_t ida_export cleanup_appcall ( thid_t tid)

Cleanup after manual appcall.

Parameters
tidthread to use. #NO_THREAD means to use the current thread The application state is restored as it was before calling the last appcall(). Nested appcalls are supported.
Returns
#eOk if successful, otherwise an error code

◆ DECLARE_TYPE_AS_MOVABLE() [10/10]

DECLARE_TYPE_AS_MOVABLE ( update_bpt_info_t )

◆ cpu2ieee()

idaman int ida_export cpu2ieee ( fpvalue_t * ieee_out,
const void * cpu_fpval,
int size )

Convert a floating point number in CPU native format to IDA's internal format.

Parameters
ieee_outoutput buffer
cpu_fpvalfloating point number in CPU native format
sizesize of cpu_fpval in bytes (size of the input buffer)
Returns
Floating point/IEEE Conversion codes

◆ ieee2cpu()

idaman int ida_export ieee2cpu ( void * cpu_fpval_out,
const fpvalue_t & ieee,
int size )

Convert a floating point number in IDA's internal format to CPU native format.

Parameters
cpu_fpval_outoutput buffer
ieeefloating point number of IDA's internal format
sizesize of cpu_fpval in bytes (size of the output buffer)
Returns
Floating point/IEEE Conversion codes