Honor rabin2 -H, -rH, -qH and -jH

This commit is contained in:
pancake 2017-02-27 10:55:47 +01:00
parent 46e91531a3
commit 81832436e0
3 changed files with 20 additions and 4 deletions

View File

@ -649,7 +649,9 @@ int main(int argc, char **argv) {
break;
case 'Z': set_action (R_BIN_REQ_SIZE); break;
case 'I': set_action (R_BIN_REQ_INFO); break;
case 'H': set_action (R_BIN_REQ_FIELDS); break;
case 'H':
set_action (R_BIN_REQ_FIELDS);
break;
case 'd': set_action (R_BIN_REQ_DWARF); break;
case 'P':
if (is_active (R_BIN_REQ_PDB)) {
@ -1049,6 +1051,7 @@ int main(int argc, char **argv) {
run_action ("strings", R_BIN_REQ_STRINGS, R_CORE_BIN_ACC_STRINGS);
run_action ("info", R_BIN_REQ_INFO, R_CORE_BIN_ACC_INFO);
run_action ("fields", R_BIN_REQ_FIELDS, R_CORE_BIN_ACC_FIELDS);
run_action ("header", R_BIN_REQ_HEADER, R_CORE_BIN_ACC_HEADER);
run_action ("libs", R_BIN_REQ_LIBS, R_CORE_BIN_ACC_LIBS);
run_action ("relocs", R_BIN_REQ_RELOCS, R_CORE_BIN_ACC_RELOCS);
run_action ("dwarf", R_BIN_REQ_DWARF, R_CORE_BIN_ACC_DWARF);

View File

@ -2690,7 +2690,6 @@ static int bin_header(RCore *r, int mode) {
return true;
}
return false;
}
R_API int r_core_bin_info(RCore *core, int action, int mode, int va, RCoreBinFilter *filter, const char *chksum) {
@ -2717,14 +2716,27 @@ R_API int r_core_bin_info(RCore *core, int action, int mode, int va, RCoreBinFil
if ((action & R_CORE_BIN_ACC_IMPORTS)) ret &= bin_imports (core, mode, va, name);
if ((action & R_CORE_BIN_ACC_EXPORTS)) ret &= bin_exports (core, mode, loadaddr, va, at, name);
if ((action & R_CORE_BIN_ACC_SYMBOLS)) ret &= bin_symbols (core, mode, loadaddr, va, at, name);
if ((action & R_CORE_BIN_ACC_FIELDS)) ret &= bin_fields (core, mode, va);
if ((action & R_CORE_BIN_ACC_LIBS)) ret &= bin_libs (core, mode);
if ((action & R_CORE_BIN_ACC_CLASSES)) ret &= bin_classes (core, mode);
if ((action & R_CORE_BIN_ACC_SIZE)) ret &= bin_size (core, mode);
if ((action & R_CORE_BIN_ACC_MEM)) ret &= bin_mem (core, mode);
if ((action & R_CORE_BIN_ACC_VERSIONINFO)) ret &= bin_versioninfo (core, mode);
if ((action & R_CORE_BIN_ACC_SIGNATURE)) ret &= bin_signature (core, mode);
if ((action & R_CORE_BIN_ACC_HEADER)) ret &= bin_header (core, mode);
// if ((action & R_CORE_BIN_ACC_FIELDS)) ret &= bin_fields (core, mode, va);
if (IS_MODE_SIMPLE (mode)) {
if ((action & R_CORE_BIN_ACC_HEADER) || action & R_CORE_BIN_ACC_FIELDS) {
/* ignore mode, just for quiet/simple here */
ret &= bin_fields (core, 0, va);
}
} else {
if (IS_MODE_NORMAL(mode)) {
ret &= bin_header (core, mode);
} else {
if ((action & R_CORE_BIN_ACC_HEADER) || action & R_CORE_BIN_ACC_FIELDS) {
ret &= bin_fields (core, mode, va);
}
}
}
return ret;
}

View File

@ -62,6 +62,7 @@ R_LIB_VERSION_HEADER (r_bin);
#define R_BIN_REQ_EXPORTS 0x400000
#define R_BIN_REQ_VERSIONINFO 0x800000
#define R_BIN_REQ_PACKAGE 0x1000000
#define R_BIN_REQ_HEADER 0x2000000
enum {
R_BIN_SYM_ENTRY,