105 #define ui_switch_dbctx_guard switch_dbctx
116 MERGE_KIND_ENCODINGS,
117 MERGE_KIND_ENCODINGS2,
129 MERGE_KIND_STRMEMCMT,
130 MERGE_KIND_SELECTORS,
144 MERGE_KIND_AFLAGS_EA,
145 MERGE_KIND_IGNOREMICRO,
146 MERGE_KIND_FILEREGIONS,
147 MERGE_KIND_HIDDENRANGES,
148 MERGE_KIND_SOURCEFILES,
157 MERGE_KIND_WATCHPOINTS,
158 MERGE_KIND_BOOKMARKS,
162 MERGE_KIND_SIGNATURES,
169 MERGE_KIND_DBG_MEMREGS,
175 MERGE_KIND_END = merge_kind_t(-2),
178 MERGE_KIND_NONE = merge_kind_t(-1)
180 MERGE_KIND_END = UINT32_MAX - 2,
181 MERGE_KIND_NONE = UINT32_MAX - 1,
186class merge_handler_t;
239 nbases = base != -1 ? 3 : 2;
329#define MH_LISTEN 0x00000001
330#define MH_TERSE 0x00000002
331#define MH_UI_NODETAILS 0x00000100
332#define MH_UI_COMPLEX 0x00000200
333#define MH_UI_DP_NOLINEDIFF 0x00000400
334#define MH_UI_DP_SHORTNAME 0x00000800
335#define MH_UI_INDENT 0x00001000
336#define MH_UI_SPLITNAME 0x00800000
338#define MH_UI_CHAR_MASK 0x007F0000
339#define MH_UI_DEF_CHAR(v) ((((v) & 0x7F) << 16) | MH_UI_SPLITNAME)
342#define MH_UI_COMMANAME MH_UI_DEF_CHAR(',')
344#define MH_UI_COMMANAME 0x00AC0000
348#define MH_UI_COLONNAME MH_UI_DEF_CHAR(':')
350#define MH_UI_COLONNAME 0x00BA0000
353#define MH_DUMMY 0x80000000
359 merge_kind_t _insert_after,
429 const char *_module_name,
430 const char *_netnode_name,
536 for (
const auto ea : eas )
537 s->cat_sprnt(
"%a,", ea);
581 const char *nodename,
585 bool skip_empty_nodes =
true);
590 const char *nodename,
594 bool skip_empty_nodes =
true);
610 const char *nodename,
613 bool skip_empty_nodes =
true);
618 const char *nodename,
621 bool skip_empty_nodes =
true);
627#define IDI_FLDENTRY(struc, field, mask, valmap, name) \
629 qoffsetof(struc, field), \
630 sizeof(struc::field), \
635 IDI_STRUCFLD|IDI_SCALAR }
638#define IDI_FLDQSTR(struc, field, name) \
639 { name, qoffsetof(struc, field), 0, 0, 0, nullptr, nullptr, IDI_STRUCFLD|IDI_QSTRING }
642#define IDI_ALTENTRY(altidx, tag, width, mask, valmap, name) \
650 IDI_ALTVAL|IDI_SCALAR }
653#define IDI_HASHENTRY(hashname, tag, width, mask, flag, valmap, name) \
655 uintptr_t(hashname), \
664#define IDI_SUPSTR(altidx, tag, name) \
665 { name, uintptr_t(altidx), 0, 0, tag, nullptr, nullptr, IDI_SUPVAL|IDI_CSTR }
668#define IDI_DEVICE_ENTRY IDI_SUPSTR(-1, stag, "device")
671#define MNI_ENTRY(tag, flags, name, helper) \
672 { name, tag, NDS_MAP_IDX|NDS_EV_RANGE|(flags), helper }
675#define MNI_FUNCENTRY(tag, flags, name) \
676 MNI_ENTRY(tag, NDS_EV_FUNC|(flags), name, nullptr)
679#define MNI_STDENTRY(tag, flags, name) MNI_ENTRY(tag, flags, name, nullptr)
683#ifdef ui_switch_dbctx_guard
684 #define switch_dbctx ui_switch_dbctx_guard
void remove_last(int cnt=1)
Definition pro.h:3228
_qstring & append(qchar c)
Append c to the end of the qstring.
Definition pro.h:3569
Vector of bytes (use for dynamic memory)
Definition pro.h:3850
class to contain public info about the merge process
Definition merge.hpp:196
int remote_id() const
Definition merge.hpp:243
void set_dbctx_ids(int local, int remote, int base)
Definition merge.hpp:234
void remove_event_handler(merge_handler_t *handler)
Definition merge.hpp:247
virtual bool map_privrange_id(tid_t *tid, ea_t ea, diff_source_idx_t from, diff_source_idx_t to, bool strict=true)
map IDs of structures, enumerations and their members
merge_handlers_t ev_handlers
event handlers
Definition merge.hpp:225
void operator=(const merge_data_t &)=delete
virtual bool has_existing_node(const char *nodename) const
check that node exists in any of databases
bool setup_blocks(diff_source_idx_t dst_idx, diff_source_idx_t src_idx, const diff_range_t ®ion)
Definition merge.hpp:255
virtual int compare_merging_tifs(const tinfo_t &tif1, diff_source_idx_t diffidx1, const tinfo_t &tif2, diff_source_idx_t diffidx2) const
compare types from two databases
int base_id() const
Definition merge.hpp:244
merge_data_t(const merge_data_t &)=delete
void add_event_handler(merge_handler_t *handler)
Definition merge.hpp:246
ea_t get_block_head(diff_source_idx_t idx, ea_t item_head)
Definition merge.hpp:249
item_block_locator_t * item_block_locator
Definition merge.hpp:226
int dbctx_ids[3]
local, remote, base ids
Definition merge.hpp:222
class merge_mappers_t & mappers
Definition merge.hpp:220
int nbases
number of database participating in merge process, maybe 2 or 3
Definition merge.hpp:223
int local_id() const
Definition merge.hpp:242
virtual bool map_tinfo(tinfo_t *tif, diff_source_idx_t from, diff_source_idx_t to, bool strict=true)
migrate type, replaces type references into FROM database to references into TO database
merge_handler_t * last_udt_related_merger
Definition merge.hpp:227
Definition of the IDA database node.
Definition netnode.hpp:241
Reimplementation of vector class from STL.
Definition pro.h:2262
bool empty(void) const
Does the qvector have 0 elements?
Definition pro.h:2495
Primary mechanism for managing type information.
Definition typeinf.hpp:3077
3-way diff for anchored info
diff_source_idx_t
standard indexes into dbctx_ids[] and similar arrays
Definition diff3.hpp:125
@ BASE_IDX
Definition diff3.hpp:129
@ LOCAL_IDX
Definition diff3.hpp:127
@ REMOTE_IDX
Definition diff3.hpp:128
unsigned __int64 uint64
Definition llong.hpp:13
qvector< qstring > qstrvec_t
Definition lumina.hpp:831
std::function< merge_node_helper_creator_t > merge_node_hlpfunc_creator_t
Definition merge.hpp:544
idaman bool ida_export is_diff_merge_mode()
Return TRUE if IDA is running in diff mode (MERGE_POLICY_MDIFF/MERGE_POLICY_VDIFF)
idaman void ida_export destroy_moddata_merge_handlers(int data_id)
nds_flags_t
netnode value modificators (to be used in nodeval_diff_source, see below)
Definition merge.hpp:450
@ NDS_MAP_IDX
apply ea2node() to index (==NETMAP_IDX)
Definition merge.hpp:459
@ NDS_EV_RANGE
enable default handling of mev_modified_ranges, mev_deleting_segm
Definition merge.hpp:457
@ NDS_IS_EA
EA value.
Definition merge.hpp:452
@ NDS_IS_STR
string value
Definition merge.hpp:454
@ NDS_IS_BOOL
boolean value
Definition merge.hpp:451
@ NDS_IS_RELATIVE
value is relative to index (stored as delta)
Definition merge.hpp:453
@ NDS_SUPVAL
stored as netnode supvals (not scalar)
Definition merge.hpp:455
@ NDS_BLOB
stored as netnode blobs
Definition merge.hpp:456
@ NDS_EV_FUNC
enable default handling of mev_added_func/mev_deleting_func/mev_added_function/mev_deleting_function
Definition merge.hpp:458
@ NDS_MAP_VAL
apply ea2node() to value.
Definition merge.hpp:460
@ NDS_VAL8
use 8-bit values (==NETMAP_V8)
Definition merge.hpp:466
@ NDS_UI_ND
UI: no need to show diffpos detail pane, MH_UI_NODETAILS, make sense if merge_node_helper_t is used.
Definition merge.hpp:468
@ NDS_INC
stored value is incremented (scalars only)
Definition merge.hpp:467
qvector< merge_handler_t * > merge_handlers_t
Definition merge.hpp:188
idaman void ida_export create_nodeval_merge_handlers2(merge_handlers_t *out, const merge_handler_params_t &mhp, int moddata_id, const char *nodename, const merge_node_info2_t *valdesc, size_t nvals, bool skip_empty_nodes=true)
idaman ssize_t ida_export get_ea_diffpos_name(qstring *out, ea_t ea)
Get nice name for EA diffpos.
DECLARE_TYPE_AS_MOVABLE(merge_node_info_t)
idaman void ida_export create_nodeval_merge_handlers(merge_handlers_t *out, const merge_handler_params_t &mhp, int moddata_id, const char *nodename, const merge_node_info_t *valdesc, size_t nvals, bool skip_empty_nodes=true)
Create a serie of merge handlers for netnode scalar/string values (call create_nodeval_merge_handler(...
idaman merge_handler_t *ida_export create_nodeval_merge_handler2(const merge_handler_params_t &mhp, const char *label, int moddata_id, const char *nodename, uchar tag, uint32 nds_flags, merge_node_helper_t *node_helper=nullptr, bool skip_empty_nodes=true)
enum merge_kind_t ENUM_SIZE(uint32)
Kinds of merge handlers.
Definition merge.hpp:111
idaman merge_handler_t *ida_export create_nodeval_merge_handler(const merge_handler_params_t &mhp, const char *label, int moddata_id, const char *nodename, uchar tag, uint32 nds_flags, merge_node_hlpfunc_creator_t nhc=nullptr, bool skip_empty_nodes=true)
Create a merge handler for netnode scalar/string values.
merge_node_helper_t * merge_node_helper_creator_t(merge_data_t &md, int dbctx_id)
Definition merge.hpp:543
Definitions of various information kept in netnodes.
nodeidx64_t nodeidx_t
Definition netnode.hpp:114
unsigned int uint32
unsigned 32 bit value
Definition pro.h:352
uint64 ea_t
Definition pro.h:425
unsigned char uchar
unsigned 8 bit value
Definition pro.h:341
qvector< ea_t > eavec_t
vector of addresses
Definition pro.h:2838
ptrdiff_t ssize_t
Signed size_t - used to check for size overflows when the counter becomes negative.
Definition pro.h:385
ea_t tid_t
type id (for enums, structs, etc)
Definition pro.h:5107
_qstring< char > qstring
regular string
Definition pro.h:3771
A range of the difference source.
Definition diff3.hpp:30
access to attribute by structure/offset/width or netnode/index/width
Definition ida.hpp:1478
several items can be grouped into a block.
Definition merge.hpp:204
virtual ea_t get_block_head(merge_data_t &md, diff_source_idx_t idx, ea_t item_head)=0
get block address (address of first item in the block) by address of item this function returns item ...
virtual ~item_block_locator_t()
Definition merge.hpp:217
virtual bool setup_blocks(merge_data_t &md, diff_source_idx_t from, diff_source_idx_t to, const diff_range_t ®ion)=0
setup block-specific info before region updating, return FALSE if nothing was changed
Merge handler parameters.
Definition merge.hpp:323
merge_kind_t insert_after
desired position inside 'handlers' merge_kind_t
Definition merge.hpp:327
merge_handler_params_t(merge_data_t &_md, const qstring &_label, merge_kind_t _kind, merge_kind_t _insert_after, uint32 _mh_flags)
Definition merge.hpp:355
static bool ui_complex_details(uint32 _mh_flags)
Do not display the diffpos details in the chooser.
Definition merge.hpp:375
static bool ui_dp_shortname(uint32 _mh_flags)
The detail pane shows the diffpos details for the current diffpos range as a tree-like view.
Definition merge.hpp:400
bool ui_indent() const
Definition merge.hpp:413
qstring ui_split_str() const
Definition merge.hpp:390
bool ui_complex_name() const
Definition merge.hpp:386
bool ui_has_details() const
Definition merge.hpp:370
bool ui_linediff() const
Definition merge.hpp:408
bool ui_complex_details() const
Definition merge.hpp:376
static qstring ui_split_str(uint32 _mh_flags)
Definition merge.hpp:389
static bool ui_indent(uint32 _mh_flags)
In the ordinary situation the spaces from the both sides of diffpos name are trimmed.
Definition merge.hpp:412
merge_kind_t kind
merge handler kind merge_kind_t
Definition merge.hpp:326
bool ui_dp_shortname() const
Definition merge.hpp:401
merge_data_t & md
Definition merge.hpp:324
qstring label
Definition merge.hpp:325
static bool ui_linediff(uint32 _mh_flags)
In detail pane IDA shows difference between diffpos details.
Definition merge.hpp:407
uint32 mh_flags
Definition merge.hpp:328
char ui_split_char() const
Definition merge.hpp:388
static bool ui_complex_name(uint32 _mh_flags)
It customary to create long diffpos names having many components that are separated by any 7-bit ASCI...
Definition merge.hpp:385
static char ui_split_char(uint32 _mh_flags)
Definition merge.hpp:387
static bool ui_has_details(uint32 _mh_flags)
Should IDA display the diffpos detail pane?
Definition merge.hpp:369
abstract adapter to provide access to non-standard netnode array entries
Definition merge.hpp:475
virtual void map_string(qstring *, void *, diff_source_idx_t, diff_source_idx_t) const
Definition merge.hpp:506
virtual qstring print_entry_name(uchar, nodeidx_t, void *) const
print the name of the specified entry (to be used in print_diffpos_name)
Definition merge.hpp:480
virtual ~merge_node_helper_t()
Definition merge.hpp:476
virtual void map_scalar(nodeidx_t *, void *, diff_source_idx_t, diff_source_idx_t) const
map scalar/string/buffered value
Definition merge.hpp:499
virtual void get_column_headers(qstrvec_t *, uchar, void *) const
get column headers for chooser (to be used in linear_diff_source_t::get_column_headers)
Definition merge.hpp:489
virtual void map_value(bytevec_t *, void *, diff_source_idx_t, diff_source_idx_t) const
Definition merge.hpp:513
virtual netnode get_netnode() const
return netnode to be used as source.
Definition merge.hpp:496
static void append_eavec(qstring *s, const char *prefix, const eavec_t &eas)
can be used by derived classes
Definition merge.hpp:530
virtual const char * get_logname() const
return name of netnode to be used in logging.
Definition merge.hpp:527
virtual void print_entry_details(qstrvec_t *, uchar, nodeidx_t, void *) const
print the details of the specified entry usually contains multiple lines, one for each attribute or d...
Definition merge.hpp:485
virtual bool is_mergeable(uchar, nodeidx_t) const
filter: check if we should perform merging for given record
Definition merge.hpp:492
virtual void refresh(uchar, void *)
notify helper that some data was changed in the database and internal structures (e....
Definition merge.hpp:523
const char * name
name of the array (label)
Definition merge.hpp:559
uchar tag
a tag used to access values in the netnode
Definition merge.hpp:560
uint32 nds_flags
node value attributes (a combination of nds_flags_t)
Definition merge.hpp:561
merge_node_helper_t * node_helper
merge handler creation helper, foreign owner
Definition merge.hpp:562
field descriptor used to organize merging of a netnode array
Definition merge.hpp:549
merge_node_helper_creator_t * nhc
a factory to create instances of merge_node_helper_t
Definition merge.hpp:553
uchar tag
a tag used to access values in the netnode
Definition merge.hpp:551
uint32 nds_flags
node value attributes (a combination of nds_flags_t)
Definition merge.hpp:552
const char * name
name of the array (label)
Definition merge.hpp:550
virtual void * get_struc_ptr(merge_data_t &, diff_source_idx_t, const idbattr_info_t &)
Definition merge.hpp:443
const char * module_name
will be used as a prefix for field desc
Definition merge.hpp:421
const char * netnode_name
name of netnode with module data attributes
Definition merge.hpp:422
const idbattr_info_t * fields
module data attribute descriptions
Definition merge.hpp:423
virtual void merge_starting(diff_source_idx_t, void *)
Definition merge.hpp:441
virtual bool val2str(qstring *, const idbattr_info_t &, uint64)
Definition merge.hpp:445
uint32 additional_mh_flags
additional merge handler flags
Definition merge.hpp:425
moddata_diff_helper_t(const char *_module_name, const char *_netnode_name, const idbattr_info_t *_fields, size_t _nfields)
Definition merge.hpp:428
virtual bool str2val(uint64 *, const idbattr_info_t &, const char *)
Definition merge.hpp:446
virtual void print_diffpos_details(qstrvec_t *, const idbattr_info_t &)
Definition merge.hpp:444
virtual ~moddata_diff_helper_t()
Definition merge.hpp:439
size_t nfields
number of descriptions
Definition merge.hpp:424
virtual void merge_ending(diff_source_idx_t, void *)
Definition merge.hpp:442