Improve the graphviz output for traced bbs ##graph

This commit is contained in:
pancake 2019-04-25 02:22:38 +02:00 committed by radare
parent 599bee4d1e
commit c7b02c8293
8 changed files with 17 additions and 10 deletions

View File

@ -17,6 +17,7 @@ ec fline rgb:55b4d4 # function line. the boundary of a function
ec flow rgb:c2d94c # lines that show jump destinations
ec flow2 rgb:ddd
ec fname rgb:ff6a00 # function name
ec graph.traced rgb:2eb
ec graph.box rgb:5c6773 # unselected boxes in visual graph mode
ec graph.box2 rgb:ff6a00 # currently selected box in visual graph mode
ec graph.box3 rgb:66d9ef

View File

@ -1445,6 +1445,7 @@ static int core_anal_graph_nodes(RCore *core, RAnalFunction *fcn, int opts, PJ *
: (current && color_current)
? pal_curr
: pal_box4;
const char *fill_color = (current || label_color == pal_traced)? pal_traced: "white";
nodes++;
//r_cons_printf (" \"0x%08"PFMT64x"_0x%08"PFMT64x"\" ["
// "URL=\"%s/0x%08"PFMT64x"\", color=\"%s\", label=\"%s\"]\n",
@ -1456,7 +1457,7 @@ static int core_anal_graph_nodes(RCore *core, RAnalFunction *fcn, int opts, PJ *
"color=\"%s\", fontname=\"%s\","
"label=\"%s\"]\n",
bbi->addr, fcn->name, bbi->addr,
current? "palegreen": "white", label_color, font, str);
fill_color, label_color, font, str);
}
}
free (str);
@ -1974,7 +1975,7 @@ R_API void r_core_anal_callgraph(RCore *core, ut64 addr, int fmt) {
gv_edge = "arrowhead=\"normal\" style=bold weight=2";
}
if (!gv_node || !*gv_node) {
gv_node = "fillcolor=white style=filled fontname=\"Courier New Bold\" fontsize=14 shape=box";
gv_node = "penwidth=4 fillcolor=white style=filled fontname=\"Courier New Bold\" fontsize=14 shape=box";
}
if (!gv_grph || !*gv_grph) {
gv_grph = "bgcolor=azure";

View File

@ -8102,7 +8102,6 @@ static int cmd_anal_all(RCore *core, const char *input) {
oldstr = r_print_rowlog (core->print, "Finding function preludes");
(void)r_core_search_preludes (core, false); // "aap"
r_print_rowlog_done (core->print, oldstr);
///
}
oldstr = r_print_rowlog (core->print, "Enable constraint types analysis for variables");
r_config_set (core->config, "anal.types.constraint", "true");

View File

@ -909,7 +909,6 @@ R_API RList *r_core_get_boundaries_prot(RCore *core, int perm, const char *mode,
}
}
} else {
// if (!strcmp (mode, "raw")) {
/* obey temporary seek if defined '/x 8080 @ addr:len' */
if (core->tmpseek) {
append_bound (list, core->io, search_itv, core->offset, core->blocksize, 5);

View File

@ -2534,8 +2534,9 @@ R_API bool r_core_init(RCore *core) {
r_anal_set_user_ptr (core->anal, core);
core->anal->cb_printf = (void *) r_cons_printf;
core->parser = r_parse_new ();
core->parser->anal = core->anal;
r_anal_bind (core->anal, &(core->parser->analb));
core->parser->varlist = r_anal_var_list;
/// XXX shouhld be using coreb
r_parse_set_user_ptr (core->parser, core);
core->bin = r_bin_new ();
core->bin->cb_printf = (PrintfCallback) r_cons_printf;

View File

@ -1,4 +1,4 @@
/* radare - LGPL - Copyright 2009-2018 - pancake */
/* radare - LGPL - Copyright 2009-2019 - pancake */
#include <r_core.h>
#include <r_util.h>
@ -1277,12 +1277,14 @@ R_API int r_core_visual_view_rop(RCore *core) {
char *ropstr = r_core_cmd_strf (core, "\"/Rl %s\" @e:scr.color=0", line);
RList *rops = r_str_split_list (ropstr, "\n");
int delta = 0;
bool show_color = core->print->flags & R_PRINT_FLAGS_COLOR;
bool forceaddr = false;
ut64 addr = UT64_MAX;
char *cursearch = strdup (line);
while (true) {
r_cons_clear00 ();
r_cons_printf ("[0x%08"PFMT64x"]-[visual-r2rop] %s\n", addr + delta, cursearch);
r_cons_printf ("[0x%08"PFMT64x"]-[visual-r2rop] %s (see pdp command)\n",
(addr == UT64_MAX)? 0: addr + delta, cursearch);
// compute chain
RStrBuf *sb = r_strbuf_new ("");

View File

@ -1,4 +1,4 @@
/* radare2 - LGPL - Copyright 2009-2018 - nibble, pancake, maijin */
/* radare2 - LGPL - Copyright 2009-2019 - nibble, pancake, maijin */
#include <stdio.h>
@ -80,7 +80,7 @@ R_API int r_parse_assemble(RParse *p, char *data, char *str) {
}
if (s) {
str = s + 1;
o = o + strlen (data);
o += strlen (data);
o[0] = '\n';
o[1] = '\0';
o++;
@ -91,6 +91,8 @@ R_API int r_parse_assemble(RParse *p, char *data, char *str) {
return ret;
}
// parse 'data' and generate pseudocode disassemble in 'str'
// TODO: refactooring, this should return char * instead
R_API int r_parse_parse(RParse *p, const char *data, char *str) {
if (p->cur && p->cur->parse) {
return p->cur->parse (p, data, str);
@ -619,6 +621,8 @@ R_API char *r_parse_immtrim(char *opstr) {
return opstr;
}
/// filter the opcode in data into str by following the flags and hints information
// XXX this function have too many parameters, we need to simplify this
R_API int r_parse_filter(RParse *p, ut64 addr, RFlag *f, RAnalHint *hint, char *data, char *str, int len, bool big_endian) {
filter (p, addr, f, hint, data, str, len, big_endian);
if (p->cur && p->cur->filter) {

View File

@ -1,4 +1,4 @@
/* radare - LGPL - Copyright 2007-2018 - pancake */
/* radare - LGPL - Copyright 2007-2019 - pancake */
#include "r_types.h"
#include "r_util.h"