mirror of
https://github.com/radareorg/radare2.git
synced 2025-01-27 00:05:10 +00:00
Manipulate stack.delta and stack.size with Vppc[jk+-.]
This commit is contained in:
parent
b835d2f87c
commit
15b43564fd
@ -1789,9 +1789,8 @@ static void cmd_debug_reg(RCore *core, const char *str) {
|
||||
char *string;
|
||||
const char *regname;
|
||||
*arg = 0;
|
||||
string = r_str_chop (strdup (str+1));
|
||||
regname = r_reg_get_name (core->dbg->reg,
|
||||
r_reg_get_name_idx (string));
|
||||
string = r_str_chop (strdup (str + 1));
|
||||
regname = r_reg_get_name (core->dbg->reg, r_reg_get_name_idx (string));
|
||||
if (!regname) {
|
||||
regname = string;
|
||||
}
|
||||
@ -1813,7 +1812,9 @@ static void cmd_debug_reg(RCore *core, const char *str) {
|
||||
r_cons_printf ("0x%08"PFMT64x"\n",
|
||||
r_reg_get_value (core->dbg->reg, r));
|
||||
}
|
||||
} else eprintf ("Unknown register '%s'\n", string);
|
||||
} else {
|
||||
eprintf ("Unknown register '%s'\n", string);
|
||||
}
|
||||
free (string);
|
||||
// update flags here
|
||||
r_core_cmdf (core, ".dr*%d", bits);
|
||||
|
@ -946,6 +946,15 @@ static void cursor_nextrow(RCore *core, bool use_ocur) {
|
||||
p->cur += cols > 0 ? cols: 3;
|
||||
return;
|
||||
}
|
||||
if (core->seltab == 0 && core->printidx == 2) {
|
||||
int w = r_config_get_i (core->config, "hex.cols");
|
||||
if (w < 1) {
|
||||
w = 16;
|
||||
}
|
||||
r_config_set_i (core->config, "stack.delta",
|
||||
r_config_get_i (core->config, "stack.delta") - w);
|
||||
return;
|
||||
}
|
||||
|
||||
if (p->row_offsets != NULL) {
|
||||
// FIXME: cache the current row
|
||||
@ -986,6 +995,16 @@ static void cursor_prevrow(RCore *core, bool use_ocur) {
|
||||
}
|
||||
cursor_ocur (core, use_ocur);
|
||||
|
||||
if (core->seltab == 0 && core->printidx == 2) {
|
||||
int w = r_config_get_i (core->config, "hex.cols");
|
||||
if (w < 1) {
|
||||
w = 16;
|
||||
}
|
||||
r_config_set_i (core->config, "stack.delta",
|
||||
r_config_get_i (core->config, "stack.delta") + w);
|
||||
return;
|
||||
}
|
||||
|
||||
if (p->row_offsets != NULL) {
|
||||
int delta, prev_sz;
|
||||
|
||||
@ -1873,15 +1892,22 @@ R_API int r_core_visual_cmd(RCore *core, int ch) {
|
||||
break;
|
||||
case '-':
|
||||
if (core->print->cur_enabled) {
|
||||
if (core->print->ocur == -1) {
|
||||
sprintf (buf, "wos 01 @ $$+%i!1",core->print->cur);
|
||||
if (core->seltab == 0 && core->printidx == 2) {
|
||||
int w = r_config_get_i (core->config, "hex.cols");
|
||||
r_config_set_i (core->config, "stack.size",
|
||||
r_config_get_i (core->config, "stack.size") - w);
|
||||
|
||||
} else {
|
||||
sprintf (buf, "wos 01 @ $$+%i!%i", core->print->cur < core->print->ocur
|
||||
? core->print->cur
|
||||
: core->print->ocur,
|
||||
R_ABS (core->print->ocur - core->print->cur) + 1);
|
||||
if (core->print->ocur == -1) {
|
||||
sprintf (buf, "wos 01 @ $$+%i!1",core->print->cur);
|
||||
} else {
|
||||
sprintf (buf, "wos 01 @ $$+%i!%i", core->print->cur < core->print->ocur
|
||||
? core->print->cur
|
||||
: core->print->ocur,
|
||||
R_ABS (core->print->ocur - core->print->cur) + 1);
|
||||
}
|
||||
r_core_cmd (core, buf, 0);
|
||||
}
|
||||
r_core_cmd (core, buf, 0);
|
||||
} else {
|
||||
if (!autoblocksize) {
|
||||
r_core_block_size (core, core->blocksize-1);
|
||||
@ -1890,15 +1916,22 @@ R_API int r_core_visual_cmd(RCore *core, int ch) {
|
||||
break;
|
||||
case '+':
|
||||
if (core->print->cur_enabled) {
|
||||
if (core->print->ocur == -1) {
|
||||
sprintf (buf, "woa 01 @ $$+%i!1", core->print->cur);
|
||||
if (core->seltab == 0 && core->printidx == 2) {
|
||||
int w = r_config_get_i (core->config, "hex.cols");
|
||||
r_config_set_i (core->config, "stack.size",
|
||||
r_config_get_i (core->config, "stack.size") + w);
|
||||
|
||||
} else {
|
||||
sprintf (buf, "woa 01 @ $$+%i!%i", core->print->cur < core->print->ocur
|
||||
? core->print->cur
|
||||
: core->print->ocur,
|
||||
R_ABS (core->print->ocur - core->print->cur) + 1);
|
||||
if (core->print->ocur == -1) {
|
||||
sprintf (buf, "woa 01 @ $$+%i!1", core->print->cur);
|
||||
} else {
|
||||
sprintf (buf, "woa 01 @ $$+%i!%i", core->print->cur < core->print->ocur
|
||||
? core->print->cur
|
||||
: core->print->ocur,
|
||||
R_ABS (core->print->ocur - core->print->cur) + 1);
|
||||
}
|
||||
r_core_cmd (core, buf, 0);
|
||||
}
|
||||
r_core_cmd (core, buf, 0);
|
||||
} else {
|
||||
if (!autoblocksize)
|
||||
r_core_block_size (core, core->blocksize+1);
|
||||
@ -1934,6 +1967,7 @@ R_API int r_core_visual_cmd(RCore *core, int ch) {
|
||||
case '.':
|
||||
r_io_sundo_push (core->io, core->offset, r_print_get_cursor (core->print));
|
||||
if (core->print->cur_enabled) {
|
||||
r_config_set_i (core->config, "stack.delta", 0);
|
||||
r_core_seek (core, core->offset+core->print->cur, 1);
|
||||
core->print->cur = 0;
|
||||
} else {
|
||||
@ -2397,11 +2431,13 @@ dodo:
|
||||
default: pxw = "px"; break;
|
||||
}
|
||||
}
|
||||
const char sign = (delta < 0)? '+': '-';
|
||||
const int absdelta = R_ABS(delta);
|
||||
snprintf (debugstr, sizeof (debugstr),
|
||||
"?0;f tmp;sr SP;%s %d@$$-%d;"
|
||||
"?0;f tmp;sr SP;%s %d@$$%c%d;"
|
||||
"?1;%s;s-;"
|
||||
"?1;s tmp;f-tmp;pd $r",
|
||||
pxa? "pxa": pxw, size, delta,
|
||||
pxa? "pxa": pxw, size, sign, absdelta,
|
||||
ref? "drr": "dr=");
|
||||
}
|
||||
printfmt[2] = debugstr;
|
||||
|
Loading…
x
Reference in New Issue
Block a user