This commit is contained in:
Álvaro Felipe Melchor 2015-06-15 21:20:44 +02:00 committed by pancake
parent ade56c0fe8
commit b52cfe422e
2 changed files with 25 additions and 21 deletions

View file

@ -1133,6 +1133,10 @@ void cmd_anal_reg(RCore *core, const char *str) {
r_cons_printf ("%s\n", name);
break;
case 'n': // "drn"
if (*(str+1) == '\0'){
eprintf ("Oops. try drn [pc|sp|bp|a0|a1|a2|a3|zf|sf|nf|of]\n");
break;
}
name = r_reg_get_name (core->dbg->reg, r_reg_get_name_idx (str+2));
if (name && *name)
r_cons_printf ("%s\n", name);

View file

@ -23,27 +23,27 @@ static void r_reg_item_free(RRegItem *item) {
}
R_API int r_reg_get_name_idx(const char *type) {
if (type)
switch (*type | (type[1]<<8)) {
/* flags */
case 'z'+('f'<<8): return R_REG_NAME_ZF;
case 's'+('f'<<8): return R_REG_NAME_SF;
case 'c'+('f'<<8): return R_REG_NAME_CF;
case 'o'+('f'<<8): return R_REG_NAME_OF;
/* gpr */
case 'p'+('c'<<8): return R_REG_NAME_PC;
case 's'+('r'<<8): return R_REG_NAME_SR;
case 's'+('p'<<8): return R_REG_NAME_SP;
case 'b'+('p'<<8): return R_REG_NAME_BP;
case 's'+('n'<<8): return R_REG_NAME_SN;
/* args */
case 'a'+('0'<<8): return R_REG_NAME_A0;
case 'a'+('1'<<8): return R_REG_NAME_A1;
case 'a'+('2'<<8): return R_REG_NAME_A2;
case 'a'+('3'<<8): return R_REG_NAME_A3;
case 'a'+('4'<<8): return R_REG_NAME_A4;
case 'a'+('5'<<8): return R_REG_NAME_A5;
case 'a'+('6'<<8): return R_REG_NAME_A6;
if (type && *type != '\0')
switch (*type | (type[1]<<8)) {
/* flags */
case 'z'+('f'<<8): return R_REG_NAME_ZF;
case 's'+('f'<<8): return R_REG_NAME_SF;
case 'c'+('f'<<8): return R_REG_NAME_CF;
case 'o'+('f'<<8): return R_REG_NAME_OF;
/* gpr */
case 'p'+('c'<<8): return R_REG_NAME_PC;
case 's'+('r'<<8): return R_REG_NAME_SR;
case 's'+('p'<<8): return R_REG_NAME_SP;
case 'b'+('p'<<8): return R_REG_NAME_BP;
case 's'+('n'<<8): return R_REG_NAME_SN;
/* args */
case 'a'+('0'<<8): return R_REG_NAME_A0;
case 'a'+('1'<<8): return R_REG_NAME_A1;
case 'a'+('2'<<8): return R_REG_NAME_A2;
case 'a'+('3'<<8): return R_REG_NAME_A3;
case 'a'+('4'<<8): return R_REG_NAME_A4;
case 'a'+('5'<<8): return R_REG_NAME_A5;
case 'a'+('6'<<8): return R_REG_NAME_A6;
}
return -1;
}