diff --git a/libr/debug/dsession.c b/libr/debug/dsession.c index e40a842f2d2cb..001269faf7c68 100644 --- a/libr/debug/dsession.c +++ b/libr/debug/dsession.c @@ -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; } diff --git a/libr/reg/reg.c b/libr/reg/reg.c index 8255f0569811b..62dd683cbe941 100644 --- a/libr/reg/reg.c +++ b/libr/reg/reg.c @@ -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;