Skip to content

Commit

Permalink
Honor Register aliases in RReg.get
Browse files Browse the repository at this point in the history
  • Loading branch information
radare authored and trufae committed Dec 27, 2024
1 parent 70135d3 commit de46f7f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
6 changes: 4 additions & 2 deletions libr/debug/dsession.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,10 @@ R_API bool r_debug_add_checkpoint(RDebug *dbg) {

// Add PC register change so we can check for breakpoints when continue [back]
RRegItem *ripc = r_reg_get (dbg->reg, "PC", R_REG_TYPE_GPR);
ut64 data = r_reg_get_value (dbg->reg, ripc);
r_debug_session_add_reg_change (dbg->session, ripc->arena, ripc->offset, data);
if (ripc) {
ut64 data = r_reg_get_value (dbg->reg, ripc);
r_debug_session_add_reg_change (dbg->session, ripc->arena, ripc->offset, data);
}

return true;
}
Expand Down
17 changes: 7 additions & 10 deletions libr/reg/reg.c
Original file line number Diff line number Diff line change
Expand Up @@ -469,19 +469,16 @@ R_API ut64 r_reg_getv(RReg *reg, const char *name) {
R_API RRegItem *r_reg_get(RReg *reg, const char *name, int type) {
int i, e;
R_RETURN_VAL_IF_FAIL (reg && name, NULL);
int alias = r_reg_alias_fromstring (name);
if (alias != -1) {
const char *nname = r_reg_alias_getname (reg, alias);
if (nname) {
name = nname;
}
}
if (type == -1) {
i = 0;
e = R_REG_TYPE_LAST;
int alias = r_reg_alias_fromstring (name);
#if 1
// probably redundant code
if (alias != -1) {
const char *nname = r_reg_alias_getname (reg, alias);
if (nname) {
name = nname;
}
}
#endif
} else {
// TODO: define flag register as R_REG_TYPE_FLG
i = (type == R_REG_TYPE_FLG)? R_REG_TYPE_GPR: type;
Expand Down

0 comments on commit de46f7f

Please sign in to comment.