mirror of
https://github.com/radareorg/radare2.git
synced 2024-12-01 17:40:34 +00:00
Add CCf*
This commit is contained in:
parent
59362823d4
commit
1f14da28d5
@ -700,12 +700,8 @@ static int meta_print_item(void *user, const char *k, const char *v) {
|
||||
if (!meta_deserialize (&it, k, v)) {
|
||||
return 1;
|
||||
}
|
||||
int uirad = ui->rad;
|
||||
if (ui->rad == 'f') {
|
||||
if (!r_anal_fcn_in (ui->fcn, it.from)) {
|
||||
goto beach;
|
||||
}
|
||||
ui->rad = 0;
|
||||
if (ui->fcn && !r_anal_fcn_in (ui->fcn, it.from)) {
|
||||
goto beach;
|
||||
}
|
||||
if (!it.str) {
|
||||
it.str = strdup (""); // don't break in free
|
||||
@ -716,19 +712,26 @@ static int meta_print_item(void *user, const char *k, const char *v) {
|
||||
r_meta_print (ui->anal, &it, ui->rad, true);
|
||||
beach:
|
||||
free (it.str);
|
||||
ui->rad = uirad;
|
||||
return 1;
|
||||
}
|
||||
|
||||
R_API int r_meta_list_cb(RAnal *a, int type, int rad, SdbForeachCallback cb, void *user, ut64 addr) {
|
||||
RAnalFunction *fcn = (addr != UT64_MAX) ? r_anal_get_fcn_at (a, addr, 0) : NULL;
|
||||
RAnalMetaUserItem ui = { a, type, rad, cb, user, 0, fcn};
|
||||
SdbList *ls = sdb_foreach_list (DB, true);
|
||||
SdbListIter *lsi;
|
||||
SdbKv *kv;
|
||||
if (rad == 'j') {
|
||||
a->cb_printf ("[");
|
||||
}
|
||||
|
||||
RAnalMetaUserItem ui = { a, type, rad, cb, user, 0, NULL };
|
||||
|
||||
if (addr != UT64_MAX) {
|
||||
ui.fcn = r_anal_get_fcn_in (a, addr, 0);
|
||||
if (!ui.fcn) {
|
||||
goto beach;
|
||||
}
|
||||
}
|
||||
|
||||
SdbList *ls = sdb_foreach_list (DB, true);
|
||||
SdbListIter *lsi;
|
||||
SdbKv *kv;
|
||||
isFirst = true; // TODO: kill global
|
||||
ls_foreach (ls, lsi, kv) {
|
||||
if (type == R_META_TYPE_ANY || (strlen (sdbkv_key (kv)) > 5 && sdbkv_key (kv)[5] == type)) {
|
||||
@ -740,6 +743,8 @@ R_API int r_meta_list_cb(RAnal *a, int type, int rad, SdbForeachCallback cb, voi
|
||||
}
|
||||
}
|
||||
ls_free (ls);
|
||||
|
||||
beach:
|
||||
if (rad == 'j') {
|
||||
a->cb_printf ("]\n");
|
||||
}
|
||||
|
@ -388,8 +388,11 @@ static int cmd_meta_comment(RCore *core, const char *input) {
|
||||
case 'j': // "CCfj"
|
||||
r_meta_list_at (core->anal, R_META_TYPE_COMMENT, 'j', core->offset);
|
||||
break;
|
||||
case '*': // "CCf*"
|
||||
r_meta_list_at (core->anal, R_META_TYPE_COMMENT, 1, core->offset);
|
||||
break;
|
||||
default:
|
||||
r_meta_list_at (core->anal, R_META_TYPE_COMMENT, 'f', core->offset);
|
||||
r_meta_list_at (core->anal, R_META_TYPE_COMMENT, 0, core->offset);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user