diff --git a/libr/core/disasm.c b/libr/core/disasm.c index bf5bc8a399..8fc0bef092 100644 --- a/libr/core/disasm.c +++ b/libr/core/disasm.c @@ -439,17 +439,6 @@ static void ds_comment_lineup(RDisasmState *ds) { _ALIGN; } -static void ds_begin_comment(RDisasmState *ds) { - if (ds->show_comment_right) { - _ALIGN; - } else { - if (ds->use_json) { - ds_begin_json_line (ds); - } - ds_pre_xrefs (ds, false); - } -} - static void ds_comment_(RDisasmState *ds, bool align, bool nl, const char *format, va_list ap) { if (ds->show_comments) { if (ds->show_comment_right && align) { @@ -1099,18 +1088,6 @@ static void ds_newline(RDisasmState *ds) { } } -static void ds_pre_xrefs(RDisasmState *ds, bool no_fcnlines) { - ds_setup_pre (ds, false, false); - if (ds->pre != DS_PRE_NONE && ds->pre != DS_PRE_EMPTY) { - ds->pre = no_fcnlines ? DS_PRE_EMPTY : DS_PRE_FCN_MIDDLE; - } - ds_print_pre (ds); - char *tmp = ds->line; - ds->line = ds->refline2; - ds_print_lines_left (ds); - ds->line = tmp; -} - static void ds_show_refs(RDisasmState *ds) { RAnalRef *ref; RListIter *iter; @@ -1405,6 +1382,32 @@ static void ds_print_show_cursor(RDisasmState *ds) { r_cons_strcat (res); } +static void ds_pre_xrefs(RDisasmState *ds, bool no_fcnlines) { + ds_setup_pre (ds, false, false); + if (ds->pre != DS_PRE_NONE && ds->pre != DS_PRE_EMPTY) { + ds->pre = no_fcnlines ? DS_PRE_EMPTY : DS_PRE_FCN_MIDDLE; + } + ds_print_pre (ds); + char *tmp = ds->line; + ds->line = ds->refline2; + ds_print_lines_left (ds); + if (!ds->show_offset && ds->show_marks) { + ds_print_show_cursor (ds); + } + ds->line = tmp; +} + +static void ds_begin_comment(RDisasmState *ds) { + if (ds->show_comment_right) { + _ALIGN; + } else { + if (ds->use_json) { + ds_begin_json_line (ds); + } + ds_pre_xrefs (ds, false); + } +} + static int var_comparator(const RAnalVar *a, const RAnalVar *b){ if (a && b) { return a->delta > b->delta; @@ -1703,11 +1706,10 @@ beach: idx = 0; } spaces[idx] = 0; - ds_setup_print_pre (ds, false, true); + ds_pre_xrefs (ds, false); tmp = ds->line; ds->line = ds->refline2; - ds_print_lines_left (ds); ds->line = tmp; if (ds->show_flgoff) { @@ -1902,11 +1904,7 @@ static void ds_show_comments_right(RDisasmState *ds) { } free (p); } else { - if (ds->show_comment_right) { - _ALIGN; - } else { - ds_pre_xrefs (ds, false); - } + ds_pre_xrefs (ds, false); if (ds->show_color) { r_cons_strcat (ds->color_usrcmt); } @@ -1983,10 +1981,14 @@ static void ds_show_flags(RDisasmState *ds) { } ds_begin_json_line (ds); + + bool fake_flag_marks = (!ds->show_offset && ds->show_marks); if (ds->show_flgoff) { ds_beginline (ds); ds_print_offset (ds); - r_cons_printf (" "); + if (!fake_flag_marks) { + r_cons_printf (" "); + } } else { bool no_fcn_lines = (f && f->addr == flag->offset); ds_pre_xrefs (ds, no_fcn_lines); @@ -2008,7 +2010,7 @@ static void ds_show_flags(RDisasmState *ds) { } } - if (!ds->show_flgoff) { + if (!ds->show_flgoff || fake_flag_marks) { r_cons_printf (";-- "); }