Fix /as on arm64-linux and add missing tests to cover it ##search

* This needs a proper fix which will break abi
This commit is contained in:
pancake 2022-07-12 14:17:26 +02:00 committed by pancake
parent 60b68b694f
commit 295c49706b
2 changed files with 24 additions and 7 deletions

View File

@ -1967,7 +1967,16 @@ static void do_syscall_search(RCore *core, struct search_parameters *param) {
ut64 oldoff = core->offset;
int syscallNumber = 0;
r_cons_break_push (NULL, NULL);
// XXX: the syscall register depends on arcm
const char *a0 = r_reg_get_name (core->anal->reg, R_REG_NAME_SN);
if (!strcmp (core->anal->config->arch, "arm") && core->anal->config->bits == 64) {
const char *os = core->anal->config->os;
if (!strcmp (os, "linux")) {
a0 = "x8";
} else if (!strcmp (os, "macos")) {
a0 = "x16";
}
}
char *esp = r_str_newf ("%s,=", a0);
char *esp32 = NULL;
if (core->anal->config->bits == 64) {
@ -2225,13 +2234,6 @@ static bool do_anal_search(RCore *core, struct search_parameters *param, const c
}
if (type == 's') {
eprintf ("Shouldn't reach\n");
// ??
#if 0
case 's': // "/s"
do_syscall_search (core, &param);
dosearch = false;
break;
#endif
return true;
}
if (mode == 'j') {

View File

@ -121,6 +121,21 @@ EXPECT=<<EOF
EOF
RUN
NAME=/as in arm64
FILE=bins/elf/libarm64.so
CMDS=/as
EXPECT=<<EOF
0x0000dfdc mmap
0x0000dff4 openat
0x0000e00c close
0x0000e024 read
0x0000e03c lseek
0x0000e054 munmap
0x0000e06c clock_gettime
EOF
RUN
NAME=/as in arm32
FILE=bins/elf/libexploit.so
CMDS=/as