Add omtq (:quiet version of omt) (#990)

This commit is contained in:
Khairul Azhar Kasmiran 2021-04-11 11:27:56 +08:00 committed by GitHub
parent 7d82c13719
commit 63fbfd1caf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 44 additions and 4 deletions

View file

@ -118,7 +118,7 @@ static const char *help_msg_om[] = {
"omq", "", "list all maps and their fds",
"omqq", "", "list all maps addresses (See $MM to get the size)",
"omr", " mapid newsize", "resize map with corresponding id",
"omt", " [query]", "list maps using table api",
"omt", "[q] [query]", "list maps using table api",
NULL
};
@ -660,7 +660,21 @@ static void cmd_open_map(RzCore *core, const char *input) {
}
break;
case 't': // "omt"
rz_core_cmd_omt(core, input + 2);
switch (input[2]) {
case 'q': // "omtq"
{
const char *arg = rz_str_trim_head_ro(input + 3);
char *query = rz_str_newf("%s%s:quiet", arg, *arg ? "," : "");
if (query) {
rz_core_cmd_omt(core, query);
}
free(query);
break;
}
default:
rz_core_cmd_omt(core, input + 2);
break;
}
break;
case ' ': // "om"
s = strdup(input + 2);

View file

@ -3442,8 +3442,8 @@ NAME=tiny1 aae non-start-bb first
FILE=bins/elf/analysis/tiny1
CMDS=<<EOF
e io.cache=true
$orig_end=?e `omt va_end/cols,:quiet`
omr 1 `omt size/cols,:quiet`+2
$orig_end=?e `omtq va_end/cols`
omr 1 `omtq size/cols`+2
s `$orig_end`
wa jmp entry0
aF

View file

@ -14,3 +14,29 @@ EXPECT=<<EOF
2 fd: 4 +0x00000000 0x00000300 - 0x000003ff rw- bbbbbb
EOF
RUN
NAME=omt & omtq
FILE=bins/elf/ls
CMDS=<<EOF
omt
?e
omtq
EOF
EXPECT=<<EOF
.----------------------------------------------------------------------------------------.
| id | fd | pa | pa_end | size | va | va_end | perm | name |
)----------------------------------------------------------------------------------------(
| 1 | 4 | 0x0 | 0x12f0 | 0x12f0 | 0x22268 | 0x23558 | rw- | mmap.LOAD3 |
| 2 | 3 | 0x20050 | 0x21268 | 0x1218 | 0x21050 | 0x22268 | r-- | fmap.LOAD3 |
| 3 | 3 | 0x17000 | 0x1f7c0 | 0x87c0 | 0x17000 | 0x1f7c0 | r-- | fmap.LOAD2 |
| 4 | 3 | 0x4000 | 0x16791 | 0x12791 | 0x4000 | 0x16791 | r-x | fmap.LOAD1 |
| 5 | 3 | 0x0 | 0x3480 | 0x3480 | 0x0 | 0x3480 | r-- | fmap.LOAD0 |
`----------------------------------------------------------------------------------------'
1 4 0x0 0x12f0 0x12f0 0x22268 0x23558 rw- mmap.LOAD3
2 3 0x20050 0x21268 0x1218 0x21050 0x22268 r-- fmap.LOAD3
3 3 0x17000 0x1f7c0 0x87c0 0x17000 0x1f7c0 r-- fmap.LOAD2
4 3 0x4000 0x16791 0x12791 0x4000 0x16791 r-x fmap.LOAD1
5 3 0x0 0x3480 0x3480 0x0 0x3480 r-- fmap.LOAD0
EOF
RUN