mirror of
https://github.com/radareorg/radare2.git
synced 2025-01-24 14:54:54 +00:00
Fix RReg.arena.size issue caused by missing parenthesis in BITS2BYTES
This commit is contained in:
parent
88687d9da4
commit
b6850182b9
@ -727,6 +727,14 @@ void cmd_anal_reg(RCore *core, const char *str) {
|
||||
r_cons_printf ("0x%08"PFMT64x"\n", off);
|
||||
} else ar_show_help (core);
|
||||
break;
|
||||
case 'S':
|
||||
{
|
||||
int sz;
|
||||
ut8 *buf = r_reg_get_bytes (
|
||||
core->anal->reg, R_REG_TYPE_GPR, &sz);
|
||||
r_cons_printf ("%d\n", sz);
|
||||
}
|
||||
break;
|
||||
case 'b':
|
||||
{ // WORK IN PROGRESS // DEBUG COMMAND
|
||||
int len;
|
||||
|
@ -168,7 +168,7 @@ typedef void (*PrintfCallback)(const char *str, ...);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define BITS2BYTES(x) ((x/8)+((x%8)?1:0))
|
||||
#define BITS2BYTES(x) (((x)/8)+(((x)%8)?1:0))
|
||||
#define ZERO_FILL(x) memset (&x, 0, sizeof (x))
|
||||
#define R_NEWS0(x,y) (x*)memset (malloc(sizeof(x)*y), 0, sizeof(x)*y);
|
||||
#define R_NEWS(x,y) (x*)malloc(sizeof(x)*y)
|
||||
|
@ -7,6 +7,8 @@ R_API ut8* r_reg_get_bytes(RReg *reg, int type, int *size) {
|
||||
RRegArena *arena;
|
||||
int i, sz, osize;
|
||||
ut8 *buf;
|
||||
if (size)
|
||||
*size = 0;
|
||||
if (type == -1) {
|
||||
/* serialize ALL register types in a single buffer */
|
||||
// owned buffer is returned
|
||||
@ -113,6 +115,8 @@ R_API int r_reg_fit_arena(RReg *reg) {
|
||||
arena = reg->regset[i].arena;
|
||||
newsize = 0;
|
||||
r_list_foreach (reg->regset[i].regs, iter, r) {
|
||||
int regsize_in_bytes = r->size / 8;
|
||||
// XXX: bits2bytes doesnt seems to work fine
|
||||
size = BITS2BYTES (r->offset+r->size);
|
||||
newsize = R_MAX (size, newsize);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user