From 3099a82256412d50baabd4562e3044f4c8799bb1 Mon Sep 17 00:00:00 2001 From: radare Date: Mon, 16 Mar 2020 13:21:54 +0100 Subject: [PATCH] Hide 128reg warnings and use rgb: instead of # in pal test (#16220) --- libr/core/cmd_anal.c | 4 ++-- libr/reg/reg.c | 8 ++++++-- libr/reg/value.c | 7 +++++++ test/new/db/cmd/cmd_pd | 2 +- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/libr/core/cmd_anal.c b/libr/core/cmd_anal.c index 6f42a9662fef9..80cdb2f0155ac 100644 --- a/libr/core/cmd_anal.c +++ b/libr/core/cmd_anal.c @@ -5474,7 +5474,7 @@ static void cmd_aespc(RCore *core, ut64 addr, ut64 until_addr, int off) { r_reg_setv (core->dbg->reg, "PC", aop.addr + aop.size); const char *e = R_STRBUF_SAFEGET (&aop.esil); if (e && *e) { - eprintf (" 0x%08llx %d %s\n", aop.addr, ret, aop.mnemonic); + // eprintf (" 0x%08llx %d %s\n", aop.addr, ret, aop.mnemonic); (void)r_anal_esil_parse (esil, e); } } @@ -5689,7 +5689,7 @@ static void cmd_anal_esil(RCore *core, const char *input) { *n2++ = 0; } ut64 off = r_num_math (core->num, n); - ut64 nth = n2?r_num_math (core->num, n2):1; + ut64 nth = n2? r_num_math (core->num, n2): 1; cmd_aespc (core, core->offset, off, (int)nth); } else { eprintf ("Usage: aesB [until-addr] [nth-opcodes] @ [from-addr]\n"); diff --git a/libr/reg/reg.c b/libr/reg/reg.c index 5d6e3fda4a9e8..b68b17c5fdaed 100644 --- a/libr/reg/reg.c +++ b/libr/reg/reg.c @@ -286,11 +286,15 @@ R_API bool r_reg_is_readonly(RReg *reg, RRegItem *item) { } R_API ut64 r_reg_setv(RReg *reg, const char *name, ut64 val) { - return r_reg_set_value (reg, r_reg_get (reg, name, -1), val); + r_return_val_if_fail (reg && name, UT64_MAX); + RRegItem *ri = r_reg_get (reg, name, -1); + return ri? r_reg_set_value (reg, ri, val): UT64_MAX; } R_API ut64 r_reg_getv(RReg *reg, const char *name) { - return r_reg_get_value (reg, r_reg_get (reg, name, -1)); + r_return_val_if_fail (reg && name, UT64_MAX); + RRegItem *ri = r_reg_get (reg, name, -1); + return ri? r_reg_get_value (reg, ri): UT64_MAX; } R_API RRegItem *r_reg_get(RReg *reg, const char *name, int type) { diff --git a/libr/reg/value.c b/libr/reg/value.c index 3b553d1889638..3b640c390f93d 100644 --- a/libr/reg/value.c +++ b/libr/reg/value.c @@ -68,6 +68,7 @@ R_API ut64 r_reg_get_value_big(RReg *reg, RRegItem *item, utX *val) { } R_API ut64 r_reg_get_value(RReg *reg, RRegItem *item) { + r_return_val_if_fail (reg && item, 0); if (!reg || !item || item->offset == -1) { return 0LL; } @@ -123,6 +124,9 @@ R_API ut64 r_reg_get_value(RReg *reg, RRegItem *item) { case 96: // long floating value // FIXME: It is a precision loss, please implement me properly! return (ut64)r_reg_get_longdouble (reg, item); + case 128: + // XXX 128 bit + return (ut64)r_reg_get_longdouble (reg, item); default: eprintf ("r_reg_get_value: Bit size %d not supported\n", item->size); break; @@ -197,6 +201,9 @@ R_API bool r_reg_set_value(RReg *reg, RRegItem *item, ut64 value) { buf[0] = (buf[0] & mask) | 0; } return true; + case 128: + // XXX 128 bit + return false; // (ut64)r_reg_get_longdouble (reg, item); default: eprintf ("r_reg_set_value: Bit size %d not supported\n", item->size); return false; diff --git a/test/new/db/cmd/cmd_pd b/test/new/db/cmd/cmd_pd index 81e96af8d8bcc..20acd423f970b 100644 --- a/test/new/db/cmd/cmd_pd +++ b/test/new/db/cmd/cmd_pd @@ -1811,7 +1811,7 @@ pd 1 e scr.color=3 ec linehl none pd 1 -ec linehl #002f00 +ec linehl rgb:002f00 pd 1 ec wordhl rgb:800 ecHw eax