mirror of
https://github.com/radareorg/radare2.git
synced 2025-01-22 13:51:30 +00:00
Fix #1698 - dr rflags=cpz is now supported
This commit is contained in:
parent
ea725dd685
commit
b7e1dc4354
@ -797,16 +797,25 @@ free (rf);
|
||||
regname = r_reg_get_name (core->dbg->reg,
|
||||
r_reg_get_name_idx (string));
|
||||
if (!regname)
|
||||
regname= string;
|
||||
regname = string;
|
||||
r = r_reg_get (core->dbg->reg, regname, -1); //R_REG_TYPE_GPR);
|
||||
if (r) {
|
||||
r_cons_printf ("0x%08"PFMT64x" ->", str,
|
||||
r_reg_get_value (core->dbg->reg, r));
|
||||
r_reg_set_value (core->dbg->reg, r,
|
||||
r_num_math (core->num, arg+1));
|
||||
r_debug_reg_sync (core->dbg, -1, R_TRUE);
|
||||
r_cons_printf ("0x%08"PFMT64x"\n",
|
||||
r_reg_get_value (core->dbg->reg, r));
|
||||
if (r->flags) {
|
||||
r_cons_printf ("0x%08"PFMT64x" ->",
|
||||
r_reg_get_value (core->dbg->reg, r));
|
||||
r_reg_set_bvalue (core->dbg->reg, r, arg+1);
|
||||
r_debug_reg_sync (core->dbg, -1, R_TRUE);
|
||||
r_cons_printf ("0x%08"PFMT64x"\n",
|
||||
r_reg_get_value (core->dbg->reg, r));
|
||||
} else {
|
||||
r_cons_printf ("0x%08"PFMT64x" ->", str,
|
||||
r_reg_get_value (core->dbg->reg, r));
|
||||
r_reg_set_value (core->dbg->reg, r,
|
||||
r_num_math (core->num, arg+1));
|
||||
r_debug_reg_sync (core->dbg, -1, R_TRUE);
|
||||
r_cons_printf ("0x%08"PFMT64x"\n",
|
||||
r_reg_get_value (core->dbg->reg, r));
|
||||
}
|
||||
} else eprintf ("Unknown register '%s'\n", string);
|
||||
free (string);
|
||||
return;
|
||||
|
@ -136,6 +136,7 @@ R_API float r_reg_get_fvalue(RReg *reg, RRegItem *item);
|
||||
R_API int r_reg_set_fvalue(RReg *reg, RRegItem *item, float value);
|
||||
R_API ut64 r_reg_get_pvalue(RReg *reg, RRegItem *item, int packidx);
|
||||
R_API char *r_reg_get_bvalue(RReg *reg, RRegItem *item);
|
||||
R_API ut64 r_reg_set_bvalue(RReg *reg, RRegItem *item, const char *str);
|
||||
R_API int r_reg_set_pvalue(RReg *reg, RRegItem *item, ut64 value, int packidx);
|
||||
|
||||
/* byte arena */
|
||||
|
@ -382,6 +382,7 @@ R_API int r_str_split(char *str, char ch);
|
||||
R_API char* r_str_replace(char *str, const char *key, const char *val, int g);
|
||||
#define r_str_cpy(x,y) memmove(x,y,strlen(y)+1);
|
||||
R_API int r_str_bits (char *strout, const ut8 *buf, int len, const char *bitz);
|
||||
R_API ut64 r_str_bits_from_string(const char *buf, const char *bitz);
|
||||
R_API int r_str_rwx(const char *str);
|
||||
R_API int r_str_replace_char (char *s, int a, int b);
|
||||
R_API const char *r_str_rwx_i(int rwx);
|
||||
|
@ -122,6 +122,17 @@ R_API int r_reg_set_value(RReg *reg, RRegItem *item, ut64 value) {
|
||||
return R_FALSE;
|
||||
}
|
||||
|
||||
R_API ut64 r_reg_set_bvalue(RReg *reg, RRegItem *item, const char *str) {
|
||||
ut64 num;
|
||||
if (!item->flags)
|
||||
return UT64_MAX;
|
||||
num = r_str_bits_from_string (str, item->flags);
|
||||
if (num == UT64_MAX)
|
||||
r_reg_set_value (reg, item, r_num_math (NULL, str));
|
||||
else r_reg_set_value (reg, item, num);
|
||||
return num;
|
||||
}
|
||||
|
||||
R_API char *r_reg_get_bvalue(RReg *reg, RRegItem *item) {
|
||||
char *out;
|
||||
ut64 num;
|
||||
|
@ -118,28 +118,21 @@ R_API int r_str_bits (char *strout, const ut8 *buf, int len, const char *bitz) {
|
||||
* function: r_str_bits_from_num
|
||||
*
|
||||
*/
|
||||
#if 0
|
||||
R_API ut64 r_str_bits_from_string(const char *buf, int len, const char *bitz) {
|
||||
R_API ut64 r_str_bits_from_string(const char *buf, const char *bitz) {
|
||||
ut64 out = 0LL;
|
||||
/* return the numberic value associated to a string (rflags) */
|
||||
int i, j;
|
||||
if (bitz) {
|
||||
for (i=j=0; i<len && (!bitz||bitz[i]); i++) {
|
||||
if (i>0 && (i%8)==0)
|
||||
buf++;
|
||||
if (*buf&(1<<(i%8)))
|
||||
strout[j++] = toupper (bitz[i]);
|
||||
}
|
||||
} else {
|
||||
for (i=j=0; i<len; i++) {
|
||||
if (i>0 && (i%8)==0)
|
||||
buf++;
|
||||
strout[j++] = (*buf&(1<<(7-(i%8))))?'1':'0';
|
||||
for (; *buf; buf++) {
|
||||
char *ch = strchr (bitz, toupper (*buf));
|
||||
if (!ch) ch = strchr (bitz, tolower (*buf));
|
||||
if (ch) {
|
||||
int bit = (int)(size_t)(ch - bitz);
|
||||
out |= (ut64)(1LL << bit);
|
||||
} else {
|
||||
return UT64_MAX;
|
||||
}
|
||||
}
|
||||
strout[j] = 0;
|
||||
return j;
|
||||
return out;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* int c; ret = hex2int(&c, 'c'); */
|
||||
static int hex2int (ut8 *val, ut8 c) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user