signal: fix omission of field names in sigaction printers

* signal.c (decode_old_sigaction, decode_new_sigaction): Add printing
of the field names.
* tests/sigaction.awk: Update expected output.

Co-authored-by: Elvira Khabirova <lineprinter0@gmail.com>
This commit is contained in:
Eugene Syromyatnikov 2016-11-28 22:02:52 +03:00 committed by Dmitry V. Levin
parent ad53524377
commit d454dac0dc
2 changed files with 53 additions and 22 deletions

View File

@ -335,19 +335,19 @@ decode_old_sigaction(struct tcb *tcp, long addr)
* be manipulated by strace. In order to prevent the
* compiler from generating code to manipulate
* __sa_handler we cast the function pointers to long. */
tprints("{");
tprints("{sa_handler=");
print_sa_handler((unsigned long) sa.__sa_handler);
tprints(", ");
tprints(", sa_mask=");
#ifdef MIPS
tprintsigmask_addr("", sa.sa_mask);
#else
tprintsigmask_val("", sa.sa_mask);
#endif
tprints(", ");
tprints(", sa_flags=");
printflags(sigact_flags, sa.sa_flags, "SA_???");
#if HAVE_SA_RESTORER && defined SA_RESTORER
if (sa.sa_flags & SA_RESTORER)
tprintf(", %p", sa.sa_restorer);
tprintf(", sa_restorer=%p", sa.sa_restorer);
#endif
tprints("}");
}
@ -540,9 +540,9 @@ decode_new_sigaction(struct tcb *tcp, long addr)
* be manipulated by strace. In order to prevent the
* compiler from generating code to manipulate
* __sa_handler we cast the function pointers to long. */
tprints("{");
tprints("{sa_handler=");
print_sa_handler((unsigned long) sa.__sa_handler);
tprints(", ");
tprints(", sa_mask=");
/*
* Sigset size is in tcp->u_arg[4] (SPARC)
* or in tcp->u_arg[3] (all other),
@ -551,12 +551,12 @@ decode_new_sigaction(struct tcb *tcp, long addr)
* We just fetch the right size, which is NSIG / 8.
*/
tprintsigmask_val("", sa.sa_mask);
tprints(", ");
tprints(", sa_flags=");
printflags(sigact_flags, sa.sa_flags, "SA_???");
#if HAVE_SA_RESTORER && defined SA_RESTORER
if (sa.sa_flags & SA_RESTORER)
tprintf(", %p", sa.sa_restorer);
tprintf(", sa_restorer=%p", sa.sa_restorer);
#endif
tprints("}");
}

View File

@ -1,6 +1,7 @@
#!/bin/gawk
#
# Copyright (c) 2014-2015 Dmitry V. Levin <ldv@altlinux.org>
# Copyright (c) 2016 Elvira Khabirova <lineprinter0@gmail.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -26,23 +27,44 @@
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
BEGIN {
n1[1] = "SIG_IGN, \\[HUP INT\\], SA_RESTORER\\|SA_RESTART, 0x[0-9a-f]+"
n2[1] = "SIG_IGN, \\[HUP INT\\], SA_RESTART"
n1[1][1] = n2[1][1] = "SIG_IGN"
n1[1][2] = n2[1][2] = "\\[HUP INT\\]"
n1[1][3] = "SA_RESTORER\\|SA_RESTART"
n2[1][3] = "SA_RESTART"
n1[1][4] = ", sa_restorer=0x[0-9a-f]+"
n2[1][4] = ""
n1[2] = "0x[0-9a-f]+, \\[QUIT TERM\\], SA_RESTORER\\|SA_SIGINFO, 0x[0-9a-f]+"
n2[2] = "0x[0-9a-f]+, \\[QUIT TERM\\], SA_SIGINFO"
n1[2][1] = n2[2][1] = "0x[0-9a-f]+"
n1[2][2] = n2[2][2] = "\\[QUIT TERM\\]"
n1[2][3] = "SA_RESTORER\\|SA_SIGINFO"
n2[2][3] = "SA_SIGINFO"
n1[2][4] = ", sa_restorer=0x[0-9a-f]+"
n2[2][4] = ""
n1[3] = "SIG_DFL, \\[\\], SA_RESTORER, 0x[0-9a-f]+"
n2[3] = "SIG_DFL, \\[\\], 0"
n1[3][1] = n2[3][1] = "SIG_DFL"
n1[3][2] = n2[3][2] = "\\[\\]"
n1[3][3] = "SA_RESTORER"
n2[3][3] = "0"
n1[3][4] = ", sa_restorer=0x[0-9a-f]+"
n2[3][4] = ""
n1[4] = "SIG_DFL, ~\\[HUP( ((RT|SIGRT)[^] ]+|[3-9][0-9]|1[0-9][0-9]))*\\], SA_RESTORER, 0x[0-9a-f]+"
n2[4] = "SIG_DFL, ~\\[HUP( ((RT|SIGRT)[^] ]+|[3-9][0-9]|1[0-9][0-9]))*\\], 0"
n1[4][1] = n2[4][1] = "SIG_DFL"
n1[4][2] = n2[4][2] = "~\\[HUP( ((RT|SIGRT)[^] ]+|[3-9][0-9]|1[0-9][0-9]))*\\]"
n1[4][3] = "SA_RESTORER"
n2[4][3] = "0"
n1[4][4] = ", sa_restorer=0x[0-9a-f]+"
n2[4][4] = ""
o1[1] = o2[1] = "SIG_DFL, \\[\\], 0"
o1[1][1] = o2[1][1] = "SIG_DFL"
o1[1][2] = o2[1][2] = "\\[\\]"
o1[1][3] = o2[1][3] = "0"
o1[1][4] = o2[1][4] = ""
for (i = 2; i < 5; i++) {
o1[i] = n1[i - 1]
o2[i] = n2[i - 1]
for (j = 1; j < 5; j++) {
o1[i][j] = n1[i - 1][j]
o2[i][j] = n2[i - 1][j]
}
}
a1 = "(0x[0-9a-f]+, )?(4|8|16)"
@ -51,9 +73,18 @@ BEGIN {
for (i = 1; i < 5; i++) {
r[i] = "^rt_sigaction\\(SIGUSR2, (" \
"\\{" n1[i] "\\}, \\{" o1[i] "\\}, " a1 "|" \
"\\{" n2[i] "\\}, \\{" o2[i] "\\}, " a2 "|" \
"\\{" n2[i] "\\}, \\{" o2[i] "\\}, " a3 ")\\) = 0$"
"\\{sa_handler=" n1[i][1] ", sa_mask=" n1[i][2] \
", sa_flags=" n1[i][3] n1[i][4] "\\}, \\{sa_handler=" \
o1[i][1] ", sa_mask=" o1[i][2] ", sa_flags=" o1[i][3] \
o1[i][4] "\\}, " a1 "|" \
"\\{sa_handler=" n2[i][1] ", sa_mask=" n2[i][2] \
", sa_flags=" n2[i][3] n2[i][4] "\\}, \\{sa_handler=" \
o2[i][1] ", sa_mask=" o2[i][2] ", sa_flags=" o2[i][3] \
o2[i][4] "\\}, " a2 "|" \
"\\{sa_handler=" n2[i][1] ", sa_mask=" n2[i][2] \
", sa_flags=" n2[i][3] n2[i][4] "\\}, \\{sa_handler=" \
o2[i][1] ", sa_mask=" o2[i][2] ", sa_flags=" o2[i][3] \
o2[i][4] "\\}, " a3 ")\\) = 0$"
}
s[5] = "+++ exited with 0 +++"