mirror of
https://github.com/radareorg/radare2.git
synced 2025-02-19 13:53:07 +00:00
Bring back the r2 -Lj, and fix -LLj ##shell
This commit is contained in:
parent
9d488023f5
commit
4c3d3da744
@ -1,11 +1,10 @@
|
||||
/* radare - LGPL - Copyright 2009-2022 - pancake */
|
||||
/* radare - LGPL - Copyright 2009-2023 - pancake */
|
||||
|
||||
#include <r_main.h>
|
||||
#include <r_util.h>
|
||||
|
||||
#if EMSCRIPTEN__TODO
|
||||
#include <emscripten.h>
|
||||
static RCore *core = NULL;
|
||||
static R_TH_LOCAL RCore *core = NULL;
|
||||
|
||||
void *r2_asmjs_new(const char *cmd) {
|
||||
return r_core_new ();
|
||||
|
@ -4127,12 +4127,12 @@ find_next:
|
||||
free (lines_nbr);
|
||||
}
|
||||
|
||||
|
||||
// TODO: filter `buf` to avoid command injection here
|
||||
char *line = r_core_cmd_strf (core, "pdr~%s~^0x:%d", buf, offset);
|
||||
r_str_trim (line);
|
||||
ut64 addr = strtoll (line, NULL, 0);
|
||||
ut64 addr = r_num_get (core->num, line);
|
||||
if (addr > 0) {
|
||||
r_core_cmdf (core, "s 0x%lx", addr);
|
||||
r_core_seek (core, addr, true);
|
||||
r_config_set (core->config, "scr.highlight", buf);
|
||||
} else {
|
||||
r_config_set (core->config, "scr.highlight", "");
|
||||
|
@ -512,7 +512,7 @@ R_API int r_main_radare2(int argc, const char **argv) {
|
||||
char *customRarunProfile = NULL;
|
||||
ut64 mapaddr = 0LL;
|
||||
bool quiet = false;
|
||||
bool quietLeak = false;
|
||||
bool quiet_leak = false;
|
||||
bool is_gdb = false;
|
||||
const char * s_seek = NULL;
|
||||
RThread *th_bin = NULL;
|
||||
@ -792,7 +792,7 @@ R_API int r_main_radare2(int argc, const char **argv) {
|
||||
break;
|
||||
case 'Q':
|
||||
quiet = true;
|
||||
quietLeak = true;
|
||||
quiet_leak = true;
|
||||
break;
|
||||
case 'q':
|
||||
r_config_set_b (r->config, "scr.interactive", false);
|
||||
@ -926,17 +926,6 @@ R_API int r_main_radare2(int argc, const char **argv) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (json) {
|
||||
if (qjs_script) {
|
||||
r_core_cmd_callf (r, "js %s", qjs_script);
|
||||
} else if (opt.ind < argc) {
|
||||
r_core_cmd_callf (r, "js:%s", argv[opt.ind]);
|
||||
} else {
|
||||
r_core_cmd_call (r, "js:");
|
||||
}
|
||||
r_core_free (r);
|
||||
return 0;
|
||||
}
|
||||
{
|
||||
const char *dbg_profile = r_config_get (r->config, "dbg.profile");
|
||||
if (dbg_profile && *dbg_profile) {
|
||||
@ -971,8 +960,8 @@ R_API int r_main_radare2(int argc, const char **argv) {
|
||||
goto beach;
|
||||
}
|
||||
|
||||
if (do_list_core_plugins) {
|
||||
r_core_cmd0 (r, "Lc");
|
||||
if (do_list_core_plugins) { // "-LL"
|
||||
r_core_cmd0 (r, json? "Lcj": "Lc");
|
||||
r_cons_flush ();
|
||||
LISTS_FREE ();
|
||||
free (pfile);
|
||||
@ -980,13 +969,13 @@ R_API int r_main_radare2(int argc, const char **argv) {
|
||||
free (envprofile);
|
||||
return 0;
|
||||
}
|
||||
if (do_list_io_plugins) {
|
||||
if (do_list_io_plugins) { // "-L"
|
||||
if (r_config_get_b (r->config, "cfg.plugins")) {
|
||||
r_core_loadlibs (r, R_CORE_LOADLIBS_ALL, NULL);
|
||||
}
|
||||
run_commands (r, NULL, prefiles, false, do_analysis);
|
||||
run_commands (r, cmds, files, quiet, do_analysis);
|
||||
if (quietLeak) {
|
||||
if (quiet_leak) {
|
||||
exit (0);
|
||||
}
|
||||
if (json) {
|
||||
@ -994,6 +983,7 @@ R_API int r_main_radare2(int argc, const char **argv) {
|
||||
} else {
|
||||
r_io_plugin_list (r->io);
|
||||
}
|
||||
r_cons_newline ();
|
||||
r_cons_flush ();
|
||||
LISTS_FREE ();
|
||||
free (pfile);
|
||||
@ -1001,6 +991,17 @@ R_API int r_main_radare2(int argc, const char **argv) {
|
||||
free (envprofile);
|
||||
return 0;
|
||||
}
|
||||
if (json) {
|
||||
if (qjs_script) {
|
||||
r_core_cmd_callf (r, "js %s", qjs_script);
|
||||
} else if (opt.ind < argc) {
|
||||
r_core_cmd_callf (r, "js:%s", argv[opt.ind]);
|
||||
} else {
|
||||
r_core_cmd_call (r, "js:");
|
||||
}
|
||||
r_core_free (r);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (help > 0) {
|
||||
LISTS_FREE ();
|
||||
@ -1652,7 +1653,7 @@ R_API int r_main_radare2(int argc, const char **argv) {
|
||||
r_list_free (evals);
|
||||
r_list_free (files);
|
||||
cmds = evals = files = NULL;
|
||||
if (forcequit || quietLeak) {
|
||||
if (forcequit || quiet_leak) {
|
||||
ret = r->rc;
|
||||
goto beach;
|
||||
}
|
||||
@ -1704,7 +1705,7 @@ R_API int r_main_radare2(int argc, const char **argv) {
|
||||
r_core_project_undirty (r);
|
||||
for (;;) {
|
||||
if (!r_core_prompt_loop (r)) {
|
||||
quietLeak = true;
|
||||
quiet_leak = true;
|
||||
}
|
||||
ret = r->num->value;
|
||||
debug = r_config_get_b (r->config, "cfg.debug");
|
||||
@ -1786,7 +1787,7 @@ R_API int r_main_radare2(int argc, const char **argv) {
|
||||
|
||||
ret = r->rc;
|
||||
beach:
|
||||
if (quietLeak) {
|
||||
if (quiet_leak) {
|
||||
exit (r->rc);
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user