Implement pv[1248]

This commit is contained in:
pancake 2016-04-26 14:35:51 +02:00
parent f39b2ef0e2
commit e775f1051f
2 changed files with 34 additions and 5 deletions

View file

@ -1560,6 +1560,24 @@ static void cmd_print_pv(RCore *core, const char *input) {
const char *stack[] = { "ret", "arg0", "arg1", "arg2", "arg3", "arg4", NULL };
int i, n = core->assembler->bits / 8;
int type = 'v';
switch (input[0]) {
case '1':
n = 1;
input++;
break;
case '2':
n = 2;
input++;
break;
case '4':
n = 4;
input++;
break;
case '8':
n = 8;
input++;
break;
}
// variables can be
switch (input[0]) {
case 'z':
@ -1573,7 +1591,7 @@ static void cmd_print_pv(RCore *core, const char *input) {
/* fallthrough */
case ' ':
for (i = 0; stack[i]; i++) {
if (!strcmp (input+1, stack[i])) {
if (!strcmp (input + 1, stack[i])) {
if (type == 'z') {
r_core_cmdf (core, "ps @ [`drn sp`+%d]", n * i);
} else {
@ -1596,7 +1614,17 @@ static void cmd_print_pv(RCore *core, const char *input) {
eprintf ("Usage: pv[z] [ret arg#]\n");
break;
default:
r_core_cmd0 (core, "?v [$$]");
{
ut64 v = r_mem_get_num (core->block, n, !core->print->big_endian);
switch (n) {
case 1: r_cons_printf ("0x%02" PFMT64x "\n", v); break;
case 2: r_cons_printf ("0x%04" PFMT64x "\n", v); break;
case 4: r_cons_printf ("0x%08" PFMT64x "\n", v); break;
case 8: r_cons_printf ("0x%016" PFMT64x "\n", v); break;
default: r_cons_printf ("0x%" PFMT64x "\n", v); break;
}
}
//r_core_cmd0 (core, "?v [$$]");
break;
}
}

View file

@ -11,13 +11,14 @@ PREFIX=/usr/local
DST="$(pwd)/sys/osx-pkg/radare2.unpkg"
VERSION="`./configure --version| head -n 1|awk '{print $1}'|cut -d - -f 2`"
[ -z "${VERSION}" ] && VERSION=0.10.0
[ -z "${MAKE}" ] && MAKE=make
rm -rf "${SRC}"
make mrproper
${MAKE} mrproper
./configure --prefix="${PREFIX}" || exit 1
make -j4 || exit 1
${MAKE} -j4 || exit 1
# TODO: run sys/install.sh
make install PREFIX="${PREFIX}" DESTDIR=${SRC} || exit 1
${MAKE} install PREFIX="${PREFIX}" DESTDIR=${SRC} || exit 1
if [ -d "${SRC}" ]; then
(
cd ${SRC} && \