Automatic asm.bits depending on CPSR's Thumb bit

This commit is contained in:
pancake 2016-01-11 03:08:24 +01:00
parent 9bd4e213b2
commit 6c931a091f
2 changed files with 18 additions and 0 deletions

View File

@ -89,11 +89,23 @@ R_API int r_debug_reg_list(RDebug *dbg, int type, int size, int rad, const char
from = type;
to = from +1;
}
bool is_arm = dbg->arch && strstr (dbg->arch, "arm");
for (i = from; i < to; i++) {
head = r_reg_get_list (dbg->reg, i);
if (!head) continue;
r_list_foreach (head, iter, item) {
ut64 value;
if (is_arm && (rad == 1 || rad == '*') && item->size == 1) {
if (!strcmp (item->name, "tf")) {
bool is_thumb = r_reg_get_value (dbg->reg, item);
int new_bits = is_thumb? 16: 32;
if (dbg->bits != new_bits)
dbg->cb_printf ("e asm.bits=%d\n", new_bits);
}
continue;
}
if (type != -1) {
if (type != item->type) continue;
if (size != 0 && size != item->size) continue;

View File

@ -25,6 +25,12 @@ R_API ut64 r_reg_get_value(RReg *reg, RRegItem *item) {
1 :
0;
break;
case 4:
if (regset->arena->size - off - 1 >= 0) {
memcpy (&v8, regset->arena->bytes + off, 1);
ret = v8 & 0xF;
}
break;
case 8:
if (regset->arena->size - off - 1 >= 0) {
memcpy (&v8, regset->arena->bytes + off, 1);