mirror of
https://github.com/radareorg/radare2.git
synced 2025-01-27 08:12:44 +00:00
Draw backward lines with up arrow instead of line
This commit is contained in:
parent
2f4586008e
commit
96dbf57b30
@ -43,6 +43,7 @@ static bool add_refline(RList *list, RList *sten, ut64 addr, ut64 to, int *idx)
|
||||
item->to = to;
|
||||
item->index = *idx;
|
||||
item->level = -1;
|
||||
item->direction = (to > addr)? 1: -1;
|
||||
*idx += 1;
|
||||
r_list_append (list, item);
|
||||
|
||||
@ -223,17 +224,17 @@ list_err:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
R_API RList*r_anal_reflines_fcn_get(RAnal *anal, RAnalFunction *fcn, int nlines, int linesout, int linescall) {
|
||||
RList *list;
|
||||
RAnalRefline *item;
|
||||
R_API RList* r_anal_reflines_fcn_get(RAnal *anal, RAnalFunction *fcn, int nlines, int linesout, int linescall) {
|
||||
RAnalBlock *bb;
|
||||
RListIter *bb_iter;
|
||||
|
||||
RAnalRefline *item;
|
||||
int index = 0;
|
||||
ut32 len;
|
||||
|
||||
list = r_list_new ();
|
||||
if (!list) return NULL;
|
||||
RList *list = r_list_new ();
|
||||
if (!list) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* analyze code block */
|
||||
r_list_foreach (fcn->bbs, bb_iter, bb) {
|
||||
@ -255,7 +256,7 @@ R_API RList*r_anal_reflines_fcn_get(RAnal *anal, RAnalFunction *fcn, int nlines,
|
||||
}
|
||||
}
|
||||
// Handles conditonal + unconditional jump
|
||||
if ( (control_type & R_ANAL_BB_TYPE_CJMP) == R_ANAL_BB_TYPE_CJMP) {
|
||||
if ((control_type & R_ANAL_BB_TYPE_CJMP) == R_ANAL_BB_TYPE_CJMP) {
|
||||
// dont need to continue here is opc+len exceed function scope
|
||||
if (linesout && bb->fail > 0LL && bb->fail != bb->addr + len) {
|
||||
item = R_NEW0 (RAnalRefline);
|
||||
@ -266,6 +267,8 @@ R_API RList*r_anal_reflines_fcn_get(RAnal *anal, RAnalFunction *fcn, int nlines,
|
||||
item->from = bb->addr;
|
||||
item->to = bb->fail;
|
||||
item->index = index++;
|
||||
item->type = 'c';
|
||||
item->direction = (bb->jump > bb->addr)? 1: -1;
|
||||
r_list_append (list, item);
|
||||
}
|
||||
}
|
||||
@ -281,11 +284,13 @@ R_API RList*r_anal_reflines_fcn_get(RAnal *anal, RAnalFunction *fcn, int nlines,
|
||||
item->from = bb->addr;
|
||||
item->to = bb->jump;
|
||||
item->index = index++;
|
||||
item->type = 'j';
|
||||
item->direction = (bb->jump > bb->addr)? 1: -1;
|
||||
r_list_append (list, item);
|
||||
continue;
|
||||
}
|
||||
|
||||
// XXX - Todo test handle swith op
|
||||
// XXX - Todo test handle switch op
|
||||
if (control_type & R_ANAL_BB_TYPE_SWITCH) {
|
||||
if (bb->switch_op) {
|
||||
RAnalCaseOp *caseop;
|
||||
@ -336,7 +341,6 @@ static const char* get_corner_char(RAnalRefline *ref, ut64 addr, int is_middle)
|
||||
}
|
||||
return (ref->from > ref->to) ? "`" : ",";
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
@ -434,7 +438,11 @@ R_API char* r_anal_reflines_str(void *_core, ut64 addr, int opts) {
|
||||
continue;
|
||||
}
|
||||
add_spaces (b, ref->level, pos, wide);
|
||||
r_buf_append_string (b, "|");
|
||||
if (ref->direction < 0) {
|
||||
r_buf_append_string (b, "!");
|
||||
} else {
|
||||
r_buf_append_string (b, "|");
|
||||
}
|
||||
pos = ref->level;
|
||||
}
|
||||
if (max_level == -1) {
|
||||
|
@ -811,6 +811,8 @@ typedef struct r_anal_refline_t {
|
||||
ut64 to;
|
||||
int index;
|
||||
int level;
|
||||
int type;
|
||||
int direction;
|
||||
} RAnalRefline;
|
||||
|
||||
typedef struct r_anal_state_type_t {
|
||||
|
Loading…
x
Reference in New Issue
Block a user