Add dbg.verbose variable to show more info when debugging ##debug

This commit is contained in:
Paweł Łukasik 2018-11-13 02:10:21 +01:00 committed by radare
parent d29085336a
commit 22ff13e069
4 changed files with 24 additions and 4 deletions

View File

@ -1191,17 +1191,20 @@ int main(int argc, char **argv, char **envp) {
/* load symbols when doing r2 -d ls */
// NOTE: the baddr is redefined to support PIE/ASLR
baddr = r_debug_get_baddr (r.dbg, pfile);
if (baddr != UT64_MAX && baddr != 0) {
if (baddr != UT64_MAX && baddr != 0 && r.dbg->verbose) {
eprintf ("bin.baddr 0x%08" PFMT64x "\n", baddr);
}
if (run_anal > 0) {
if (baddr && baddr != UT64_MAX) {
if (baddr && baddr != UT64_MAX && r.dbg->verbose) {
eprintf ("Using 0x%" PFMT64x "\n", baddr);
}
if (r_core_bin_load (&r, pfile, baddr)) {
RBinObject *obj = r_bin_get_object (r.bin);
if (obj && obj->info) {
eprintf ("asm.bits %d\n", obj->info->bits);
if (r.dbg->verbose) {
eprintf ("asm.bits %d\n", obj->info->bits);
}
#if __linux__ && __GNU_LIBRARY__ && __GLIBC__ && __GLIBC_MINOR__ && __x86_64__
ut64 bitness = r_config_get_i (r.config, "asm.bits");
if (bitness == 32) {

View File

@ -2358,6 +2358,21 @@ static int cb_log_config_colors(void *coreptr, void *nodeptr) {
return true;
}
static int cb_dbg_verbose(void *user, void *data) {
RCore *core = (RCore *)user;
RConfigNode *node = (RConfigNode *)data;
const char *value = node->value;
switch (value[0]) {
case 't':
case 'T':
core->dbg->verbose = true;
break;
default:
core->dbg->verbose = false;
}
return true;
}
#define SLURP_LIMIT (10*1024*1024)
R_API int r_core_config_init(RCore *core) {
int i;
@ -2776,6 +2791,7 @@ R_API int r_core_config_init(RCore *core) {
SETCB ("dbg.libs", "", &cb_dbg_libs, "If set stop when loading matching libname");
SETI ("dbg.hwbp", 0, "Set HW or SW breakpoints");
SETCB ("dbg.unlibs", "", &cb_dbg_unlibs, "If set stop when unloading matching libname");
SETCB ("dbg.verbose", "true", &cb_dbg_verbose, "Verbose debug output");
SETPREF ("dbg.slow", "false", "Show stack and regs in visual mode in a slow but verbose mode");
SETPREF ("dbg.funcarg", "false", "Display arguments to function call in visual mode");

View File

@ -575,7 +575,7 @@ R_API bool r_debug_select(RDebug *dbg, int pid, int tid) {
tid = pid;
}
if (pid != -1 && tid != -1) {
if (pid != dbg->pid || tid != dbg->tid) {
if ((pid != dbg->pid || tid != dbg->tid) && dbg->verbose) {
eprintf ("= attach %d %d\n", pid, tid);
}
} else {

View File

@ -318,6 +318,7 @@ typedef struct r_debug_t {
int _mode;
RNum *num;
REgg *egg;
bool verbose;
} RDebug;
typedef struct r_debug_desc_plugin_t {