mirror of
https://github.com/radareorg/radare2.git
synced 2025-02-26 09:06:02 +00:00
Initial working implementation of =RS
This commit is contained in:
parent
4bb90e2399
commit
3231c0d585
@ -4378,6 +4378,10 @@ static void __anal_reg_list(RCore *core, int type, int bits, char mode) {
|
||||
if (!strcmp (core->anal->cur->arch, "arm") && bits == 16) {
|
||||
bits = 32;
|
||||
}
|
||||
int defsz = r_reg_default_bits (core->anal->reg);
|
||||
if (defsz) {
|
||||
bits = defsz;
|
||||
}
|
||||
/* workaround for 6502 and avr*/
|
||||
if ((!strcmp (core->anal->cur->arch, "6502") && bits == 8)
|
||||
|| (!strcmp (core->anal->cur->arch, "avr") && bits == 8)) {
|
||||
|
@ -1218,7 +1218,13 @@ static int grab_bits(RCore *core, const char *arg, int *pcbits2) {
|
||||
*pcbits2 = 0;
|
||||
}
|
||||
if (pcbits < 1) {
|
||||
if (!strcmp (r_config_get (core->config, "asm.arch"), "avr")) {
|
||||
int rpbits = r_reg_default_bits (core->anal->reg);
|
||||
if (rpbits) {
|
||||
pcbits = rpbits;
|
||||
if (pcbits2) {
|
||||
*pcbits2 = 32;
|
||||
}
|
||||
} else if (!strcmp (r_config_get (core->config, "asm.arch"), "avr")) {
|
||||
pcbits = 8;
|
||||
if (pcbits2) {
|
||||
*pcbits2 = 32;
|
||||
@ -2943,8 +2949,9 @@ static void cmd_debug_reg(RCore *core, const char *str) {
|
||||
} else {
|
||||
RReg *orig = core->dbg->reg;
|
||||
core->dbg->reg = core->anal->reg;
|
||||
if (pcbits && pcbits != bits)
|
||||
if (pcbits && pcbits != bits) {
|
||||
r_debug_reg_list (core->dbg, R_REG_TYPE_GPR, pcbits, NULL, '=', use_color); // xxx detect which one is current usage
|
||||
}
|
||||
r_debug_reg_list (core->dbg, R_REG_TYPE_GPR, bits, NULL, '=', use_color); // xxx detect which one is current usage
|
||||
core->dbg->reg = orig;
|
||||
}
|
||||
|
@ -213,6 +213,7 @@ R_API int r_reg_set_pack(RReg *reg, RRegItem *item, int packidx, int packbits, u
|
||||
R_API ut64 r_reg_get_pack(RReg *reg, RRegItem *item, int packidx, int packbits);
|
||||
|
||||
/* byte arena */
|
||||
R_API int r_reg_default_bits(RReg *reg);
|
||||
R_API ut8 *r_reg_get_bytes(RReg *reg, int type, int *size);
|
||||
R_API bool r_reg_set_bytes(RReg *reg, int type, const ut8 *buf, const int len);
|
||||
R_API bool r_reg_read_regs(RReg *reg, ut8 *buf, const int len);
|
||||
|
@ -207,7 +207,7 @@ R_API bool r_reg_set_profile_string(RReg *reg, const char *str) {
|
||||
char *first = tok[0];
|
||||
// Check whether it's defining an alias or a register
|
||||
if (!strncmp (first, "=RS", 3)) {
|
||||
reg->bits_default = atoi (first + 3);
|
||||
reg->bits_default = atoi (tok[1]);
|
||||
// Clean up
|
||||
for (i = 0; i < j; i++) {
|
||||
free (tok[i]);
|
||||
|
@ -72,6 +72,10 @@ R_API const char *r_reg_get_name_by_type(RReg *reg, const char *alias_name) {
|
||||
return (n != -1)? r_reg_get_name (reg, n): NULL;
|
||||
}
|
||||
|
||||
R_API int r_reg_default_bits(RReg *reg) {
|
||||
return reg->bits_default;
|
||||
}
|
||||
|
||||
R_API int r_reg_type_by_name(const char *str) {
|
||||
r_return_val_if_fail (str, -1);
|
||||
int i;
|
||||
|
Loading…
x
Reference in New Issue
Block a user