mirror of
https://github.com/radareorg/radare2.git
synced 2025-02-01 11:11:56 +00:00
Fix #6060 - Add Cr command to run commands in meta for disasm
This commit is contained in:
parent
babfd7e10a
commit
b04e1f2c4c
@ -250,11 +250,13 @@ R_API int r_meta_add(RAnal *a, int type, ut64 from, ut64 to, const char *str) {
|
||||
int space_idx = a->meta_spaces.space_idx;
|
||||
char *e_str, key[100], val[2048];
|
||||
int exists;
|
||||
if (from > to)
|
||||
if (from > to) {
|
||||
return false;
|
||||
if (from == to)
|
||||
}
|
||||
if (from == to) {
|
||||
to = from + 1;
|
||||
if (type == 100 && (to-from)<1) {
|
||||
}
|
||||
if (type == 100 && (to - from) < 1) {
|
||||
return false;
|
||||
}
|
||||
/* set entry */
|
||||
|
@ -64,38 +64,34 @@ static int print_addrinfo (void *user, const char *k, const char *v) {
|
||||
char *colonpos, *subst;
|
||||
|
||||
offset = sdb_atoi (v);
|
||||
if (!offset)
|
||||
if (!offset) {
|
||||
return true;
|
||||
|
||||
}
|
||||
subst = strdup (k);
|
||||
colonpos = strchr (subst, '|');
|
||||
|
||||
if (colonpos)
|
||||
if (colonpos) {
|
||||
*colonpos = ':';
|
||||
|
||||
}
|
||||
r_cons_printf ("CL %s %s\n", subst, v);
|
||||
|
||||
free (subst);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static int cmd_meta_add_fileline(Sdb *s, char *fileline, ut64 offset) {
|
||||
char aoffset[64], *aoffsetptr;
|
||||
char aoffset[64];
|
||||
char *aoffsetptr = sdb_itoa (offset, aoffset, 16);
|
||||
|
||||
aoffsetptr = sdb_itoa (offset, aoffset, 16);
|
||||
|
||||
if (!aoffsetptr)
|
||||
if (!aoffsetptr) {
|
||||
return -1;
|
||||
|
||||
}
|
||||
if (!sdb_add (s, aoffsetptr, fileline, 0)) {
|
||||
sdb_set (s, aoffsetptr, fileline, 0);
|
||||
}
|
||||
|
||||
if (!sdb_add (s, fileline, aoffsetptr, 0)) {
|
||||
sdb_set (s, fileline, aoffsetptr, 0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -729,6 +725,7 @@ static int cmd_meta(void *data, const char *input) {
|
||||
case 'C': // "CC"
|
||||
cmd_meta_comment (core, input);
|
||||
break;
|
||||
case 'r': /* Cr run command*/
|
||||
case 'h': /* Ch comment */
|
||||
case 's': /* Cs string */
|
||||
case 'z': /* Cz zero-terminated string */
|
||||
|
@ -1908,6 +1908,12 @@ static int ds_print_meta_infos(RDisasmState *ds, ut8* buf, int len, int idx) {
|
||||
ds->oplen = mi->size;
|
||||
ds->mi_found = 1;
|
||||
break;
|
||||
case R_META_TYPE_RUN:
|
||||
r_core_cmdf (core, "%s @ 0x%"PFMT64x, mi->str, ds->at);
|
||||
ds->asmop.size = mi->size;
|
||||
ds->oplen = mi->size;
|
||||
ds->mi_found = 1;
|
||||
break;
|
||||
case R_META_TYPE_DATA:
|
||||
hexlen = len - idx;
|
||||
delta = ds->at-mi->from;
|
||||
|
@ -311,6 +311,7 @@ enum {
|
||||
R_META_TYPE_MAGIC = 'm',
|
||||
R_META_TYPE_HIDE = 'h',
|
||||
R_META_TYPE_COMMENT = 'C',
|
||||
R_META_TYPE_RUN = 'r',
|
||||
};
|
||||
|
||||
// anal
|
||||
|
Loading…
x
Reference in New Issue
Block a user