radare2/libr/search/xrefs.c
Fangrui Song c43e6880fb Refactor search (#8566)
* fix out-of-bounds read in r_search_strings_update
* Remove static variables searchhits maplist maxhits first_hit in cmd_search.c
* Change semantics of r_search_hit_new (update kw->count s->nhits in it), return 2 if search.maxhits is reached and stop searching immediately
* honor search.maxhits in r_search_regexp_update
* Refactor _cb_hit, remove bckwrds/do_bckwrd_srch and static cmdhit
* Fix mem leak in regexp.c
* Add support for /d (delta) /bd (backward + delta) when crossing blocksize boundaries
2017-09-20 17:00:18 +02:00

43 lines
1017 B
C

/* radare - LGPL - Copyright 2007-2009 pancake<nopcode.org> */
#include "r_search.h"
//#include <regex.h>
R_API int r_search_xrefs_update(RSearch *s, ut64 from, const ut8 *buf, int len) {
// ut8 code[1024];
// ut8 mask[1024];
int count = 0;
//get_delta_for(
//if (r_mem_cmp_mask(buf, code, mask, 4)) {
//}
return count;
}
#if 0
struct r_xrefs_arch_t {
int align; // if arch requires align we can skip invalid addresses
int bigendian;
ut64 baseaddr;
ut64 targetaddr; // the addr we are looking for
};
the xrefs plugin will have a callback:
- size of opcode to skip in bytes (mips/arm=4 f.ex)
int r_xrefs_x86(ut64 addr, int bigendian, ut64 baseaddr)
{
// check for calls, branches..and calculate target address
}
Options we need to configure xrefs search plugin:
- endian
- base address
- target address
- from/to (defined as max for the maximum branch distance)
- architecture profile ()
- TODO: ensure we are pointing to a function if following a 'call'
- we need per-arch plugins
#endif