Improve pf visualization via Cf in pd ##disasm

This commit is contained in:
radare 2019-03-31 21:43:19 +02:00 committed by GitHub
parent f8dec83968
commit b0141ba809
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 14 deletions

View File

@ -311,7 +311,6 @@ static void ds_print_offset(RDisasmState *ds);
static void ds_print_op_size(RDisasmState *ds);
static void ds_print_trace(RDisasmState *ds);
static void ds_adistrick_comments(RDisasmState *ds);
static int ds_print_meta_infos(RDisasmState *ds, ut8* buf, int len, int idx );
static void ds_print_opstr(RDisasmState *ds);
static void ds_print_color_reset(RDisasmState *ds);
static int ds_print_middle(RDisasmState *ds, int ret);
@ -2622,6 +2621,7 @@ static int ds_print_meta_infos(RDisasmState *ds, ut8* buf, int len, int idx) {
int hexlen;
int delta;
if (mi) {
ret = mi->type;
switch (mi->type) {
case R_META_TYPE_STRING:
{
@ -2683,17 +2683,17 @@ static int ds_print_meta_infos(RDisasmState *ds, ut8* buf, int len, int idx) {
}
core->inc = 16; // ds->oplen; //
core->print->flags |= R_PRINT_FLAGS_HEADER;
ds->asmop.size = ret = (int)mi->size; //-delta;
ds->asmop.size = (int)mi->size;
R_FREE (ds->line);
R_FREE (ds->refline);
R_FREE (ds->refline2);
ds->mi_found = true;
break;
case R_META_TYPE_FORMAT:
r_cons_printf ("format %s {\n", mi->str);
r_print_format (core->print, ds->at, buf+idx, len-idx, mi->str, R_PRINT_MUSTSEE, NULL, NULL);
r_cons_printf ("} %d", mi->size);
ds->oplen = ds->asmop.size = ret = (int)mi->size;
r_cons_printf ("pf %s # size=%d\n", mi->str, mi->size);
r_print_format (core->print, ds->at, buf + idx,
len - idx, mi->str, R_PRINT_MUSTSEE, NULL, NULL);
ds->oplen = ds->asmop.size = (int)mi->size;
R_FREE (ds->line);
R_FREE (ds->refline);
R_FREE (ds->refline2);
@ -5011,7 +5011,7 @@ toro:
ds_print_cycles (ds);
ds_print_family (ds);
ds_print_stackptr (ds);
ret = ds_print_meta_infos (ds, buf, len, idx);
int miType = ds_print_meta_infos (ds, buf, len, idx);
if (ds->mi_found) {
ds_print_dwarf (ds);
ret = ds_print_middle (ds, ret);
@ -5025,13 +5025,22 @@ toro:
len - addrbytes * idx + 5);
r_asm_set_syntax (core->assembler, os);
}
if (ds->asm_hint_pos > 0) {
ds_print_core_vmode (ds, ds->asm_hint_pos);
if (miType == R_META_TYPE_FORMAT) {
if ((ds->show_comments || ds->show_usercomments) && ds->show_comment_right) {
// haveMeta = false;
}
}
ds_end_line_highlight (ds);
if ((ds->show_comments || ds->show_usercomments) && ds->show_comment_right) {
ds_print_color_reset (ds);
ds_print_comments_right (ds);
if (miType != R_META_TYPE_FORMAT) {
if (ds->asm_hint_pos > 0) {
ds_print_core_vmode (ds, ds->asm_hint_pos);
}
}
{
ds_end_line_highlight (ds);
if ((ds->show_comments || ds->show_usercomments) && ds->show_comment_right) {
ds_print_color_reset (ds);
ds_print_comments_right (ds);
}
}
} else {
ds->mi_found = false;
@ -5072,7 +5081,9 @@ toro:
}
}
core->print->resetbg = true;
ds_newline (ds);
if (miType != R_META_TYPE_FORMAT) {
ds_newline (ds);
}
if (ds->show_bbline && !ds->bblined && !ds->fcn) {
switch (ds->analop.type) {
case R_ANAL_OP_TYPE_MJMP:

View File

@ -588,6 +588,9 @@ repeat:
" df -> define function\n"
" du -> undefine function\n"
" dc -> define as code\n"
" dw -> define as dword (32bit)\n"
" dw -> define as qword (64bit)\n"
" dd -> define current block or selected bytes as data\n"
" V -> view graph (same as press the 'space' key)\n"
);
ret = r_cons_less_str (r_strbuf_get (p), "?");