mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-27 07:00:30 +00:00
Be consistent and make all env vars start with R2_
(#16841)
This commit is contained in:
parent
62775d12ce
commit
5603366182
@ -193,7 +193,7 @@ r_core_wrap.cxx:32103:61: error: assigning to 'RDebugReasonType' from incompatib
|
||||
|
||||
* Do not use assert.h, use r_util/r_assert.h instead.
|
||||
|
||||
* You can use `export R_DEBUG_ASSERT=1` to set a breakpoint when hitting an assert.
|
||||
* You can use `export R2_DEBUG_ASSERT=1` to set a breakpoint when hitting an assert.
|
||||
|
||||
* Do not use C99 variable declaration
|
||||
- This way we reduce the number of local variables per function
|
||||
|
@ -3698,8 +3698,15 @@ R_API int r_core_config_init(RCore *core) {
|
||||
}
|
||||
|
||||
R_API void r_core_parse_radare2rc(RCore *r) {
|
||||
bool has_debug = r_sys_getenv_asbool ("R_DEBUG");
|
||||
char *homerc = r_str_home (".radare2rc");
|
||||
bool has_debug = r_sys_getenv_asbool ("R2_DEBUG");
|
||||
char *rcfile = r_sys_getenv ("R2_RCFILE");
|
||||
char *homerc = NULL;
|
||||
if (!R_STR_ISEMPTY (rcfile)) {
|
||||
homerc = rcfile;
|
||||
} else {
|
||||
free (rcfile);
|
||||
homerc = r_str_home (".radare2rc");
|
||||
}
|
||||
if (homerc && r_file_is_regular (homerc)) {
|
||||
if (has_debug) {
|
||||
eprintf ("USER CONFIG loaded from %s\n", homerc);
|
||||
|
@ -153,13 +153,13 @@ static int main_help(int line) {
|
||||
" R2_LIBR_PLUGINS " R_JOIN_2_PATHS ("%s", R2_PLUGINS) "\n"
|
||||
" R2_USER_ZIGNS " R_JOIN_2_PATHS ("~", R2_HOME_ZIGNS) "\n"
|
||||
"Environment:\n"
|
||||
" R2_RDATAHOME %s\n" // TODO: rename to RHOME R2HOME?
|
||||
" RCFILE ~/.radare2rc (user preferences, batch script)\n" // TOO GENERIC
|
||||
" R2_CFG_NEWSHELL sets cfg.newshell=true\n"
|
||||
" R2_DEBUG if defined, show error messages and crash signal\n"
|
||||
" R2_DEBUG_ASSERT=1 set a breakpoint when hitting an assert\n"
|
||||
" R2_MAGICPATH " R_JOIN_2_PATHS ("%s", R2_SDB_MAGIC) "\n"
|
||||
" R_DEBUG if defined, show error messages and crash signal\n"
|
||||
" R_DEBUG_ASSERT=1 set a breakpoint when hitting an assert\n"
|
||||
" VAPIDIR path to extra vapi directory\n"
|
||||
" R2_NOPLUGINS do not load r2 shared plugins\n"
|
||||
" R2_RCFILE ~/.radare2rc (user preferences, batch script)\n" // TOO GENERIC
|
||||
" R2_RDATAHOME %s\n" // TODO: rename to RHOME R2HOME?
|
||||
"Paths:\n"
|
||||
" R2_PREFIX "R2_PREFIX"\n"
|
||||
" R2_INCDIR "R2_INCDIR"\n"
|
||||
@ -388,9 +388,18 @@ R_API int r_main_radare2(int argc, const char **argv) {
|
||||
r_sys_set_environ (envp);
|
||||
}
|
||||
|
||||
if ((tmp = r_sys_getenv ("R_DEBUG"))) {
|
||||
r_sys_crash_handler ("gdb --pid %d");
|
||||
free (tmp);
|
||||
if (r_sys_getenv_asbool ("R2_DEBUG")) {
|
||||
char *sysdbg = r_sys_getenv ("R2_DEBUG_TOOL");
|
||||
char *fmt = (sysdbg && *sysdbg)
|
||||
? r_str_newf ("%s %%d", sysdbg)
|
||||
#if __APPLE__
|
||||
: r_str_newf ("lldb -p %%d");
|
||||
#else
|
||||
: r_str_newf ("gdb --pid %%d");
|
||||
#endif
|
||||
r_sys_crash_handler (fmt);
|
||||
free (fmt);
|
||||
free (sysdbg);
|
||||
}
|
||||
if (argc < 2) {
|
||||
LISTS_FREE ();
|
||||
|
@ -1,3 +1,5 @@
|
||||
/* radare2 - LGPL - Copyright 2018-2020 - ret2libc */
|
||||
|
||||
#include <r_util.h>
|
||||
|
||||
#ifdef R2_ASSERT_STDOUT
|
||||
@ -25,7 +27,7 @@ R_API void r_assert_log(RLogLevel level, const char *fmt, ...) {
|
||||
va_start (args, fmt);
|
||||
print_message (level, fmt, args);
|
||||
va_end (args);
|
||||
char *env = r_sys_getenv ("R_DEBUG_ASSERT");
|
||||
char *env = r_sys_getenv ("R2_DEBUG_ASSERT");
|
||||
if (env) {
|
||||
r_sys_backtrace ();
|
||||
if (*env && atoi (env)) {
|
||||
|
@ -152,13 +152,7 @@ err:
|
||||
R_API RLib *r_lib_new(const char *symname, const char *symnamefunc) {
|
||||
RLib *lib = R_NEW (RLib);
|
||||
if (lib) {
|
||||
char *e = r_sys_getenv ("R_DEBUG");
|
||||
if (e) {
|
||||
__has_debug = *e;
|
||||
free (e);
|
||||
} else {
|
||||
__has_debug = false;
|
||||
}
|
||||
__has_debug = r_sys_getenv_asbool ("R2_DEBUG");
|
||||
lib->handlers = r_list_newf (free);
|
||||
lib->plugins = r_list_newf (free);
|
||||
lib->symname = strdup (symname? symname: R_LIB_SYMNAME);
|
||||
|
@ -1,4 +1,4 @@
|
||||
.Dd Jul 2, 2019
|
||||
.Dd May 17, 2020
|
||||
.Dt RADARE2 1
|
||||
.Sh NAME
|
||||
.Nm radare2
|
||||
@ -125,11 +125,13 @@ To enter visual mode use the 'V' command. Then press '?' for help
|
||||
.Sh DEBUGGER
|
||||
In r2 the debugger commands are implemented under the 'd' command. Type 'd?' for help
|
||||
.Sh ENVIRONMENT
|
||||
RHOMEDIR ~/.config/radare2
|
||||
RCFILE ~/.radare2rc (user preferences, batch script)
|
||||
R2_MAGICPATH /usr/lib/radare2/0.10.0-git/magic
|
||||
R_DEBUG if defined, show error messages and crash signal
|
||||
VAPIDIR path to extra vapi directory
|
||||
R2_CFG_NEWSHELL sets cfg.newshell=true
|
||||
R2_DEBUG if defined, show error messages and crash signal
|
||||
R2_DEBUG_ASSERT=1 set a breakpoint when hitting an assert
|
||||
R2_MAGICPATH /Users/pancake/.local/share/radare2/share/radare2/4.5.0-git/magic
|
||||
R2_NOPLUGINS do not load r2 shared plugins
|
||||
R2_RCFILE ~/.radare2rc (user preferences, batch script)
|
||||
R2_RDATAHOME /usr/local
|
||||
.Ar FILE
|
||||
path to the current working file.
|
||||
.Sh SEE ALSO
|
||||
|
Loading…
Reference in New Issue
Block a user