oob [arg] sets bin.baddr, then seeks to new entry0 ##io

This commit is contained in:
radare 2019-04-15 11:50:34 +02:00 committed by GitHub
parent 73c38d38e7
commit 1a4c94e776
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 1 deletions

View File

@ -44,6 +44,19 @@ R_API int r_core_file_reopen(RCore *core, const char *args, int perm, int loadbi
}
}
ut64 new_baddr = UT64_MAX;
if (args) {
new_baddr = r_num_math (core->num, args);
if (new_baddr && new_baddr != UT64_MAX) {
r_config_set_i (core->config, "bin.baddr", new_baddr);
} else {
new_baddr = UT64_MAX;
}
}
if (new_baddr == UT64_MAX) {
new_baddr = r_config_get_i (core->config, "bin.baddr");
}
if (r_sandbox_enable (0)) {
eprintf ("Cannot reopen in sandbox\n");
free (obinfilepath);
@ -98,11 +111,15 @@ R_API int r_core_file_reopen(RCore *core, const char *args, int perm, int loadbi
if (loadbin && (loadbin == 2 || had_rbin_info)) {
ut64 baddr = r_config_get_i (core->config, "bin.baddr");
if (new_baddr != UT64_MAX) {
baddr = new_baddr;
}
ret = r_core_bin_load (core, obinfilepath, baddr);
r_core_bin_update_arch_bits (core);
if (!ret) {
eprintf ("Error: Failed to reload rbin for: %s", path);
}
origoff = r_num_math (core->num, "entry0");
}
if (core->bin->cur && core->io && r_io_desc_get (core->io, file->fd) && !loadbin) {

View File

@ -115,7 +115,7 @@ static const char *help_msg_oo[] = {
"Usage:", "oo[-] [arg]", " # map opened files",
"oo", "", "reopen current file",
"oo+", "", "reopen in read-write",
"oob", "", "reopen loading rbin info",
"oob", " [baddr]", "reopen loading rbin info (change base address?)",
"ooc", "", "reopen core with current file",
"ood", "", "reopen in debug mode",
"oom", "", "reopen in malloc://",