Implement pvp and wvp to print and write pointers ##print

* Uses wv8/wv4 depending on asm.bits
This commit is contained in:
pancake 2022-12-26 11:18:01 +01:00
parent e9ea4b46ae
commit 45605fce9d
2 changed files with 10 additions and 2 deletions

View File

@ -534,7 +534,7 @@ static const char *help_msg_pv[] = {
"pv2", "", "print 2 bytes in memory",
"pv4", "", "print 4 bytes in memory",
"pv8", "", "print 8 bytes in memory",
"pv8", "", "print 8 bytes in memory",
"pvp", "", "print 4 or 8 bytes depending on asm.bits"
"pve", " [1234] ([bsize])", "print value with any endian (1234, ",
"pvz", "", "print value as string (alias for ps)",
NULL
@ -3488,6 +3488,9 @@ static void cmd_print_pv(RCore *core, const char *input, bool useBytes) {
int type = 'v';
bool fixed_size = true;
switch (input[0]) {
case 'p': // "pvp"
input++;
break;
case '1': // "pv1"
n = 1;
input++;

View File

@ -160,6 +160,7 @@ static const char *help_msg_wv[] = {
"wv2", " 234", "write unsigned short (2 bytes) with this number",
"wv4", " 1 2 3", "write N space-separated dword (4 bytes)",
"wv8", " 234", "write qword (8 bytes) with this number",
"wvp", " 934", "write 4 or 8 byte pointer, depending on asm.bits",
"wvf", " 3.14", "write float value (4 bytes)",
"wvF", " 3.14", "write double value (8 bytes)",
"wvG", " 3.14", "write long double value (10/16 bytes)",
@ -458,8 +459,12 @@ static void cmd_write_value(RCore *core, const char *input) {
bool be = r_config_get_b (core->config, "cfg.bigendian");
r_core_return_value (core, R_CMD_RC_SUCCESS);
char op = input[0];
if (op == 'p') {
op = (r_config_get_i (core->config, "asm.bits") == 64)? '8': '4';
}
switch (input[0]) {
switch (op) {
case '?': // "wv?"
r_core_cmd_help (core, help_msg_wv);
return;