Trim spaces around fs+ arguments

This commit is contained in:
pancake 2021-02-09 16:01:53 +01:00
parent 0cc2cdd200
commit 95af8dd05e
2 changed files with 9 additions and 9 deletions

View File

@ -1,4 +1,4 @@
/* radare - LGPL - Copyright 2009-2020 - pancake */
/* radare - LGPL - Copyright 2009-2021 - pancake */
#include <stddef.h>
#include "r_cons.h"
@ -1165,12 +1165,12 @@ rep:
case '?':
r_core_cmd_help (core, help_msg_fs);
break;
case '+':
r_flag_space_push (core->flags, input+2);
case '+': // "fs+"
r_flag_space_push (core->flags, r_str_trim_head_ro (input + 2));
break;
case 'r':
if (input[2] ==' ') {
char *newname = strdup (input + 3);
if (input[2] == ' ') {
char *newname = r_str_trim_dup (input + 3);
r_str_trim (newname);
r_flag_space_rename (core->flags, NULL, newname);
free (newname);
@ -1197,13 +1197,13 @@ rep:
r_flag_space_pop (core->flags);
break;
default:
r_flag_space_unset (core->flags, input+2);
r_flag_space_unset (core->flags, r_str_trim_head_ro (input + 2));
break;
}
break;
case ' ':
{
char *name = strdup (input + 2);
char *name = r_str_trim_dup (input + 2);
r_str_trim (name);
r_flag_space_set (core->flags, name);
free (name);

View File

@ -7,7 +7,7 @@ sf loc.0000f190
agfj~reloc.free
EOF
EXPECT=<<EOF
[{"name":"loc.0000f190","offset":61840,"ninstr":7,"nargs":0,"nlocals":0,"size":23,"stack":8,"type":"loc","blocks":[{"offset":61840,"size":23,"colorize":0,"ops":[{"offset":61840,"esil":"rbx,8,rsp,-,=[8],8,rsp,-=","refptr":false,"fcn_addr":61840,"fcn_last":61862,"size":1,"opcode":"push rbx","disasm":"push rbx","bytes":"53","family":"cpu","type":"rpush","reloc":false,"type_num":268435468,"type2_num":0,"flags":["loc.0000f190"],"xrefs":[{"addr":53124,"type":"DATA"},{"addr":54437,"type":"CODE"}]},{"offset":61841,"esil":"rdi,rbx,=","refptr":false,"fcn_addr":61840,"fcn_last":61860,"size":3,"opcode":"mov rbx, rdi","disasm":"mov rbx, rdi","bytes":"4889fb","family":"cpu","type":"mov","reloc":false,"type_num":9,"type2_num":0},{"offset":61844,"esil":"rdi,[8],rdi,=","refptr":true,"fcn_addr":61840,"fcn_last":61860,"size":3,"opcode":"mov rdi, qword [rdi]","disasm":"mov rdi, qword [rdi]","bytes":"488b3f","family":"cpu","type":"mov","reloc":false,"type_num":9,"type2_num":0},{"offset":61847,"ptr":138400,"esil":"0x12b03,rip,+,[8],rip,8,rsp,-=,rsp,=[],rip,=","refptr":true,"fcn_addr":61840,"fcn_last":61857,"size":6,"opcode":"call qword [rip + 0x12b03]","disasm":"call qword [reloc.free]","bytes":"ff15032b0100","family":"cpu","type":"ucall","reloc":false,"type_num":402653188,"type2_num":0,"refs":[{"addr":138400,"type":"CALL"}]},{"offset":61853,"esil":"rbx,rdi,=","refptr":false,"fcn_addr":61840,"fcn_last":61860,"size":3,"opcode":"mov rdi, rbx","disasm":"mov rdi, rbx","bytes":"4889df","family":"cpu","type":"mov","reloc":false,"type_num":9,"type2_num":0},{"offset":61856,"esil":"rsp,[8],rbx,=,8,rsp,+=","refptr":false,"fcn_addr":61840,"fcn_last":61862,"size":1,"opcode":"pop rbx","disasm":"pop rbx","bytes":"5b","family":"cpu","type":"pop","reloc":false,"type_num":14,"type2_num":0},{"offset":61857,"ptr":138400,"esil":"0x12af9,rip,+,[8],rip,=","refptr":true,"fcn_addr":61840,"fcn_last":61857,"size":6,"opcode":"jmp qword [rip + 0x12af9]","disasm":"jmp qword [reloc.free]","bytes":"ff25f92a0100","family":"cpu","type":"ujmp","reloc":false,"type_num":402653186,"type2_num":0,"refs":[{"addr":138400,"type":"DATA"}]}]}]}]
[{"name":"loc.0000f190","offset":61840,"ninstr":7,"nargs":0,"nlocals":0,"size":23,"stack":8,"type":"loc","blocks":[{"offset":61840,"size":23,"ops":[{"offset":61840,"esil":"rbx,8,rsp,-,=[8],8,rsp,-=","refptr":false,"fcn_addr":61840,"fcn_last":61862,"size":1,"opcode":"push rbx","disasm":"push rbx","bytes":"53","family":"cpu","type":"rpush","reloc":false,"type_num":268435468,"type2_num":0,"flags":["loc.0000f190"],"xrefs":[{"addr":53124,"type":"DATA"},{"addr":54437,"type":"CODE"}]},{"offset":61841,"esil":"rdi,rbx,=","refptr":false,"fcn_addr":61840,"fcn_last":61860,"size":3,"opcode":"mov rbx, rdi","disasm":"mov rbx, rdi","bytes":"4889fb","family":"cpu","type":"mov","reloc":false,"type_num":9,"type2_num":0},{"offset":61844,"esil":"rdi,[8],rdi,=","refptr":true,"fcn_addr":61840,"fcn_last":61860,"size":3,"opcode":"mov rdi, qword [rdi]","disasm":"mov rdi, qword [rdi]","bytes":"488b3f","family":"cpu","type":"mov","reloc":false,"type_num":9,"type2_num":0},{"offset":61847,"ptr":138400,"esil":"0x12b03,rip,+,[8],rip,8,rsp,-=,rsp,=[],rip,=","refptr":true,"fcn_addr":61840,"fcn_last":61857,"size":6,"opcode":"call qword [rip + 0x12b03]","disasm":"call qword [reloc.free]","bytes":"ff15032b0100","family":"cpu","type":"ucall","reloc":false,"type_num":402653188,"type2_num":0,"refs":[{"addr":138400,"type":"CALL"}]},{"offset":61853,"esil":"rbx,rdi,=","refptr":false,"fcn_addr":61840,"fcn_last":61860,"size":3,"opcode":"mov rdi, rbx","disasm":"mov rdi, rbx","bytes":"4889df","family":"cpu","type":"mov","reloc":false,"type_num":9,"type2_num":0},{"offset":61856,"esil":"rsp,[8],rbx,=,8,rsp,+=","refptr":false,"fcn_addr":61840,"fcn_last":61862,"size":1,"opcode":"pop rbx","disasm":"pop rbx","bytes":"5b","family":"cpu","type":"pop","reloc":false,"type_num":14,"type2_num":0},{"offset":61857,"ptr":138400,"esil":"0x12af9,rip,+,[8],rip,=","refptr":true,"fcn_addr":61840,"fcn_last":61857,"size":6,"opcode":"jmp qword [rip + 0x12af9]","disasm":"jmp qword [reloc.free]","bytes":"ff25f92a0100","family":"cpu","type":"ujmp","reloc":false,"type_num":402653186,"type2_num":0,"refs":[{"addr":138400,"type":"DATA"}]}]}]}]
EOF
RUN
@ -22,6 +22,6 @@ af
agfJ
EOF
EXPECT=<<EOF
[{"name":"fcn.00000042","offset":66,"ninstr":8,"nargs":0,"nlocals":0,"size":17,"stack":0,"type":"fcn","blocks":[{"offset":66,"size":8,"jump":80,"fail":74,"colorize":0,"ops":[{"offset":66,"text":"17: fcn.00000042 ();"},{"offset":66,"text":" 0000 add byte [rax], al"},{"offset":68,"text":" 4883f800 cmp rax, 0"},{"offset":72,"arrow":80,"text":" 7406 je 0x50"}]},{"offset":74,"size":6,"jump":80,"colorize":0,"ops":[{"offset":74,"text":" 0000 add byte [rax], al"},{"offset":76,"text":" 0000 add byte [rax], al"},{"offset":78,"text":" 0000 add byte [rax], al"}]},{"offset":80,"size":3,"colorize":0,"ops":[{"offset":80,"text":" 0000 add byte [rax], al"},{"offset":82,"text":" c3 ret"}]}]}]
[{"name":"fcn.00000042","offset":66,"ninstr":8,"nargs":0,"nlocals":0,"size":17,"stack":0,"type":"fcn","blocks":[{"offset":66,"size":8,"jump":80,"fail":74,"ops":[{"offset":66,"text":"17: fcn.00000042 ();"},{"offset":66,"text":" 0000 add byte [rax], al"},{"offset":68,"text":" 4883f800 cmp rax, 0"},{"offset":72,"arrow":80,"text":" 7406 je 0x50"}]},{"offset":74,"size":6,"jump":80,"ops":[{"offset":74,"text":" 0000 add byte [rax], al"},{"offset":76,"text":" 0000 add byte [rax], al"},{"offset":78,"text":" 0000 add byte [rax], al"}]},{"offset":80,"size":3,"ops":[{"offset":80,"text":" 0000 add byte [rax], al"},{"offset":82,"text":" c3 ret"}]}]}]
EOF
RUN