Add anal.ignhintbits to only obey asm.bits and ignore hints ##anal (#13696)

This commit is contained in:
radare 2019-04-11 04:34:34 +02:00 committed by GitHub
parent b687cab8f7
commit a7dffe0240
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 5 deletions

View File

@ -198,6 +198,9 @@ R_API void r_anal_hint_free(RAnalHint *h) {
}
R_API int r_anal_hint_get_bits_at(RAnal *a, ut64 addr, const char *str) {
if (a->opt.ignbithints) {
return 0;
}
char *r, *nxt, *nxt2;
char *s = strdup (str);
int token = 0, bits = 0;

View File

@ -264,6 +264,13 @@ static int cb_analstrings(void *user, void *data) {
return true;
}
static int cb_anal_ignbithints(void *user, void *data) {
RCore *core = (RCore*) user;
RConfigNode *node = (RConfigNode*) data;
core->anal->opt.ignbithints = node->i_value;
return true;
}
static int cb_analsleep(void *user, void *data) {
RCore *core = (RCore*) user;
RConfigNode *node = (RConfigNode*) data;
@ -2612,7 +2619,7 @@ R_API int r_core_config_init(RCore *core) {
SETPREF ("pdb.server", "https://msdl.microsoft.com/download/symbols", "Base URL for Microsoft symbol server");
{
char *pdb_path = r_str_home(R2_HOME_PDB);
SETPREF("pdb.symstore", pdb_path, "Path to downstream symbol store");
SETPREF ("pdb.symstore", pdb_path, "Path to downstream symbol store");
R_FREE(pdb_path);
}
SETI ("pdb.extract", 1, "Avoid extract of the pdb file, just download");
@ -2647,6 +2654,7 @@ R_API int r_core_config_init(RCore *core) {
SETICB ("anal.depth", 64, &cb_analdepth, "Max depth at code analysis"); // XXX: warn if depth is > 50 .. can be problematic
SETICB ("anal.graph_depth", 256, &cb_analgraphdepth, "Max depth for path search");
SETICB ("anal.sleep", 0, &cb_analsleep, "Sleep N usecs every so often during analysis. Avoid 100% CPU usage");
SETCB ("anal.ignbithints", "false", &cb_anal_ignbithints, "Ignore the ahb hints (only obey asm.bits)");
SETPREF ("anal.calls", "false", "Make basic af analysis walk into calls");
SETPREF ("anal.autoname", "false", "Speculatively set a name for the functions, may result in some false positives");
SETPREF ("anal.hasnext", "false", "Continue analysis after each function");
@ -2690,9 +2698,9 @@ R_API int r_core_config_init(RCore *core) {
SETOPTIONS (n, "itanium", "msvc", NULL);
#if __linux__ && __GNU_LIBRARY__ && __GLIBC__ && __GLIBC_MINOR__
SETCB("dbg.malloc", "glibc", &cb_malloc, "Choose malloc structure parser");
SETCB ("dbg.malloc", "glibc", &cb_malloc, "Choose malloc structure parser");
#else
SETCB("dbg.malloc", "jemalloc", &cb_malloc, "Choose malloc structure parser");
SETCB ("dbg.malloc", "jemalloc", &cb_malloc, "Choose malloc structure parser");
#endif
#if __GLIBC_MINOR__ > 25
SETPREF ("dbg.glibc.tcache", "true", "Set glib tcache parsing");
@ -3251,7 +3259,7 @@ R_API int r_core_config_init(RCore *core) {
// DEPRECATED: USES hex.cols now SETI ("scr.colpos", 80, "Column position of cmd.cprompt in visual");
SETCB ("scr.breakword", "", &cb_scrbreakword, "Emulate console break (^C) when a word is printed (useful for pD)");
SETCB ("scr.breaklines", "false", &cb_breaklines, "Break lines in Visual instead of truncating them");
SETCB("scr.gadgets", "false", &cb_scr_gadgets, "Run pg in prompt, visual and panels");
SETCB ("scr.gadgets", "false", &cb_scr_gadgets, "Run pg in prompt, visual and panels");
SETICB ("scr.columns", 0, &cb_scrcolumns, "Force console column count (width)");
SETPREF ("scr.dumpcols", "false", "Prefer pC commands before p ones");
SETCB ("scr.rows", "0", &cb_scrrows, "Force console row count (height) ");
@ -3337,7 +3345,7 @@ R_API int r_core_config_init(RCore *core) {
SETCB ("io.pcache.write", "false", &cb_iopcachewrite, "Enable write-cache");
SETCB ("io.pcache.read", "false", &cb_iopcacheread, "Enable read-cache");
SETCB ("io.ff", "true", &cb_ioff, "Fill invalid buffers with 0xff instead of returning error");
SETPREF("io.exec", "true", "See !!r2 -h~-x");
SETPREF ("io.exec", "true", "See !!r2 -h~-x");
SETICB ("io.0xff", 0xff, &cb_io_oxff, "Use this value instead of 0xff to fill unallocated areas");
SETCB ("io.aslr", "false", &cb_ioaslr, "Disable ASLR for spawn and such");
SETCB ("io.va", "true", &cb_iova, "Use virtual address layout");

View File

@ -603,6 +603,7 @@ typedef struct r_anal_options_t {
bool ijmp;
bool jmpmid; // continue analysis after jmp into middle of insn
bool loads;
bool ignbithints;
int followdatarefs;
int searchstringrefs;
int followbrokenfcnsrefs;