Add support for personality designation in regex qualifications

* basic_filters.c (qualify_syscall_regex): Copy syscall name
to a temporary buffer, append the personality designation to it,
and check it against regular expression if the syscall name
hasn't been matched already.

References: https://github.com/strace/strace/issues/35
This commit is contained in:
Eugene Syromyatnikov 2018-02-11 05:24:29 +01:00 committed by Dmitry V. Levin
parent 3fedf07869
commit 380d205bb8

View File

@ -132,12 +132,26 @@ qualify_syscall_regex(const char *s, struct number_set *set)
for (unsigned int i = 0; i < nsyscall_vec[p]; ++i) {
if (!sysent_vec[p][i].sys_name)
continue;
rc = regexec(&preg, sysent_vec[p][i].sys_name,
0, NULL, 0);
if (rc == REG_NOMATCH) {
char name_buf[128];
char *pos = stpcpy(name_buf,
sysent_vec[p][i].sys_name);
(void) xappendstr(name_buf, pos, "@%s",
personality_designators[p]);
rc = regexec(&preg, name_buf, 0, NULL, 0);
}
if (rc == REG_NOMATCH)
continue;
else if (rc)
regerror_msg_and_die(rc, &preg, "regexec", s);
add_number_to_set_array(i, set, p);
found = true;
}