mirror of
https://github.com/radareorg/radare2.git
synced 2025-01-08 06:12:13 +00:00
Add variable length array in pf
Still doesn't work with flags
This commit is contained in:
parent
27b16c5636
commit
e5d5a688dd
@ -445,6 +445,7 @@ static void cmd_print_format (RCore *core, const char *_input, int len) {
|
||||
}
|
||||
}
|
||||
if (input[1]=='.') {
|
||||
core->print->num = core->num;
|
||||
/* print all stored format */
|
||||
if (input[2]=='\0') {
|
||||
RListIter *iter;
|
||||
|
@ -64,6 +64,7 @@ typedef struct r_print_t {
|
||||
RPrintColorFor hasrefs;
|
||||
RStrHT *formats;
|
||||
RCons *cons;
|
||||
RNum *num;
|
||||
} RPrint;
|
||||
|
||||
#ifdef R_API
|
||||
|
@ -53,6 +53,22 @@ static void updateAddr(const ut8 *buf, int i, int endian, ut64 *addr, ut64 *addr
|
||||
}
|
||||
}
|
||||
|
||||
static int r_get_size(RNum *num, ut8 *buf, int endian, const char *s) {
|
||||
int size=0, len = strlen(s);
|
||||
ut64 addr;
|
||||
|
||||
if (s[0] == '*' && len >= 4) { // value pointed by the address
|
||||
int offset = r_num_math (num, s+1);
|
||||
updateAddr (buf, offset, endian, &addr, NULL);
|
||||
return addr;
|
||||
} else {
|
||||
size = r_num_math (num, s); // this should handle also the flags, but doesn't work... :/
|
||||
// eprintf ("SIZE: %s --> %d\n", s, size);
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
|
||||
static void r_print_format_quadword(const RPrint* p, int endian, int mode,
|
||||
const char* setval, ut64 seeki, ut8* buf, int i, int size) {
|
||||
ut64 addr64;
|
||||
@ -1039,7 +1055,7 @@ R_API int r_print_format(RPrint *p, ut64 seek, const ut8* b, const int len,
|
||||
goto beach;
|
||||
}
|
||||
*end = '\0';
|
||||
size = r_num_math (NULL, arg+1);
|
||||
size = r_get_size (p->num, buf, endian, arg+1);
|
||||
arg = end + 1;
|
||||
*end = ']';
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user