Fix pdJ for cmt.right=1 + pseudo=1

This commit is contained in:
Florian Märkl 2019-03-06 14:48:05 +01:00
parent 42f846b42c
commit d63d4f2283

View File

@ -3092,44 +3092,42 @@ static void ds_print_sysregs(RDisasmState *ds) {
}
static void ds_print_fcn_name(RDisasmState *ds) {
int delta;
const char *label;
RAnalFunction *f;
RCore *core = ds->core;
if (!ds->show_comments) {
return;
}
switch (ds->analop.type) {
case R_ANAL_OP_TYPE_JMP:
case R_ANAL_OP_TYPE_CJMP:
case R_ANAL_OP_TYPE_CALL:
// f = r_anal_get_fcn_in (core->anal, ds->analop.jump, R_ANAL_FCN_TYPE_NULL);
f = fcnIn (ds, ds->analop.jump, R_ANAL_FCN_TYPE_NULL);
if (f && f->name && ds->opstr && !strstr (ds->opstr, f->name)) {
// print label
delta = ds->analop.jump - f->addr;
label = r_anal_fcn_label_at (core->anal, f, ds->analop.jump);
if (!ds->show_comment_right) {
ds_begin_line (ds);
}
if (label) {
_ALIGN;
ds_comment (ds, true, "; %s.%s", f->name, label);
} else {
RAnalFunction *f2 = fcnIn (ds, ds->at, 0); //r_anal_get_fcn_in (core->anal, ds->at, 0);
if (f != f2) {
_ALIGN;
if (delta > 0) {
ds_comment (ds, true, "; %s+0x%x", f->name, delta);
} else if (delta < 0) {
ds_comment (ds, true, "; %s-0x%x", f->name, -delta);
} else {
ds_comment (ds, true, "; %s", f->name);
}
}
}
if (ds->analop.type != R_ANAL_OP_TYPE_JMP
&& ds->analop.type != R_ANAL_OP_TYPE_CJMP
&& ds->analop.type != R_ANAL_OP_TYPE_CALL) {
return;
}
RAnalFunction *f = fcnIn (ds, ds->analop.jump, R_ANAL_FCN_TYPE_NULL);
if (!f || !f->name || !ds->opstr || strstr (ds->opstr, f->name)) {
return;
}
st64 delta = ds->analop.jump - f->addr;
const char *label = r_anal_fcn_label_at (ds->core->anal, f, ds->analop.jump);
if (label) {
if (!ds->show_comment_right) {
ds_begin_line (ds);
}
_ALIGN;
ds_comment (ds, true, "; %s.%s", f->name, label);
} else {
RAnalFunction *f2 = fcnIn (ds, ds->at, 0);
if (f == f2) {
return;
}
if (!ds->show_comment_right) {
ds_begin_line (ds);
}
_ALIGN;
if (delta > 0) {
ds_comment (ds, true, "; %s+0x%x", f->name, delta);
} else if (delta < 0) {
ds_comment (ds, true, "; %s-0x%x", f->name, -delta);
} else {
ds_comment (ds, true, "; %s", f->name);
}
break;
}
}