Re: 4.21 build failure

2018-02-22 Thread Andreas Schwab
On Feb 22 2018, Eugene Syromiatnikov  wrote:

> Well, current implementation of AArch64 compat in strace assumes it's
> identical to ARMv7 EABI, and I'm trying to figure out how to build mpers
> support for it and test it.

Your only option is to use an armv7 compiler.

Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


Re: 4.21 build failure

2018-02-19 Thread Andreas Schwab
On Feb 19 2018, Eugene Syromiatnikov  wrote:

> On Thu, Feb 15, 2018 at 12:39:15AM +0100, Andreas Schwab wrote:
>> 4.21 fails to build for aarch64:
>> 
>> checking gnu/stubs-32.h usability... no
>> checking gnu/stubs-32.h presence... no
>> checking for gnu/stubs-32.h... no
>> configure: Created empty gnu/stubs-32.h
>> checking for m32 personality compile support... no
>> checking whether to enable m32 personality support... no
>> configure: error: Cannot enable m32 personality support
>
> As noted in NEWS, strace now enforces mpers support by default (in order
> to make aware of the possibilty of incorrect non-native personality
> decoding early); looks like your compiler doesn't support producing
> binaries for the compat personality.  You can either try to use another
> compiler or provide --disable-mpers to the configure script.

There is no such thing as -m32 on aarch64 or riscv64.  There is only
-mabi=ilp32 or -mabi=ilp32d.

Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


Re: 4.21 build failure

2018-02-19 Thread Andreas Schwab
On Feb 19 2018, Eugene Syromiatnikov  wrote:

> On Mon, Feb 19, 2018 at 07:31:57PM +0100, Andreas Schwab wrote:
>> On Feb 19 2018, Eugene Syromiatnikov  wrote:
>> 
>> > On Thu, Feb 15, 2018 at 12:39:15AM +0100, Andreas Schwab wrote:
>> >> 4.21 fails to build for aarch64:
>> >> 
>> >> checking gnu/stubs-32.h usability... no
>> >> checking gnu/stubs-32.h presence... no
>> >> checking for gnu/stubs-32.h... no
>> >> configure: Created empty gnu/stubs-32.h
>> >> checking for m32 personality compile support... no
>> >> checking whether to enable m32 personality support... no
>> >> configure: error: Cannot enable m32 personality support
>> >
>> > As noted in NEWS, strace now enforces mpers support by default (in order
>> > to make aware of the possibilty of incorrect non-native personality
>> > decoding early); looks like your compiler doesn't support producing
>> > binaries for the compat personality.  You can either try to use another
>> > compiler or provide --disable-mpers to the configure script.
>> 
>> There is no such thing as -m32 on aarch64 or riscv64.  There is only
>> -mabi=ilp32 or -mabi=ilp32d.
>
> Are you aware of any differences between ARMv7 EABI and AArch32 ABI?

How is that relevant?  This is about aarch64 and riscv64.

> Thank you for the information regarding RISC-V.  Do you have an idea where one
> can easily get an environment with both 32-bit and 64-bit runtime for it, by
> chance?

There is no riscv32 ABI defined yet.

Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


4.21 build failure

2018-02-18 Thread Andreas Schwab
4.21 fails to build for aarch64:

checking gnu/stubs-32.h usability... no
checking gnu/stubs-32.h presence... no
checking for gnu/stubs-32.h... no
configure: Created empty gnu/stubs-32.h
checking for m32 personality compile support... no
checking whether to enable m32 personality support... no
configure: error: Cannot enable m32 personality support

Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


strace-k.test

2017-08-30 Thread Andreas Schwab
The strace-k test always fails if getpid is implemented as a vsyscall:

FAIL: strace-k
==

expected: "getpid f3 f2 f1 f0 main "
result: "__libc_start_main "
getpid()= 7584
 > [vdso]() [0xfa9]
 > /lib/libc-2.25.so(__libc_start_main+0xf3) [0x182c3]
 > unexpected_backtracing_error [0x56607000]
+++ exited with 0 +++
strace-k.test: failed test: ../../strace -e getpid -k ../stack-fcall output 
mismatch

Andreas.

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


Re: clock_nanosleep failure

2017-06-06 Thread Andreas Schwab
On Jun 06 2017, "Dmitry V. Levin"  wrote:

> Why clock_nanosleep is restarted after being interrupted by a signal
> handler?  What kind of kernel is behaving this way?

Indeed, this was a kernel bug.

Thanks, Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


clock_nanosleep failure

2017-06-05 Thread Andreas Schwab
A lot of tests fail because clock_nanosleep fails:

$ ../strace -e clock_nanosleep ./clock_nanosleep >/dev/null
clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=789985}, NULL) = 0
clock_nanosleep(CLOCK_REALTIME, 0, NULL, 0xefca3994) = -1 EFAULT (Bad address)
clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=789985}, 0xefca3994) = 0
clock_nanosleep(CLOCK_MONOTONIC, 0, {tv_sec=0, tv_nsec=10}, 0xefca3994) 
= -1 EINVAL (Invalid argument)
clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=-559038737, tv_nsec=4207869677}, 
0xefca3994) = -1 EINVAL (Invalid argument)
clock_nanosleep(CLOCK_MONOTONIC, 0, {tv_sec=-559038737, tv_nsec=4207869677}, 
0xefca3994) = -1 EINVAL (Invalid argument)
clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=9}, {tv_sec=0, 
tv_nsec=920211999}) = ? ERESTART_RESTARTBLOCK (Interrupted by signal)
--- SIGALRM {si_signo=SIGALRM, si_code=SI_KERNEL} ---
clock_nanosleep(CLOCK_REALTIME, TIMER_ABSTIME, {tv_sec=1496676522, 
tv_nsec=80487000}, 0xefca3994) = ? ERESTARTNOHAND (To be restarted if no 
handler)
--- SIGALRM {si_signo=SIGALRM, si_code=SI_KERNEL} ---
clock_nanosleep(CLOCK_REALTIME, TIMER_ABSTIME, {tv_sec=1496676522, 
tv_nsec=80487000}, 0xefca3994) = ? ERESTARTNOHAND (To be restarted if no 
handler)
--- SIGALRM {si_signo=SIGALRM, si_code=SI_KERNEL} ---
clock_nanosleep(CLOCK_REALTIME, TIMER_ABSTIME, {tv_sec=1496676522, 
tv_nsec=80487000}, 0xefca3994) = ? ERESTARTNOHAND (To be restarted if no 
handler)
--- SIGALRM {si_signo=SIGALRM, si_code=SI_KERNEL} ---
clock_nanosleep(CLOCK_REALTIME, TIMER_ABSTIME, {tv_sec=1496676522, 
tv_nsec=80487000}, 0xefca3994) = ? ERESTARTNOHAND (To be restarted if no 
handler)
--- SIGALRM {si_signo=SIGALRM, si_code=SI_KERNEL} ---
clock_nanosleep(CLOCK_REALTIME, TIMER_ABSTIME, {tv_sec=1496676522, 
tv_nsec=80487000}, 0xefca3994) = 0
clock_nanosleep: clock_nanosleep.c:139: main: Assertion 
`syscall(__NR_clock_nanosleep, CLOCK_REALTIME, TIMER_ABSTIME, &req.ts, &rem.ts) 
== -1' failed.
--- SIGABRT {si_signo=SIGABRT, si_code=SI_TKILL, si_pid=1609, si_uid=399} ---
+++ killed by SIGABRT (core dumped) +++
Aborted (core dumped)

pselect6 also fails:

$ ../strace -e pselect6 ./pselect6 >/dev/null
pselect6(5, [3 4], [3 4], [1 2], NULL, {NULL, 8}) = 1 (out [4])
pselect6(5, NULL, [1 2 3 4], NULL, {tv_sec=789985, tv_nsec=789986}, NULL) = 3 
(out [1 2 4], left {tv_sec=789985, tv_nsec=708986})
pselect6(-1, NULL, 0xd0006338, NULL, NULL, {[HUP CHLD], 8}) = -1 EINVAL 
(Invalid argument)
pselect6(1025, [3], [], NULL, {tv_sec=0, tv_nsec=123}, {[HUP CHLD], 8}) = 0 
(Timeout)
pselect6(0, NULL, NULL, NULL, {tv_sec=-559038737, tv_nsec=4207869677}, {NULL, 
8}) = -1 EINVAL (Invalid argument)
pselect6(0, NULL, NULL, NULL, {tv_sec=-559038737, tv_nsec=4207869677}, {NULL, 
8}) = -1 EINVAL (Invalid argument)
pselect6(0, NULL, NULL, NULL, {tv_sec=0, tv_nsec=2}, {[HUP CHLD], 8}) = 
? ERESTARTNOHAND (To be restarted if no handler)
--- SIGALRM {si_signo=SIGALRM, si_code=SI_KERNEL} ---
pselect6(0, NULL, NULL, NULL, {tv_sec=0, tv_nsec=92750222}, {[HUP CHLD], 8}) = 
0 (Timeout)
pselect6: pselect6.c:156: main: Assertion `pselect(0, NULL, NULL, NULL, &tm.ts, 
&mask) == -1' failed.
--- SIGABRT {si_signo=SIGABRT, si_code=SI_TKILL, si_pid=1631, si_uid=399} ---
+++ killed by SIGABRT (core dumped) +++
Aborted (core dumped)

Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


Re: strace 4.17 testsuite failures

2017-06-04 Thread Andreas Schwab
On Mai 26 2017, Andreas Schwab  wrote:

> I see the following failing tests on powerpc64:
>
> FAIL: clock.gen
> FAIL: regex.gen
> FAIL: sched.gen
> FAIL: sendfile.gen
> FAIL: trace_fstat.gen
> FAIL: trace_fstatfs.gen
> FAIL: trace_lstat.gen
> FAIL: trace_question.gen
> FAIL: trace_stat.gen
> FAIL: trace_stat_like.gen
> FAIL: trace_statfs.gen
> FAIL: trace_statfs_like.gen

They are all hanging in sendfile.

$ ./sendfile
sendfile(0, 1, NULL, 65536) = -1 EBADF (Bad file descriptor)
sendfile(0, 1, 0x1fd8, 65536) = -1 EFAULT (Bad address)
sendfile(4, 5, NULL, 66038) = 66038
sendfile(4, 5, 0x1fd7fffc, 66038) = -1 EFAULT (Bad address)

Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


strace 4.17 testsuite failures

2017-05-26 Thread Andreas Schwab
I see the following failing tests on powerpc64:

FAIL: clock.gen
FAIL: regex.gen
FAIL: sched.gen
FAIL: sendfile.gen
FAIL: trace_fstat.gen
FAIL: trace_fstatfs.gen
FAIL: trace_lstat.gen
FAIL: trace_question.gen
FAIL: trace_stat.gen
FAIL: trace_stat_like.gen
FAIL: trace_statfs.gen
FAIL: trace_statfs_like.gen

Here is the full log:

https://build.opensuse.org/package/live_build_log/home:AndreasSchwab/strace/13.1/ppc64

Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


strace-V test fails next year

2017-04-04 Thread Andreas Schwab
FAIL: strace-V
==

2c2
< Copyright (C) 1991-2017 The strace developers <https://strace.io>.
---
> Copyright (C) 1991-2018 The strace developers <https://strace.io>.
strace-V.test: failed test: ../strace -V output mismatch

Andreas.

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


[PATCH] m68k: switch to PTRACE_GETREGS

2016-11-12 Thread Andreas Schwab
* Makefile.am (EXTRA_DIST): Add linux/m68k/arch_regs.h, remove
linux/m68k/get_syscall_result.c.
* linux/m68k/arch_regs.c (m68k_d0, ARCH_PC_PEEK_ADDR): Don't
define.
(m68k_regs, m68k_usp_ptr, ARCH_PC_REG, ARCH_REGS_FOR_GETREGS):
Define.
* linux/m68k/arch_regs.h: New file.
* linux/m68k/arch_sigreturn.c (arch_sigreturn): Use m68k_usp_ptr.
* linux/m68k/get_error.c (get_error): Use m68k_regs.d0.
* linux/m68k/get_scno.c (arch_get_scno): Use m68k_regs.orig_d0.
* linux/m68k/get_syscall_args.c (get_syscall_args): Use m68k_regs.
* linux/m68k/get_syscall_result.c: Remove.
---
 Makefile.am |  2 +-
 linux/m68k/arch_regs.c  |  6 --
 linux/m68k/arch_regs.h  |  1 +
 linux/m68k/arch_sigreturn.c |  4 +---
 linux/m68k/get_error.c  |  6 +++---
 linux/m68k/get_scno.c   |  3 ++-
 linux/m68k/get_syscall_args.c   | 11 ++-
 linux/m68k/get_syscall_result.c |  5 -
 8 files changed, 18 insertions(+), 20 deletions(-)
 create mode 100644 linux/m68k/arch_regs.h
 delete mode 100644 linux/m68k/get_syscall_result.c

diff --git a/Makefile.am b/Makefile.am
index c44231bcde..f4dbf8387f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -415,11 +415,11 @@ EXTRA_DIST =  \
linux/ia64/userent.h\
linux/inet_diag.h   \
linux/m68k/arch_regs.c  \
+   linux/m68k/arch_regs.h  \
linux/m68k/arch_sigreturn.c \
linux/m68k/get_error.c  \
linux/m68k/get_scno.c   \
linux/m68k/get_syscall_args.c   \
-   linux/m68k/get_syscall_result.c \
linux/m68k/ioctls_arch0.h   \
linux/m68k/ioctls_inc0.h\
linux/m68k/syscallent.h \
diff --git a/linux/m68k/arch_regs.c b/linux/m68k/arch_regs.c
index 8f0ab79ad6..1198762b07 100644
--- a/linux/m68k/arch_regs.c
+++ b/linux/m68k/arch_regs.c
@@ -1,2 +1,4 @@
-static long m68k_d0;
-#define ARCH_PC_PEEK_ADDR (4 * PT_PC)
+static struct user_regs_struct m68k_regs;
+long *const m68k_usp_ptr = &m68k_regs.usp;
+#define ARCH_PC_REG m68k_regs.pc
+#define ARCH_REGS_FOR_GETREGS m68k_regs
diff --git a/linux/m68k/arch_regs.h b/linux/m68k/arch_regs.h
new file mode 100644
index 00..08293365e3
--- /dev/null
+++ b/linux/m68k/arch_regs.h
@@ -0,0 +1 @@
+extern long *const m68k_usp_ptr;
diff --git a/linux/m68k/arch_sigreturn.c b/linux/m68k/arch_sigreturn.c
index 0011c1748f..12e8bded6d 100644
--- a/linux/m68k/arch_sigreturn.c
+++ b/linux/m68k/arch_sigreturn.c
@@ -3,10 +3,8 @@ arch_sigreturn(struct tcb *tcp)
 {
long addr;
 
-   if (upeek(tcp->pid, 4*PT_USP, &addr) < 0)
-   return;
/* Fetch pointer to struct sigcontext.  */
-   if (umove(tcp, addr + 2 * sizeof(int), &addr) < 0)
+   if (umove(tcp, *m68k_usp_ptr + 2 * sizeof(int), &addr) < 0)
return;
 
unsigned long mask[NSIG / 8 / sizeof(long)];
diff --git a/linux/m68k/get_error.c b/linux/m68k/get_error.c
index a792835d4a..3ad51a08d3 100644
--- a/linux/m68k/get_error.c
+++ b/linux/m68k/get_error.c
@@ -1,10 +1,10 @@
 static void
 get_error(struct tcb *tcp, const bool check_errno)
 {
-   if (check_errno && is_negated_errno(m68k_d0)) {
+   if (check_errno && is_negated_errno(m68k_regs.d0)) {
tcp->u_rval = -1;
-   tcp->u_error = -m68k_d0;
+   tcp->u_error = -m68k_regs.d0;
} else {
-   tcp->u_rval = m68k_d0;
+   tcp->u_rval = m68k_regs.d0;
}
 }
diff --git a/linux/m68k/get_scno.c b/linux/m68k/get_scno.c
index 716a761618..829f3477cd 100644
--- a/linux/m68k/get_scno.c
+++ b/linux/m68k/get_scno.c
@@ -2,5 +2,6 @@
 static int
 arch_get_scno(struct tcb *tcp)
 {
-   return upeek(tcp->pid, 4 * PT_ORIG_D0, &tcp->scno) < 0 ? -1 : 1;
+   tcp->scno = m68k_regs.orig_d0;
+   return 1;
 }
diff --git a/linux/m68k/get_syscall_args.c b/linux/m68k/get_syscall_args.c
index bc69a1957c..8ec3d28165 100644
--- a/linux/m68k/get_syscall_args.c
+++ b/linux/m68k/get_syscall_args.c
@@ -2,10 +2,11 @@
 static int
 get_syscall_args(struct tcb *tcp)
 {
-   unsigned int i;
-
-   for (i = 0; i < tcp->s_ent->nargs; ++i)
-   if (upeek(tcp->pid, (i < 5 ? i : i + 2)*4, &tcp->u_arg[i]) < 0)
-   return -1;
+   tcp->u_arg[0] = m68k_regs.d1;
+   tcp->u_arg[1] = m68k_regs.d2;
+   tcp->u_arg[2] = m68k_regs.d3;
+   tcp->u_arg[3] = m68k_regs.d4;
+   tcp->u_arg[4] = m68k_regs.d5;
+   tcp->u_arg[5] = m68k_regs.a0;
return 1;
 }
diff --git a/linux/m68k/get_syscall_result.c b/linux/m68k/get_syscall_result.c
deleted file mode 100644
index 005cf60cd7..00
--- a/linux/m68k/get_syscall_result.c
+++ /dev/null
@@ -1,5 +0,0 @@
-static int
-get_syscall_result_regs(struct tcb *tcp)
-{
-   return upeek(tcp->pid, 4 * PT_D0, &m68k_d0) <

[PATCH] Don't run old_mmap test on m68k

2016-11-12 Thread Andreas Schwab
* tests/old_mmap.c: Skip test on m68k.
---
 tests/old_mmap.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/tests/old_mmap.c b/tests/old_mmap.c
index de1bafb367..2725fb754e 100644
--- a/tests/old_mmap.c
+++ b/tests/old_mmap.c
@@ -31,7 +31,7 @@
 #include 
 
 /*
- * On s390x, this is the mmap syscall used by glibc, so,
+ * On s390x and m68k, this is the mmap syscall used by glibc, so,
  * from one side, it's already covered by another test, and, from another side,
  * it would require additional efforts to filter out mmap calls made by glibc.
  */
@@ -39,7 +39,6 @@
 #if defined __NR_mmap && \
 (   defined __arm__ \
  || defined __i386__ \
- || defined __m68k__ \
  || (defined __s390__ && !defined __s390x__) \
 )
 
@@ -96,7 +95,7 @@ main(void)
 
 #else
 
-SKIP_MAIN_UNDEFINED("__NR_mmap && (__arm__ || __i386__ || __m68k__"
+SKIP_MAIN_UNDEFINED("__NR_mmap && (__arm__ || __i386__"
" || (__s390__ && !__s390x__))")
 
 #endif
-- 
2.10.2


-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

--
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


Re: strace 4.14 released

2016-10-05 Thread Andreas Schwab
On Okt 05 2016, Eugene Syromyatnikov 
 wrote:

> On Wed, Oct 5, 2016 at 9:35 AM, Andreas Schwab 
>  wrote:
>> On Okt 05 2016, Eugene Syromyatnikov 
>>  
>> wrote:
>>
>>> May be you have any ideas regarding possibilities of fixing the
>>> environment in order to get nanosleep?
>>
>> What do you mean with "in order to get nanosleep"?
> In order to get nanosleep with usable precision, sorry.

What is a "usable precision"?  The only guarantee is that it isn't
shorter.

Andreas.

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

--
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


Re: strace 4.14 released

2016-10-05 Thread Andreas Schwab
On Okt 05 2016, Eugene Syromyatnikov 
 wrote:

> May be you have any ideas regarding possibilities of fixing the
> environment in order to get nanosleep?

What do you mean with "in order to get nanosleep"?

Andreas.

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

--
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


Re: strace 4.14 released

2016-10-05 Thread Andreas Schwab
I'm seeing this testsuite failure:

https://build.opensuse.org/package/live_build_log/home:Andreas_Schwab:Factory/strace/s/s390x

FAIL: count
===

Pattern of expected output:  *[^ ]+ +(1\.[01]|0\.99)[^n]*nanosleep
Actual output:
% time seconds  usecs/call callserrors syscall
-- --- --- - - 
 99.971.286494 1286494 1   nanosleep
  0.010.000102 102 1   execve
  0.010.77  13 6   mmap
  0.000.40  13 3   mprotect
  0.000.26  13 2   open
  0.000.22  11 2   close
  0.000.22  11 2   fstat
  0.000.14  14 1   munmap
  0.000.13  13 1 1 access
  0.000.12  12 1   read
  0.000.12  12 1   brk
-- --- --- - - 
100.001.28683421 1 total
count.test: failed test: ../strace -cw ./sleep 1 output mismatch


Andreas.

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

--
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


Re: [PATCH v3 2/2] tests: Workaroud for buggy glibc in ipc_msg test on ppc64

2016-09-13 Thread Andreas Schwab
On Sep 13 2016, Eugene Syromyatnikov 
 wrote:

> On Tue, Sep 13, 2016 at 7:32 AM, Andreas Schwab 
>  wrote:
>> On Sep 13 2016, Eugene Syromyatnikov 
>>  
>> wrote:
>>
>>> glibc before 2.23 (glibc-2.22-122-gbe48165? to be more precise) tried to 
>>> access
>>> data pointed by third argument of msgctl call on 64-bit PowerPC which led to
>>> segmentataion fault (instead of EFAULT from kernel).
>>
>> Which is a perfectly valid thing to do, as passing an invalid pointer to
>> msgctl (the libc function) invokes undefined behaviour.  If you want to
>> test the kernel behaviour you need to talk to the kernel directly.
> Well, http://man7.org/linux/man-pages/man2/msgctl.2.html documents
> this case as EFAULT (and I assume it documents glibc wrapper since it
> usually does so and kernel interface is architecture-dependent).

Section 2 manpages document the kernel syscalls.  You can never count on
EFAULT unless talking to the kernel directly.

Andreas.

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

--
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


Re: [PATCH v3 2/2] tests: Workaroud for buggy glibc in ipc_msg test on ppc64

2016-09-13 Thread Andreas Schwab
On Sep 13 2016, Eugene Syromyatnikov 
 wrote:

> glibc before 2.23 (glibc-2.22-122-gbe48165? to be more precise) tried to 
> access
> data pointed by third argument of msgctl call on 64-bit PowerPC which led to
> segmentataion fault (instead of EFAULT from kernel).

Which is a perfectly valid thing to do, as passing an invalid pointer to
msgctl (the libc function) invokes undefined behaviour.  If you want to
test the kernel behaviour you need to talk to the kernel directly.

Andreas.

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

--
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


Testsuite failures on ppc64le

2016-08-15 Thread Andreas Schwab
64
stat64.test: skipped test: ./stat64 exited with code 77

SKIP: sync_file_range
=

undefined: HAVE_SYNC_FILE_RANGE && __NR_sync_file_range
sync_file_range.test: skipped test: ./sync_file_range exited with code 77

SKIP: truncate64


undefined: __NR_truncate64
truncate64.test: skipped test: ./truncate64 exited with code 77

FAIL: redirect
==

redirect.test: failed test: ../strace failed to redirect standard input

Andreas.

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

--
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity 
planning reports. http://sdm.link/zohodev2dev
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


Re: strace 4.13 testsuite failure on s390x

2016-07-29 Thread Andreas Schwab
est: ./netlink_unix_diag exited with code 77

SKIP: old_mmap
==

undefined: __NR_mmap && (__arm__ || __i386__ || __m68k__ || (__s390__ && 
!__s390x__))
old_mmap.test: skipped test: ./old_mmap exited with code 77

SKIP: oldselect
===

undefined: __NR_select && __NR__newselect
oldselect.test: skipped test: ./oldselect exited with code 77

SKIP: preadv2-pwritev2
==

undefined: __NR_preadv2 && __NR_pwritev2
preadv2-pwritev2.test: skipped test: ./preadv2-pwritev2 exited with code 77

SKIP: readdir
=

readdir: Function not implemented
readdir.test: skipped test: ./readdir exited with code 77

SKIP: renameat2
===

undefined: __NR_renameat2
renameat2.test: skipped test: ./renameat2 exited with code 77

SKIP: sched_xetattr
===

undefined: __NR_sched_getattr && __NR_sched_setattr
sched_xetattr.test: skipped test: ./sched_xetattr exited with code 77

SKIP: seccomp-filter-v
==

undefined: __NR_seccomp && PR_SET_NO_NEW_PRIVS && SECCOMP_SET_MODE_FILTER && 
SECCOMP_RET_ERRNO && BPF_JUMP && BPF_STMT
seccomp-filter-v.test: skipped test: ./seccomp-filter-v exited with code 77

SKIP: seccomp-filter


undefined: __NR_seccomp && SECCOMP_SET_MODE_FILTER
seccomp-filter.test: skipped test: ./seccomp-filter exited with code 77

SKIP: seccomp-strict


undefined: __NR_seccomp && __NR_exit
seccomp-strict.test: skipped test: ./seccomp-strict exited with code 77

SKIP: sendfile64


undefined: __NR_sendfile64
sendfile64.test: skipped test: ./sendfile64 exited with code 77

SKIP: set_mempolicy
===

undefined: __NR_set_mempolicy
set_mempolicy.test: skipped test: ./set_mempolicy exited with code 77

SKIP: setfsgid32


undefined: __NR_setfsgid32
setfsgid32.test: skipped test: ./setfsgid32 exited with code 77

SKIP: setfsuid32


undefined: __NR_setfsuid32
setfsuid32.test: skipped test: ./setfsuid32 exited with code 77

SKIP: setgid32
==

undefined: __NR_setgid32
setgid32.test: skipped test: ./setgid32 exited with code 77

SKIP: setgroups32
=

undefined: __NR_setgroups32
setgroups32.test: skipped test: ./setgroups32 exited with code 77

SKIP: setregid32


undefined: __NR_setregid32
setregid32.test: skipped test: ./setregid32 exited with code 77

SKIP: setresgid32
=

undefined: __NR_setresgid32
setresgid32.test: skipped test: ./setresgid32 exited with code 77

SKIP: setresuid32
=

undefined: __NR_setresuid32
setresuid32.test: skipped test: ./setresuid32 exited with code 77

SKIP: setreuid32


undefined: __NR_setreuid32
setreuid32.test: skipped test: ./setreuid32 exited with code 77

SKIP: setuid32
==

undefined: __NR_setuid32
setuid32.test: skipped test: ./setuid32 exited with code 77

SKIP: stat64


undefined: __NR_stat64
stat64.test: skipped test: ./stat64 exited with code 77

SKIP: sync_file_range2
==

undefined: HAVE_SYNC_FILE_RANGE && __NR_sync_file_range2
sync_file_range2.test: skipped test: ./sync_file_range2 exited with code 77

SKIP: time
==

undefined: __NR_time
time.test: skipped test: ./time exited with code 77

SKIP: truncate64


undefined: __NR_truncate64
truncate64.test: skipped test: ./truncate64 exited with code 77

SKIP: ugetrlimit


undefined: __NR_ugetrlimit
ugetrlimit.test: skipped test: ./ugetrlimit exited with code 77

SKIP: userfaultfd
=

undefined: __NR_userfaultfd && O_CLOEXEC
userfaultfd.test: skipped test: ./userfaultfd exited with code 77

SKIP: waitpid
=

undefined: __NR_waitpid
waitpid.test: skipped test: ./waitpid exited with code 77

FAIL: count
===

Pattern of expected output:  *[^ ]+ +(1\.[01]|0\.99)[^n]*nanosleep
Actual output:
% time seconds  usecs/call callserrors syscall
-- --- --- - - 
 99.991.200578 1200578 1   nanosleep
  0.010.83  83 1   execve
  0.000.21   3 8   mmap
  0.000.11   4 3   mprotect
  0.000.06   3 2   open
  0.000.06   6 1   munmap
  0.000.04   2 2   close
  0.000.04   2 2   fstat
  0.000.03   3 1 1 access
  0.000.02   2 1   read
  0.000.02   2 1   brk
-- --- --- - - 
100.001.20072023 1 total
count.test: failed test: ../strace -cw ./sleep 1 output mismatch

SKIP: pc


s390: si_a

strace 4.13 testsuite failure on s390x

2016-07-29 Thread Andreas Schwab
tresgid32
setresgid32.test: skipped test: ./setresgid32 exited with code 77

SKIP: setresuid32
=

undefined: __NR_setresuid32
setresuid32.test: skipped test: ./setresuid32 exited with code 77

SKIP: setreuid32


undefined: __NR_setreuid32
setreuid32.test: skipped test: ./setreuid32 exited with code 77

SKIP: setuid32
==

undefined: __NR_setuid32
setuid32.test: skipped test: ./setuid32 exited with code 77

SKIP: stat64


undefined: __NR_stat64
stat64.test: skipped test: ./stat64 exited with code 77

SKIP: sync_file_range2
==

undefined: HAVE_SYNC_FILE_RANGE && __NR_sync_file_range2
sync_file_range2.test: skipped test: ./sync_file_range2 exited with code 77

SKIP: time
==

undefined: __NR_time
time.test: skipped test: ./time exited with code 77

SKIP: truncate64


undefined: __NR_truncate64
truncate64.test: skipped test: ./truncate64 exited with code 77

SKIP: ugetrlimit


undefined: __NR_ugetrlimit
ugetrlimit.test: skipped test: ./ugetrlimit exited with code 77

SKIP: waitpid
=

undefined: __NR_waitpid
waitpid.test: skipped test: ./waitpid exited with code 77

FAIL: attach-p-cmd
==

1,2d0
< 15263 chdir("attach-p-cmd.test cmd") = -1 ENOENT (No such file or directory)
< 15263 +++ exited with 0 +++
5a4,5
> 15263 chdir("attach-p-cmd.test cmd") = -1 ENOENT (No such file or directory)
> 15263 +++ exited with 0 +++
attach-p-cmd.test: failed test: ../strace -a30 -echdir -p 15260 
./attach-p-cmd-cmd output mismatch

SKIP: pc


s390: si_addr is unreliable
pc.test: skipped test: ./pc exited with code 77

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

--
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


Re: [GSOC] 4.11, 4.12 build results on Open Build Service

2016-06-03 Thread Andreas Schwab
Yun-Chih Chen 
writes:

> There are some failed tests in each repository.  In particular,
> there is a major failure in armv6l in both repo.

armv6l is built using the QEMU linux-user emulation, which does not
implement ptrace(2), thus all tests are meaningless.

Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

--
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity 
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


Re: [PATCH] Add support for Altera's Nios-II softcore architecture

2015-04-25 Thread Andreas Schwab
Ezequiel Garcia
 writes:

> The pc test also fails consistently, claiming a pattern mismatch, but I fail
> to see where.

\[pid +3273\] \[26e8\] --- SIGSEGV \{si_signo=SIGSEGV, si_code=SEGV_MAPERR, 
si_addr=0x26e8\} ---
[pid  3273] [26e8] --- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, 
si_addr=0x2000} ---

Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

--
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


Re: [PATCH v2] Fix crash in ipc_sem test

2015-03-22 Thread Andreas Schwab
Mike Frysinger  writes:

> On 22 Mar 2015 10:08, Andreas Schwab wrote:
>> Mike Frysinger 
>>  
>> writes:
>> > with the older ipc_sem (before 4ed340bae64c84897fa7e42f6142592ef899f0cd), 
>> > building that ipc_sem and running strace on it creates an unkillable proc.
>> 
>> Except that this has nothing to do with the test case, only with your
>> use of setarch.
>
> i'm not sure what point you're trying to make.

The only test case is your use of setarch.  Nothing more, nothing less.

Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


Re: [PATCH v2] Fix crash in ipc_sem test

2015-03-22 Thread Andreas Schwab
Mike Frysinger  writes:

> with the older ipc_sem (before 4ed340bae64c84897fa7e42f6142592ef899f0cd), 
> building that ipc_sem and running strace on it creates an unkillable proc.

Except that this has nothing to do with the test case, only with your
use of setarch.

Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


Re: FAIL: strace-k

2015-03-19 Thread Andreas Schwab
Masatake YAMATO  writes:

> About aarch64, could you try a patch at the end of this mail?

UNW_EBADREG

Andreas.

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


FAIL: strace-k

2015-03-19 Thread Andreas Schwab
I see the strace-k test failing on ppc, ppc64 and aarch64.

getpid()= 10154
 > /home/abuild/rpmbuild/BUILD/strace-4.10/tests/stack-fcall(f3+0x18) [0x548]
 > /home/abuild/rpmbuild/BUILD/strace-4.10/tests/stack-fcall(f2+0x18) [0x518]
 > /home/abuild/rpmbuild/BUILD/strace-4.10/tests/stack-fcall(f1+0x18) [0x4e8]
 > /home/abuild/rpmbuild/BUILD/strace-4.10/tests/stack-fcall(f0+0x18) [0x4b8]
 > /home/abuild/rpmbuild/BUILD/strace-4.10/tests/stack-fcall(main+0x10) [0x340]
 > /lib/libc-2.21.so(generic_start_main.isra.0+0x114) [0x21c58]
 > /lib/libc-2.21.so(__syscall_error+0x0) [0x21e1c]
+++ exited with 0 +++
expected: "getpid f3 f2 f1 f0 main "
result: "f3 f2 f1 f0 main "

getpid()= 10176
 > /lib64/libc-2.21.so() [0xf446c]
 > /home/abuild/rpmbuild/BUILD/strace-4.10/tests/stack-fcall() [0x6d8]
 > /home/abuild/rpmbuild/BUILD/strace-4.10/tests/stack-fcall() [0x688]
 > /home/abuild/rpmbuild/BUILD/strace-4.10/tests/stack-fcall() [0x638]
 > /home/abuild/rpmbuild/BUILD/strace-4.10/tests/stack-fcall() [0x5e8]
 > /home/abuild/rpmbuild/BUILD/strace-4.10/tests/stack-fcall() [0x3e0]
 > /lib64/libc-2.21.so() [0x4686c]
 > /lib64/libc-2.21.so() [0x46ab4]
+++ exited with 0 +++
expected: "getpid f3 f2 f1 f0 main "
result: ""

getpid()= 21387
../strace: Can't initiate libunwind: Input/output error
Process 21387 detached

Andreas.

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


Re: [PATCH v2] Fix crash in ipc_sem test

2015-03-17 Thread Andreas Schwab
Mike Frysinger  writes:

> the kernel is still broken,

In which way?

Andreas.

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


[PATCH] tests: verify that all patterns match.

2015-03-16 Thread Andreas Schwab
* tests/ipc_msg.test: Count matches to verify that all patterns match.
* tests/ipc_sem.test: Likewise.
* tests/ipc_shm.test: Likewise.
* tests/stat32-v.test: Likewise.
* tests/stat64-v.test: Likewise.
---
 tests/ipc_msg.test  | 6 --
 tests/ipc_sem.test  | 4 +++-
 tests/ipc_shm.test  | 6 --
 tests/stat32-v.test | 4 +++-
 tests/stat64-v.test | 4 +++-
 5 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/tests/ipc_msg.test b/tests/ipc_msg.test
index b1ebe6d..e0d27ed 100755
--- a/tests/ipc_msg.test
+++ b/tests/ipc_msg.test
@@ -16,9 +16,11 @@ OUT="$LOG.out"
fi
 }
 
-args="-eipc ./ipc_msg $f"
+args="-eipc ./ipc_msg"
 $STRACE -o "$LOG" $args > "$OUT" &&
-LC_ALL=C grep -E -x -f "$OUT" "$LOG" > /dev/null || {
+exp_lines=$(wc -l < "$OUT") &&
+matched_lines=$(LC_ALL=C grep -c -E -x -f "$OUT" "$LOG") &&
+test $exp_lines -eq $matched_lines || {
cat "$OUT" "$LOG"
fail_ "$STRACE $args output mismatch"
 }
diff --git a/tests/ipc_sem.test b/tests/ipc_sem.test
index b8fa545..ef957c3 100755
--- a/tests/ipc_sem.test
+++ b/tests/ipc_sem.test
@@ -18,7 +18,9 @@ OUT="$LOG.out"
 
 args='-eipc ./ipc_sem'
 $STRACE -o "$LOG" $args > "$OUT" &&
-LC_ALL=C grep -E -x -f "$OUT" "$LOG" > /dev/null || {
+exp_lines=$(wc -l < "$OUT") &&
+matched_lines=$(LC_ALL=C grep -c -E -x -f "$OUT" "$LOG") &&
+test $exp_lines -eq $matched_lines || {
cat "$OUT" "$LOG"
fail_ "$STRACE $args output mismatch"
 }
diff --git a/tests/ipc_shm.test b/tests/ipc_shm.test
index b09dc2b..de8b47c 100755
--- a/tests/ipc_shm.test
+++ b/tests/ipc_shm.test
@@ -16,9 +16,11 @@ OUT="$LOG.out"
fi
 }
 
-args="-eipc ./ipc_shm $f"
+args="-eipc ./ipc_shm"
 $STRACE -o "$LOG" $args > "$OUT" &&
-LC_ALL=C grep -E -x -f "$OUT" "$LOG" > /dev/null || {
+exp_lines=$(wc -l < "$OUT") &&
+matched_lines=$(LC_ALL=C grep -c -E -x -f "$OUT" "$LOG") &&
+test $exp_lines -eq $matched_lines || {
cat "$OUT" "$LOG"
fail_ "$STRACE $args output mismatch"
 }
diff --git a/tests/stat32-v.test b/tests/stat32-v.test
index 7f8cb4a..67eb5ed 100755
--- a/tests/stat32-v.test
+++ b/tests/stat32-v.test
@@ -33,7 +33,9 @@ touch -t 0102030405 $sample
 for f in $sample . /dev/null; do
args="-v -efile ./stat32 $f"
$STRACE -o "$LOG" $args > "$OUT" &&
-   LC_ALL=C grep -E -x -f "$OUT" "$LOG" > /dev/null || {
+   exp_lines=$(wc -l < "$OUT") &&
+   matched_lines=$(LC_ALL=C grep -c -E -x -f "$OUT" "$LOG") &&
+   test $exp_lines -eq $matched_lines || {
cat "$OUT" "$LOG"
fail_ "$STRACE $args output mismatch"
}
diff --git a/tests/stat64-v.test b/tests/stat64-v.test
index f03254a..785403d 100755
--- a/tests/stat64-v.test
+++ b/tests/stat64-v.test
@@ -27,7 +27,9 @@ touch -d '1970-01-01 -42 seconds' $sample
 for f in $sample . /dev/null; do
args="-v -efile ./stat $f"
$STRACE -o "$LOG" $args > "$OUT" &&
-   LC_ALL=C grep -E -x -f "$OUT" "$LOG" > /dev/null || {
+   exp_lines=$(wc -l < "$OUT") &&
+   matched_lines=$(LC_ALL=C grep -c -E -x -f "$OUT" "$LOG") &&
+   test $exp_lines -eq $matched_lines || {
cat "$OUT" "$LOG"
fail_ "$STRACE $args output mismatch"
}
-- 
2.3.3


-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


Re: [PATCH] tests/ipc_sem: don't match address of sem buffer

2015-03-16 Thread Andreas Schwab
"Dmitry V. Levin"  writes:

> On Thu, Mar 12, 2015 at 11:13:49AM +0100, Andreas Schwab wrote:
>> "Dmitry V. Levin" 
>>  writes:
>> > On Wed, Mar 11, 2015 at 01:07:15PM +0100, Andreas Schwab wrote:
>> >> On architectures where the semctl call is implemented by the ipc syscall
>> >> the glibc wrapper passes a pointer to a local variable, so the value of
>> >> the fourth argument is unknown.
>> >
>> > Wouldn't it be better to fix the parser, e.g.
>> >
>> > --- a/ipc.c
>> > +++ b/ipc.c
>> > @@ -281,7 +281,16 @@ int sys_semctl(struct tcb *tcp)
>> >if (entering(tcp)) {
>> >tprintf("%lu, %lu, ", tcp->u_arg[0], tcp->u_arg[1]);
>> >PRINTCTL(semctl_flags, tcp->u_arg[2], "SEM_???");
>> > -  tprintf(", %#lx", tcp->u_arg[3]);
>> > +  tprints(", ");
>> > +  if (indirect_ipccall(tcp)) {
>> > +  if (current_wordsize == sizeof(int)) {
>> > +  printnum_int(tcp, tcp->u_arg[3], "%#x");
>> > +  } else {
>> > +  printnum_long(tcp, tcp->u_arg[3], "%#lx");
>> > +  }
>> 
>> That prints [...] instead of just the number, though.
>
> Yes, of course it does.

This patch is needed on top.

diff --git a/tests/ipc_sem.c b/tests/ipc_sem.c
index d92ec60..345fc8a 100644
--- a/tests/ipc_sem.c
+++ b/tests/ipc_sem.c
@@ -26,13 +26,13 @@ main(void)
un.buf = &ds;
if (semctl(id, 0, IPC_STAT, un))
goto fail;
-   printf("semctl\\(%d, 0, (IPC_64\\|)?IPC_STAT, %p\\) += 0\n", id, &ds);
+   printf("semctl\\(%d, 0, (IPC_64\\|)?IPC_STAT, \\[?%p\\]?\\) += 0\n", 
id, &ds);
 
un.__buf = &info;
int max = semctl(0, 0, SEM_INFO, un);
if (max < 0)
goto fail;
-   printf("semctl\\(0, 0, (IPC_64\\|)?SEM_INFO, %p\\) += %d\n", &info, 
max);
+   printf("semctl\\(0, 0, (IPC_64\\|)?SEM_INFO, \\[?%p\\]?\\) += %d\n", 
&info, max);
 
un.buf = &ds;
rc = semctl(id, 0, SEM_STAT, un);
@@ -43,16 +43,16 @@ main(void)
 */
if (-1 != rc || EINVAL != errno)
goto fail;
-   printf("semctl\\(%d, 0, (IPC_64\\|)?SEM_STAT, %p\\) += -1 
EINVAL \\(Invalid argument\\)\n", id, &ds);
+   printf("semctl\\(%d, 0, (IPC_64\\|)?SEM_STAT, \\[?%p\\]?\\) += 
-1 EINVAL \\(Invalid argument\\)\n", id, &ds);
} else {
-   printf("semctl\\(%d, 0, (IPC_64\\|)?SEM_STAT, %p\\) += %d\n", 
id, &ds, id);
+   printf("semctl\\(%d, 0, (IPC_64\\|)?SEM_STAT, \\[?%p\\]?\\) += 
%d\n", id, &ds, id);
}
 
rc = 0;
 done:
if (semctl(id, 0, IPC_RMID, 0) < 0)
return 1;
-   printf("semctl\\(%d, 0, (IPC_64\\|)?IPC_RMID, 0\\) += 0\n", id);
+   printf("semctl\\(%d, 0, (IPC_64\\|)?IPC_RMID, \\[?0\\]?\\) += 0\n", id);
return rc;
 
 fail:


Andreas.

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


[PATCH] tests/ipc_*: match IPC_64 flag

2015-03-16 Thread Andreas Schwab
* ipc_msg.c (main): Optionally match "IPC_64|" in the third
argument of the ipc call.
* ipc_sem.c (main): Likewise.
* ipc_shm.c (main): Likewise.
---
 tests/ipc_msg.c | 10 +-
 tests/ipc_sem.c | 10 +-
 tests/ipc_shm.c | 10 +-
 3 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/tests/ipc_msg.c b/tests/ipc_msg.c
index 1917086..ed2bfd6 100644
--- a/tests/ipc_msg.c
+++ b/tests/ipc_msg.c
@@ -15,12 +15,12 @@ main(void)
 
if (msgctl(id, IPC_STAT, &ds))
goto fail;
-   printf("msgctl\\(%d, IPC_STAT, %p\\) += 0\n", id, &ds);
+   printf("msgctl\\(%d, (IPC_64\\|)?IPC_STAT, %p\\) += 0\n", id, &ds);
 
int max = msgctl(0, MSG_INFO, &ds);
if (max < 0)
goto fail;
-   printf("msgctl\\(0, MSG_INFO, %p\\) += %d\n", &ds, max);
+   printf("msgctl\\(0, (IPC_64\\|)?MSG_INFO, %p\\) += %d\n", &ds, max);
 
rc = msgctl(id, MSG_STAT, &ds);
if (rc != id) {
@@ -30,16 +30,16 @@ main(void)
 */
if (-1 != rc || EINVAL != errno)
goto fail;
-   printf("msgctl\\(%d, MSG_STAT, %p\\) += -1 EINVAL \\(Invalid 
argument\\)\n", id, &ds);
+   printf("msgctl\\(%d, (IPC_64\\|)?MSG_STAT, %p\\) += -1 EINVAL 
\\(Invalid argument\\)\n", id, &ds);
} else {
-   printf("msgctl\\(%d, MSG_STAT, %p\\) += %d\n", id, &ds, id);
+   printf("msgctl\\(%d, (IPC_64\\|)?MSG_STAT, %p\\) += %d\n", id, 
&ds, id);
}
 
rc = 0;
 done:
if (msgctl(id, IPC_RMID, 0) < 0)
return 1;
-   printf("msgctl\\(%d, IPC_RMID, 0\\) += 0\n", id);
+   printf("msgctl\\(%d, (IPC_64\\|)?IPC_RMID, 0\\) += 0\n", id);
return rc;
 
 fail:
diff --git a/tests/ipc_sem.c b/tests/ipc_sem.c
index 9373482..d92ec60 100644
--- a/tests/ipc_sem.c
+++ b/tests/ipc_sem.c
@@ -26,13 +26,13 @@ main(void)
un.buf = &ds;
if (semctl(id, 0, IPC_STAT, un))
goto fail;
-   printf("semctl\\(%d, 0, IPC_STAT, %p\\) += 0\n", id, &ds);
+   printf("semctl\\(%d, 0, (IPC_64\\|)?IPC_STAT, %p\\) += 0\n", id, &ds);
 
un.__buf = &info;
int max = semctl(0, 0, SEM_INFO, un);
if (max < 0)
goto fail;
-   printf("semctl\\(0, 0, SEM_INFO, %p\\) += %d\n", &info, max);
+   printf("semctl\\(0, 0, (IPC_64\\|)?SEM_INFO, %p\\) += %d\n", &info, 
max);
 
un.buf = &ds;
rc = semctl(id, 0, SEM_STAT, un);
@@ -43,16 +43,16 @@ main(void)
 */
if (-1 != rc || EINVAL != errno)
goto fail;
-   printf("semctl\\(%d, 0, SEM_STAT, %p\\) += -1 EINVAL \\(Invalid 
argument\\)\n", id, &ds);
+   printf("semctl\\(%d, 0, (IPC_64\\|)?SEM_STAT, %p\\) += -1 
EINVAL \\(Invalid argument\\)\n", id, &ds);
} else {
-   printf("semctl\\(%d, 0, SEM_STAT, %p\\) += %d\n", id, &ds, id);
+   printf("semctl\\(%d, 0, (IPC_64\\|)?SEM_STAT, %p\\) += %d\n", 
id, &ds, id);
}
 
rc = 0;
 done:
if (semctl(id, 0, IPC_RMID, 0) < 0)
return 1;
-   printf("semctl\\(%d, 0, IPC_RMID, 0\\) += 0\n", id);
+   printf("semctl\\(%d, 0, (IPC_64\\|)?IPC_RMID, 0\\) += 0\n", id);
return rc;
 
 fail:
diff --git a/tests/ipc_shm.c b/tests/ipc_shm.c
index f1995d3..5888dc6 100644
--- a/tests/ipc_shm.c
+++ b/tests/ipc_shm.c
@@ -15,12 +15,12 @@ main(void)
 
if (shmctl(id, IPC_STAT, &ds))
goto fail;
-   printf("shmctl\\(%d, IPC_STAT, %p\\) += 0\n", id, &ds);
+   printf("shmctl\\(%d, (IPC_64\\|)?IPC_STAT, %p\\) += 0\n", id, &ds);
 
int max = shmctl(0, SHM_INFO, &ds);
if (max < 0)
goto fail;
-   printf("shmctl\\(0, SHM_INFO, %p\\) += %d\n", &ds, max);
+   printf("shmctl\\(0, (IPC_64\\|)?SHM_INFO, %p\\) += %d\n", &ds, max);
 
rc = shmctl(id, SHM_STAT, &ds);
if (rc != id) {
@@ -30,16 +30,16 @@ main(void)
 */
if (-1 != rc || EINVAL != errno)
goto fail;
-   printf("shmctl\\(%d, SHM_STAT, %p\\) += -1 EINVAL \\(Invalid 
argument\\)\n", id, &ds);
+   printf("shmctl\\(%d, (IPC_64\\|)?SHM_STAT, %p\\) += -1 EINVAL 
\\(Invalid argument\\)\n", id, &ds);
} else {
-   printf("shmctl\\(%d, SHM_STAT, %p\\) += %d\n", id, &ds, id);
+   printf("shmctl\\(%d, (IPC_64\\|)?SHM_STAT, %p\\) += %d\n", id, 
&ds, 

[PATCH v2] Fix crash in ipc_sem test

2015-03-16 Thread Andreas Schwab
Properly use union semun as argument of semctl.

* tests/ipc_sem.c (main): Properly use union semun as argument of
semctl.  Don't handle EFAULT specially.
* tests/ipc_sem.test: Revert last change.
---
 tests/ipc_sem.c| 24 
 tests/ipc_sem.test | 19 ---
 2 files changed, 20 insertions(+), 23 deletions(-)

diff --git a/tests/ipc_sem.c b/tests/ipc_sem.c
index ed4..9373482 100644
--- a/tests/ipc_sem.c
+++ b/tests/ipc_sem.c
@@ -2,10 +2,19 @@
 #include 
 #include 
 
+union semun {
+   int  val;/* Value for SETVAL */
+   struct semid_ds *buf;/* Buffer for IPC_STAT, IPC_SET */
+   unsigned short  *array;  /* Array for GETALL, SETALL */
+   struct seminfo  *__buf;  /* Buffer for IPC_INFO
+   (Linux-specific) */
+};
+
 int
 main(void)
 {
int rc, id;
+   union semun un;
struct semid_ds ds;
struct seminfo info;
 
@@ -14,16 +23,19 @@ main(void)
return 77;
printf("semget\\(IPC_PRIVATE, 1, 0600\\) += %d\n", id);
 
-   if (semctl(id, 0, IPC_STAT, &ds))
+   un.buf = &ds;
+   if (semctl(id, 0, IPC_STAT, un))
goto fail;
printf("semctl\\(%d, 0, IPC_STAT, %p\\) += 0\n", id, &ds);
 
-   int max = semctl(0, 0, SEM_INFO, &info);
+   un.__buf = &info;
+   int max = semctl(0, 0, SEM_INFO, un);
if (max < 0)
goto fail;
printf("semctl\\(0, 0, SEM_INFO, %p\\) += %d\n", &info, max);
 
-   rc = semctl(id, 0, SEM_STAT, &ds);
+   un.buf = &ds;
+   rc = semctl(id, 0, SEM_STAT, un);
if (rc != id) {
/*
 * In linux < v2.6.24-rc1 the first argument must be
@@ -44,10 +56,6 @@ done:
return rc;
 
 fail:
-   /*
-* If the kernel failed, SKIP the test.  We want to ignore
-* such failures as they're out of scope for this project.
-*/
-   rc = errno == EFAULT ? 77 : 1;
+   rc = 1;
goto done;
 }
diff --git a/tests/ipc_sem.test b/tests/ipc_sem.test
index f448b66..b8fa545 100755
--- a/tests/ipc_sem.test
+++ b/tests/ipc_sem.test
@@ -8,23 +8,12 @@ check_prog grep
 
 OUT="$LOG.out"
 
-./ipc_sem > "$OUT" || {
-   case $? in
-   77)
-   rm -f "$OUT"
+./ipc_sem > /dev/null || {
+   if [ $? -eq 77 ]; then
framework_skip_ 'ipc semget/semctl syscalls do not behave as 
expected'
-   ;;
-   99)
-   cat "$OUT"
-   rm -f "$OUT"
-   framework_failure_ 'broken kernel detected'
-   ;;
-   *)
-   cat "$OUT"
-       rm -f "$OUT"
+   else
fail_ 'ipc_sem failed'
-   ;;
-   esac
+   fi
 }
 
 args='-eipc ./ipc_sem'
-- 
2.3.3


-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


[PATCH] aarch64: fix ioctl decoding

2015-03-12 Thread Andreas Schwab
* linux/aarch64/ioctls_inc0.h: Rename from ioctls_inc1.h.
* linux/aarch64/ioctls_inc1.h: Rename from ioctls_inc0.h.
* linux/aarch64/ioctls_arch0.h: Rename from ioctls_arch1.h.
* linux/aarch64/ioctls_arch1.h: Rename from ioctls_arch0.h.
---
 linux/aarch64/ioctls_arch0.h | 2 +-
 linux/aarch64/ioctls_arch1.h | 2 +-
 linux/aarch64/ioctls_inc0.h  | 2 +-
 linux/aarch64/ioctls_inc1.h  | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/linux/aarch64/ioctls_arch0.h b/linux/aarch64/ioctls_arch0.h
index 6a674cc..b722d22 100644
--- a/linux/aarch64/ioctls_arch0.h
+++ b/linux/aarch64/ioctls_arch0.h
@@ -1 +1 @@
-/* Generated by ioctls_gen.sh from definitions found in 
$linux/arch/arm64/include/ tree. */
+#include "arm/ioctls_arch0.h"
diff --git a/linux/aarch64/ioctls_arch1.h b/linux/aarch64/ioctls_arch1.h
index b722d22..6a674cc 100644
--- a/linux/aarch64/ioctls_arch1.h
+++ b/linux/aarch64/ioctls_arch1.h
@@ -1 +1 @@
-#include "arm/ioctls_arch0.h"
+/* Generated by ioctls_gen.sh from definitions found in 
$linux/arch/arm64/include/ tree. */
diff --git a/linux/aarch64/ioctls_inc0.h b/linux/aarch64/ioctls_inc0.h
index f9939fa..46c11b1 100644
--- a/linux/aarch64/ioctls_inc0.h
+++ b/linux/aarch64/ioctls_inc0.h
@@ -1 +1 @@
-#include "64/ioctls_inc.h"
+#include "arm/ioctls_inc0.h"
diff --git a/linux/aarch64/ioctls_inc1.h b/linux/aarch64/ioctls_inc1.h
index 46c11b1..f9939fa 100644
--- a/linux/aarch64/ioctls_inc1.h
+++ b/linux/aarch64/ioctls_inc1.h
@@ -1 +1 @@
-#include "arm/ioctls_inc0.h"
+#include "64/ioctls_inc.h"
-- 
2.3.2

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


[PATCH] tests/select.test: handle architectures using pselect6 syscall

2015-03-12 Thread Andreas Schwab
* tests/select.awk (BEGIN): Update regexps to match both select
and pselect6 syscalls.
* tests/select.test: Probe for both select and pselect6 syscall.
---
 tests/select.awk  | 6 +++---
 tests/select.test | 7 +--
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/tests/select.awk b/tests/select.awk
index 142504a..688cefe 100644
--- a/tests/select.awk
+++ b/tests/select.awk
@@ -1,7 +1,7 @@
 BEGIN {
-   r[1] = "^select\\(2, \\[0 1\\], \\[0 1\\], \\[0 1\\], NULL\\) += 1 
\\(\\)$"
-   r[2] = "^select\\(-1, NULL, 0x[0-9a-f]+, NULL, NULL\\) += -1 "
-   r[3] = "^select\\(1025, \\[0\\], \\[\\], NULL, \\{0, 100\\}\\) += 0 
\\(Timeout\\)$"
+   r[1] = "^p?select6?\\(2, \\[0 1\\], \\[0 1\\], \\[0 1\\], NULL(, 0)?\\) 
+= 1 \\(\\)$"
+   r[2] = "^p?select6?\\(-1, NULL, 0x[0-9a-f]+, NULL, NULL(, 0)?\\) += -1 "
+   r[3] = "^p?select6?\\(1025, \\[0\\], \\[\\], NULL, \\{0, 100(000)?\\}(, 
0)?\\) += 0 \\(Timeout\\)$"
r[4] = "^\\+\\+\\+ exited with 0 \\+\\+\\+$"
lines = 4
fail = 0
diff --git a/tests/select.test b/tests/select.test
index bd3066b..5d5fe54 100755
--- a/tests/select.test
+++ b/tests/select.test
@@ -6,13 +6,16 @@
 
 check_prog awk
 
-$STRACE -eselect -h > /dev/null ||
+syscall=
+$STRACE -epselect6 -h > /dev/null && syscall=$syscall,pselect6
+$STRACE -eselect -h > /dev/null && syscall=$syscall,select
+test -n "$syscall" ||
skip_ 'select syscall is not supported on this architecture'
 
 ./select ||
framework_skip_ 'select syscall does not behave as expected'
 
-args='-eselect ./select'
+args="-e$syscall ./select"
 $STRACE -o "$LOG" $args || {
cat "$LOG"
fail_ "$STRACE $args failed"
-- 
2.3.2

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


FAIL: stat64-v.test

2015-03-12 Thread Andreas Schwab
The stat64-v test fails on aarch64 because it cannot cope with
newfstatat yet.

newfstatat(AT_FDCWD, "stat64_sample", {st_dev=makedev(0, 40), st_ino=54269917, 
st_mode=S_IFREG|0644, st_nlink=1, st_uid=17005, st_gid=50, st_blksize=1048576, 
st_blocks=0, st_size=4611840, st_atime=1141709097/06/13-06:26:08, 
st_mtime=1141709097/06/13-06:26:08, st_ctime=2015/03/12-16:24:36}, 0) = 0

Andreas.

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


[PATCH] aarch64: properly decode generic syscalls

2015-03-12 Thread Andreas Schwab
* linux/aarch64/syscallent1.h: Don't override entries 277 to 1023.
---
 linux/aarch64/syscallent1.h | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/linux/aarch64/syscallent1.h b/linux/aarch64/syscallent1.h
index 4ec9665..a72bb7b 100644
--- a/linux/aarch64/syscallent1.h
+++ b/linux/aarch64/syscallent1.h
@@ -3,9 +3,6 @@
 /* Arch-specific block, not used on AArch64 */
 [244 ... 259] = { },
 
-/* Blank down to 1023 */
-[277 ... 1023] = { },
-
 /* Quote from asm-generic/unistd.h:
  *
  * All syscalls below here should go away really,
-- 
2.3.2

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


[PATCH] Distribute linux/aarch64/arch_regs.h

2015-03-12 Thread Andreas Schwab
* Makefile.am (EXTRA_DIST): Add linux/aarch64/arch_regs.h.
---
 Makefile.am | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Makefile.am b/Makefile.am
index 2030f9b..48fe1d7 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -164,6 +164,7 @@ EXTRA_DIST =\
linux/32/syscallent.h   \
linux/64/ioctls_inc.h   \
linux/64/syscallent.h   \
+   linux/aarch64/arch_regs.h   \
linux/aarch64/errnoent1.h   \
linux/aarch64/ioctls_arch0.h\
linux/aarch64/ioctls_arch1.h\
-- 
2.3.2

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


FAIL: stat64-v.test

2015-03-12 Thread Andreas Schwab
stat64-v.test fails for tests-m32 on x86_64, because stat64 has unsigned
int st_?time, but time_t is signed.

stat64("stat64_sample", {st_dev=makedev(8, 3), st_ino=54425624, 
st_mode=S_IFREG|0644, st_nlink=1, st_uid=17005, st_gid=50, st_blksize=4096, 
st_blocks=0, st_size=4611840, st_atime=2106/02/07-06:28:16, 
st_mtime=2106/02/07-06:28:16, st_ctime=2015/03/12-11:14:33}) = 0

Andreas.

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


Re: [PATCH] tests/ipc_sem: don't match address of sem buffer

2015-03-12 Thread Andreas Schwab
"Dmitry V. Levin"  writes:

> On Wed, Mar 11, 2015 at 01:07:15PM +0100, Andreas Schwab wrote:
>> On architectures where the semctl call is implemented by the ipc syscall
>> the glibc wrapper passes a pointer to a local variable, so the value of
>> the fourth argument is unknown.
>
> Wouldn't it be better to fix the parser, e.g.
>
> --- a/ipc.c
> +++ b/ipc.c
> @@ -281,7 +281,16 @@ int sys_semctl(struct tcb *tcp)
>   if (entering(tcp)) {
>   tprintf("%lu, %lu, ", tcp->u_arg[0], tcp->u_arg[1]);
>   PRINTCTL(semctl_flags, tcp->u_arg[2], "SEM_???");
> - tprintf(", %#lx", tcp->u_arg[3]);
> + tprints(", ");
> + if (indirect_ipccall(tcp)) {
> + if (current_wordsize == sizeof(int)) {
> + printnum_int(tcp, tcp->u_arg[3], "%#x");
> + } else {
> +         printnum_long(tcp, tcp->u_arg[3], "%#lx");
> + }

That prints [...] instead of just the number, though.

Andreas.

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


Re: [PATCH] m68k: fix sigreturn decoding

2015-03-12 Thread Andreas Schwab
"Dmitry V. Levin"  writes:

> On Wed, Mar 11, 2015 at 03:10:34PM +0100, Andreas Schwab wrote:
>> * sigreturn.c (sys_sigreturn) [M68K]: Fetch the words of the
>> signal mask from the proper place.
>> ---
>>  sigreturn.c | 14 +-
>>  1 file changed, 13 insertions(+), 1 deletion(-)
>> 
>> diff --git a/sigreturn.c b/sigreturn.c
>> index 648bd0a..a96257f 100644
>> --- a/sigreturn.c
>> +++ b/sigreturn.c
>> @@ -128,8 +128,20 @@ sys_sigreturn(struct tcb *tcp)
>>  long addr;
>>  if (upeek(tcp->pid, 4*PT_USP, &addr) < 0)
>>  return 0;
>> +/* Fetch pointer to struct sigcontext.  */
>> +if (umove(tcp, addr + 2 * sizeof(int), &addr) < 0)
>> +return 0;
>> +unsigned long mask[NSIG / 8 / sizeof(long)];
>> +/* Fetch first word of signal mask.  */
>> +if (umove(tcp, addr, &mask[0]) < 0)
>> +return 0;
>> +/* Fetch remaining words of signal mask, located
>> +   immediately before.  */
>> +addr -= sizeof (mask) - sizeof(long);
>> +if (umoven(tcp, addr, sizeof (mask) - sizeof(long), (char *) 
>> &mask[1]) < 0)
>> +return 0;
>
> You might want to save a syscall here by fetching the whole sizeof(mask)
> in a single umoven call.

They are not consecutive.

Andreas.

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


[PATCH] tests/ipc_sem: verify that all patterns match

2015-03-12 Thread Andreas Schwab
* ipc_sem.test: Count matches to verify that all patterns match.
---
 tests/ipc_sem.test | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tests/ipc_sem.test b/tests/ipc_sem.test
index b8fa545..ef957c3 100755
--- a/tests/ipc_sem.test
+++ b/tests/ipc_sem.test
@@ -18,7 +18,9 @@ OUT="$LOG.out"
 
 args='-eipc ./ipc_sem'
 $STRACE -o "$LOG" $args > "$OUT" &&
-LC_ALL=C grep -E -x -f "$OUT" "$LOG" > /dev/null || {
+exp_lines=$(wc -l < "$OUT") &&
+matched_lines=$(LC_ALL=C grep -c -E -x -f "$OUT" "$LOG") &&
+test $exp_lines -eq $matched_lines || {
cat "$OUT" "$LOG"
fail_ "$STRACE $args output mismatch"
 }
-- 
2.3.2

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


[PATCH] tests/ipc_sem: match IPC_64 flag

2015-03-12 Thread Andreas Schwab
* ipc_sem.c (main): Optionally match "IPC_64|" in third arg of
semctl.
---
 tests/ipc_sem.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tests/ipc_sem.c b/tests/ipc_sem.c
index 180dc12..9a9cd20 100644
--- a/tests/ipc_sem.c
+++ b/tests/ipc_sem.c
@@ -26,13 +26,13 @@ main(void)
un.buf = &ds;
if (semctl(id, 0, IPC_STAT, un))
goto fail;
-   printf("semctl\\(%d, 0, IPC_STAT, %p\\) += 0\n", id, &ds);
+   printf("semctl\\(%d, 0, (IPC_64\\|)?IPC_STAT, %p\\) += 0\n", id, &ds);
 
un.__buf = &info;
int max = semctl(0, 0, SEM_INFO, un);
if (max < 0)
goto fail;
-   printf("semctl\\(0, 0, SEM_INFO, %p\\) += %d\n", &info, max);
+   printf("semctl\\(0, 0, (IPC_64\\|)?SEM_INFO, %p\\) += %d\n", &info, 
max);
 
un.buf = &ds;
rc = semctl(id, 0, SEM_STAT, un);
@@ -43,16 +43,16 @@ main(void)
 */
if (-1 != rc || EINVAL != errno)
goto fail;
-   printf("semctl\\(%d, 0, SEM_STAT, %p\\) += -1 EINVAL \\(Invalid 
argument\\)\n", id, &ds);
+   printf("semctl\\(%d, 0, (IPC_64\\|)?SEM_STAT, %p\\) += -1 
EINVAL \\(Invalid argument\\)\n", id, &ds);
} else {
-   printf("semctl\\(%d, 0, SEM_STAT, %p\\) += %d\n", id, &ds, id);
+   printf("semctl\\(%d, 0, (IPC_64\\|)?SEM_STAT, %p\\) += %d\n", 
id, &ds, id);
}
 
rc = 0;
 done:
if (semctl(id, 0, IPC_RMID, 0) < 0)
return 1;
-   printf("semctl\\(%d, 0, IPC_RMID, 0\\) += 0\n", id);
+   printf("semctl\\(%d, 0, (IPC_64\\|)?IPC_RMID, 0\\) += 0\n", id);
return rc;
 
 fail:
-- 
2.3.2

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


[PATCH] m68k: fix sigreturn decoding

2015-03-12 Thread Andreas Schwab
* sigreturn.c (sys_sigreturn) [M68K]: Fetch the words of the
signal mask from the proper place.
---
 sigreturn.c | 14 +-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/sigreturn.c b/sigreturn.c
index 648bd0a..a96257f 100644
--- a/sigreturn.c
+++ b/sigreturn.c
@@ -128,8 +128,20 @@ sys_sigreturn(struct tcb *tcp)
long addr;
if (upeek(tcp->pid, 4*PT_USP, &addr) < 0)
return 0;
+   /* Fetch pointer to struct sigcontext.  */
+   if (umove(tcp, addr + 2 * sizeof(int), &addr) < 0)
+   return 0;
+   unsigned long mask[NSIG / 8 / sizeof(long)];
+   /* Fetch first word of signal mask.  */
+   if (umove(tcp, addr, &mask[0]) < 0)
+   return 0;
+   /* Fetch remaining words of signal mask, located
+  immediately before.  */
+   addr -= sizeof (mask) - sizeof(long);
+   if (umoven(tcp, addr, sizeof (mask) - sizeof(long), (char *) 
&mask[1]) < 0)
+   return 0;
tprints("{mask=");
-   print_sigset_addr_len(tcp, addr, NSIG / 8);
+   tprintsigmask_addr("", mask);
tprints("}");
}
 #elif defined(ALPHA)
-- 
2.3.2

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


[PATCH] m68k: define HAVE_SA_RESTORER

2015-03-11 Thread Andreas Schwab
On m68k the kernel sigaction structure has the sa_restorer member for
historical reasons.

* signal.c (HAVE_SA_RESTORER): Define for M68K.
---
 signal.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/signal.c b/signal.c
index 710fb19..867e156 100644
--- a/signal.c
+++ b/signal.c
@@ -62,7 +62,7 @@
 #  define HAVE_SA_RESTORER 1
 # endif
 #else /* !SA_RESTORER */
-# if defined SPARC || defined SPARC64
+# if defined SPARC || defined SPARC64 || defined M68K
 #  define HAVE_SA_RESTORER 1
 # else
 #  define HAVE_SA_RESTORER 0
-- 
2.3.2

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


[PATCH] Fix crash in ipc_sem test

2015-03-11 Thread Andreas Schwab
Properly use union semun as argument of semctl.

* ipc_sem.c (main): Properly use union semun as argument of
semctl.  Don't handle EFAULT specially.
* ipc_sem.test: Revert last change.
---
 tests/ipc_sem.c| 24 
 tests/ipc_sem.test | 19 ---
 2 files changed, 20 insertions(+), 23 deletions(-)

diff --git a/tests/ipc_sem.c b/tests/ipc_sem.c
index e8662c4..f3ebfa9 100644
--- a/tests/ipc_sem.c
+++ b/tests/ipc_sem.c
@@ -2,10 +2,19 @@
 #include 
 #include 
 
+union semun {
+  int  val;/* Value for SETVAL */
+  struct semid_ds *buf;/* Buffer for IPC_STAT, IPC_SET */
+  unsigned short  *array;  /* Array for GETALL, SETALL */
+  struct seminfo  *__buf;  /* Buffer for IPC_INFO
+ (Linux-specific) */
+};
+
 int
 main(void)
 {
int rc, id;
+   union semun un;
struct semid_ds ds;
struct seminfo info;
 
@@ -14,16 +23,19 @@ main(void)
return 77;
printf("semget\\(IPC_PRIVATE, 1, 0600\\) += %d\n", id);
 
-   if (semctl(id, 0, IPC_STAT, &ds))
+   un.buf = &ds;
+   if (semctl(id, 0, IPC_STAT, un))
goto fail;
printf("semctl\\(%d, 0, IPC_STAT, .*\\) += 0\n", id);
 
-   int max = semctl(0, 0, SEM_INFO, &info);
+   un.__buf = &info;
+   int max = semctl(0, 0, SEM_INFO, un);
if (max < 0)
goto fail;
printf("semctl\\(0, 0, SEM_INFO, .*\\) += %d\n", max);
 
-   rc = semctl(id, 0, SEM_STAT, &ds);
+   un.buf = &ds;
+   rc = semctl(id, 0, SEM_STAT, un);
if (rc != id) {
/*
 * In linux < v2.6.24-rc1 the first argument must be
@@ -44,10 +56,6 @@ done:
return rc;
 
 fail:
-   /*
-* If the kernel failed, SKIP the test.  We want to ignore
-* such failures as they're out of scope for this project.
-*/
-   rc = errno == EFAULT ? 77 : 1;
+   rc = 1;
goto done;
 }
diff --git a/tests/ipc_sem.test b/tests/ipc_sem.test
index f448b66..b8fa545 100755
--- a/tests/ipc_sem.test
+++ b/tests/ipc_sem.test
@@ -8,23 +8,12 @@ check_prog grep
 
 OUT="$LOG.out"
 
-./ipc_sem > "$OUT" || {
-   case $? in
-   77)
-   rm -f "$OUT"
+./ipc_sem > /dev/null || {
+   if [ $? -eq 77 ]; then
framework_skip_ 'ipc semget/semctl syscalls do not behave as 
expected'
-   ;;
-   99)
-   cat "$OUT"
-   rm -f "$OUT"
-   framework_failure_ 'broken kernel detected'
-   ;;
-   *)
-   cat "$OUT"
-   rm -f "$OUT"
+   else
fail_ 'ipc_sem failed'
-   ;;
-   esac
+   fi
 }
 
 args='-eipc ./ipc_sem'
-- 
2.3.2

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


[PATCH] tests/ipc_sem: don't match address of sem buffer

2015-03-11 Thread Andreas Schwab
On architectures where the semctl call is implemented by the ipc syscall
the glibc wrapper passes a pointer to a local variable, so the value of
the fourth argument is unknown.

* ipc_sem.c (main): Don't try to match address of sem buffer.
---
 tests/ipc_sem.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/ipc_sem.c b/tests/ipc_sem.c
index ed4..e8662c4 100644
--- a/tests/ipc_sem.c
+++ b/tests/ipc_sem.c
@@ -16,12 +16,12 @@ main(void)
 
if (semctl(id, 0, IPC_STAT, &ds))
goto fail;
-   printf("semctl\\(%d, 0, IPC_STAT, %p\\) += 0\n", id, &ds);
+   printf("semctl\\(%d, 0, IPC_STAT, .*\\) += 0\n", id);
 
int max = semctl(0, 0, SEM_INFO, &info);
if (max < 0)
goto fail;
-   printf("semctl\\(0, 0, SEM_INFO, %p\\) += %d\n", &info, max);
+   printf("semctl\\(0, 0, SEM_INFO, .*\\) += %d\n", max);
 
rc = semctl(id, 0, SEM_STAT, &ds);
if (rc != id) {
@@ -31,9 +31,9 @@ main(void)
 */
if (-1 != rc || EINVAL != errno)
goto fail;
-   printf("semctl\\(%d, 0, SEM_STAT, %p\\) += -1 EINVAL \\(Invalid 
argument\\)\n", id, &ds);
+   printf("semctl\\(%d, 0, SEM_STAT, .*\\) += -1 EINVAL \\(Invalid 
argument\\)\n", id);
} else {
-   printf("semctl\\(%d, 0, SEM_STAT, %p\\) += %d\n", id, &ds, id);
+   printf("semctl\\(%d, 0, SEM_STAT, .*\\) += %d\n", id, id);
}
 
rc = 0;
-- 
2.3.2

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


Re: [PATCH] Fix decoding of mmap2 for arm

2015-03-10 Thread Andreas Schwab
"Dmitry V. Levin"  writes:

> Is CONFIG_ARM64_64K_PAGES necessary to see the difference?

Yes and no.  Currently, CONFIG_ARM64_64K_PAGES forbids CONFIG_COMPAT, so
you won't be able to observe the bug, but if you remove that restriction
you will see that the arm compat support mishandles the mmap2 syscall.

Andreas.

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


[PATCH] Fix decoding of mmap2 for arm

2015-03-09 Thread Andreas Schwab
* syscallent.h (mmap2): Decode with sys_mmap_4koff, not
sys_mmap_pgoff.
---
 linux/arm/syscallent.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/linux/arm/syscallent.h b/linux/arm/syscallent.h
index 52aed9e..b66a5a2 100644
--- a/linux/arm/syscallent.h
+++ b/linux/arm/syscallent.h
@@ -218,7 +218,7 @@
 [189] = { 5,   0,  sys_putpmsg,"putpmsg"   
},
 [190] = { 0,   TP, sys_vfork,  "vfork" 
},
 [191] = { 2,   0,  sys_getrlimit,  "ugetrlimit"
},
-[192] = { 6,   TD|TM|SI,   sys_mmap_pgoff, "mmap2" 
},
+[192] = { 6,   TD|TM|SI,   sys_mmap_4koff, "mmap2" 
},
 [193] = { 4,   TF, sys_truncate64, "truncate64"
},
 [194] = { 4,   TD, sys_ftruncate64,"ftruncate64"   
},
 [195] = { 2,   TF, sys_stat64,     "stat64"
},
-- 
2.3.2

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

--
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


Re: strace changes behavior of the traced process

2014-07-28 Thread Andreas Schwab
Yuri  writes:

> When I run 'gdb printf' with and without strace, the output of gdb is 
> different in that with strace "Inferior exited" message disappears.
> It looks like strace maybe consumes the exit signal of the debugged 
> process before gdb does?
>
> $ gdb printf
> <...skipped...>
> (gdb) r "Hello\n"
> Starting program: /usr/bin/printf "Hello\n"
> Hello
> [Inferior 1 (process 3057) exited normally]
> (gdb)
>
>
> $ strace -f 2>/dev/null gdb printf
> <...skipped...>
> (gdb) r "Hello\n"
> Starting program: /usr/bin/printf "Hello\n"
> Hello
> (gdb)

That's because gdb never gets a chance to trace the inferior (there can
be only one tracer).  A newer gdb complains that the program exited
during startup.

Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

--
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls. 
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


Re: [PATCH] Rewrite signal mask decoding without sigset_t

2014-02-27 Thread Andreas Schwab
"Dmitry V. Levin"  writes:

> Tested on x86, x86-64 and arm.  Please test on other architectures,
> especially on big-endian, I'm not sure I haven't broken some of them.
> At least sigaction.test should pass everywhere.

Successfuly tested on m68k.

Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

--
Flow-based real-time traffic analytics software. Cisco certified tool.
Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
Customize your own dashboards, set traffic alerts and generate reports.
Network behavioral analysis & security monitoring. All-in-one tool.
http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


[PATCH] Fix building outside source directory

2013-03-30 Thread Andreas Schwab
The file linux/ioctlent.h is generated in the build directory, so
"../ioctlent.h" won't find it.

* linux/aarch64/ioctlent1.h: Remove "../" from include file name.
* linux/powerpc/ioctlent1.h: Likewise.
* linux/tile/ioctlent1.h: Likewise.
* linux/x32/ioctlent1.h: Likewise.
* linux/x86_64/ioctlent1.h: Likewise.
* linux/x86_64/ioctlent2.h: Likewise.

Signed-off-by: Andreas Schwab 
---
 linux/aarch64/ioctlent1.h | 2 +-
 linux/powerpc/ioctlent1.h | 2 +-
 linux/tile/ioctlent1.h| 2 +-
 linux/x32/ioctlent1.h | 2 +-
 linux/x86_64/ioctlent1.h  | 2 +-
 linux/x86_64/ioctlent2.h  | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/linux/aarch64/ioctlent1.h b/linux/aarch64/ioctlent1.h
index df485d3..72eeaf1 100644
--- a/linux/aarch64/ioctlent1.h
+++ b/linux/aarch64/ioctlent1.h
@@ -1 +1 @@
-#include "../ioctlent.h"
+#include "ioctlent.h"
diff --git a/linux/powerpc/ioctlent1.h b/linux/powerpc/ioctlent1.h
index df485d3..72eeaf1 100644
--- a/linux/powerpc/ioctlent1.h
+++ b/linux/powerpc/ioctlent1.h
@@ -1 +1 @@
-#include "../ioctlent.h"
+#include "ioctlent.h"
diff --git a/linux/tile/ioctlent1.h b/linux/tile/ioctlent1.h
index 4e7eb8d..9057b32 100644
--- a/linux/tile/ioctlent1.h
+++ b/linux/tile/ioctlent1.h
@@ -1,2 +1,2 @@
 /* tilegx32/tilepro */
-#include "../ioctlent.h"
+#include "ioctlent.h"
diff --git a/linux/x32/ioctlent1.h b/linux/x32/ioctlent1.h
index 85b8cca..4750671 100644
--- a/linux/x32/ioctlent1.h
+++ b/linux/x32/ioctlent1.h
@@ -1,2 +1,2 @@
 /* i386 personality */
-#include "../ioctlent.h"
+#include "ioctlent.h"
diff --git a/linux/x86_64/ioctlent1.h b/linux/x86_64/ioctlent1.h
index 85b8cca..4750671 100644
--- a/linux/x86_64/ioctlent1.h
+++ b/linux/x86_64/ioctlent1.h
@@ -1,2 +1,2 @@
 /* i386 personality */
-#include "../ioctlent.h"
+#include "ioctlent.h"
diff --git a/linux/x86_64/ioctlent2.h b/linux/x86_64/ioctlent2.h
index da668a8..fd4b94d 100644
--- a/linux/x86_64/ioctlent2.h
+++ b/linux/x86_64/ioctlent2.h
@@ -1,2 +1,2 @@
 /* x32 personality */
-#include "../ioctlent.h"
+#include "ioctlent.h"
-- 
1.8.2

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

--
Own the Future-Intel(R) Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest. Compete 
for recognition, cash, and the chance to get your game on Steam. 
$5K grand prize plus 10 genre and skill prizes. Submit your demo 
by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


[PATCH] AArch64: Fix printing of long long value

2013-03-30 Thread Andreas Schwab
* util.c (printllval): Fix printing of long long values on
AArch64.

Signed-off-by: Andreas Schwab 
---
 util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/util.c b/util.c
index fa552cc..d4314ab 100644
--- a/util.c
+++ b/util.c
@@ -185,7 +185,7 @@ printxval(const struct xlat *xlat, int val, const char 
*dflt)
 int
 printllval(struct tcb *tcp, const char *format, int arg_no)
 {
-#if defined(X86_64) || defined(POWERPC64) || defined(TILE)
+#if defined(X86_64) || defined(POWERPC64) || defined(TILE) || defined (AARCH64)
if (current_personality == 0) {
/* Technically, format expects "long long",
 * but we supply "long". We expect that
-- 
1.8.2

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

--
Own the Future-Intel(R) Level Up Game Demo Contest 2013
Rise to greatness in Intel's independent game demo contest. Compete 
for recognition, cash, and the chance to get your game on Steam. 
$5K grand prize plus 10 genre and skill prizes. Submit your demo 
by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


Re: bug in commit 20f6b54385d2462d858419f7c67509cb3d22d155

2012-03-26 Thread Andreas Schwab
Denys Vlasenko 
writes:

> Hi Dmitry,
>
>  for file in "$logfile".*; do
> [ -f "$file" ] || continue
> -   suffix=${file:1+$pfxlen}
> -   [ "$suffix" -gt 0 ] 2> /dev/null || {
> -   echo "Skipped file '$file' (bad suffix)" >&2
> +   suffix=${file#$logfile.}
>
> suffix=${file#$logfile.} is not a good way to strip $logfile prefix:
> ${var#pattern} operation interprets , indeed, as glob pattern.

Unless quoted.

> Try this:
>
> logfile=""
> file=FILE.123
> suffix=${file#$logfile.}
  suffix=${file#"$logfile".}
> echo "$suffix"

> I think we'd better use suffix=${file:1+$pfxlen}.

This is not portable.

Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

--
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


Re: Q: can rlim_t be a long long type on linux

2012-03-16 Thread Andreas Schwab
"Dmitry V. Levin"  writes:

> Is it correct that rlim_t cannot be a long long type on linux,
> or am I missing something?

x32 is going to be the first.

Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

--
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


Re: RFC: better signal names?

2012-03-15 Thread Andreas Schwab
Denys Vlasenko 
writes:

> Gosh. OF COURSE it is stopped by signal, there are no other
> methods to stop processes in Unix but signal.

That's not true.  It can also be stopped by I/O.

Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

--
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


[PATCH] Add support for compat_statfs64

2012-01-17 Thread Andreas Schwab
* file.c (struct compat_statfs64, printcompat_statfs64): Define.
(sys_statfs64, sys_fstatfs64): Use it.
---
 file.c |   52 
 1 files changed, 52 insertions(+), 0 deletions(-)

diff --git a/file.c b/file.c
index 473e6fd..343f64a 100644
--- a/file.c
+++ b/file.c
@@ -1794,6 +1794,54 @@ printstatfs64(struct tcb *tcp, long addr)
tprints("}");
 }
 
+struct compat_statfs64 {
+   uint32_t f_type;
+   uint32_t f_bsize;
+   uint64_t f_blocks;
+   uint64_t f_bfree;
+   uint64_t f_bavail;
+   uint64_t f_files;
+   uint64_t f_ffree;
+   fsid_t f_fsid;
+   uint32_t f_namelen;
+   uint32_t f_frsize;
+   uint32_t f_flags;
+   uint32_t f_spare[4];
+}
+#if defined(X86_64) || defined(IA64)
+  __attribute__ ((packed, aligned(4)))
+#endif
+;
+
+static void
+printcompat_statfs64(struct tcb *tcp, long addr)
+{
+   struct compat_statfs64 statbuf;
+
+   if (syserror(tcp) || !verbose(tcp)) {
+   tprintf("%#lx", addr);
+   return;
+   }
+   if (umove(tcp, addr, &statbuf) < 0) {
+   tprints("{...}");
+   return;
+   }
+   tprintf("{f_type=%s, f_bsize=%lu, f_blocks=%llu, f_bfree=%llu, ",
+   sprintfstype(statbuf.f_type),
+   (unsigned long)statbuf.f_bsize,
+   (unsigned long long)statbuf.f_blocks,
+   (unsigned long long)statbuf.f_bfree);
+   tprintf("f_bavail=%llu, f_files=%llu, f_ffree=%llu, f_fsid={%d, %d}",
+   (unsigned long long)statbuf.f_bavail,
+   (unsigned long long)statbuf.f_files,
+   (unsigned long long)statbuf.f_ffree,
+   statbuf.f_fsid.__val[0], statbuf.f_fsid.__val[1]);
+   tprintf(", f_namelen=%lu", (unsigned long)statbuf.f_namelen);
+   tprintf(", f_frsize=%lu", (unsigned long)statbuf.f_frsize);
+   tprintf(", f_flags=%lu", (unsigned long)statbuf.f_frsize);
+   tprints("}");
+}
+
 int
 sys_statfs64(struct tcb *tcp)
 {
@@ -1803,6 +1851,8 @@ sys_statfs64(struct tcb *tcp)
} else {
if (tcp->u_arg[1] == sizeof(struct statfs64))
printstatfs64(tcp, tcp->u_arg[2]);
+   else if (tcp->u_arg[1] == sizeof(struct compat_statfs64))
+   printcompat_statfs64(tcp, tcp->u_arg[2]);
else
tprints("{???}");
}
@@ -1818,6 +1868,8 @@ sys_fstatfs64(struct tcb *tcp)
} else {
if (tcp->u_arg[1] == sizeof(struct statfs64))
printstatfs64(tcp, tcp->u_arg[2]);
+   else if (tcp->u_arg[1] == sizeof(struct compat_statfs64))
+   printcompat_statfs64(tcp, tcp->u_arg[2]);
else
tprints("{???}");
}
-- 
1.7.8.3


-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

--
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


[PATCH] Add support for statfs64.f_flags

2012-01-17 Thread Andreas Schwab
* file.c (printstatfs64): Print f_flags if available.
---
 file.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/file.c b/file.c
index 4e62c2c..473e6fd 100644
--- a/file.c
+++ b/file.c
@@ -1788,6 +1788,9 @@ printstatfs64(struct tcb *tcp, long addr)
 #ifdef _STATFS_F_FRSIZE
tprintf(", f_frsize=%llu", (unsigned long long)statbuf.f_frsize);
 #endif
+#ifdef _STATFS_F_FLAGS
+   tprintf(", f_flags=%llu", (unsigned long long)statbuf.f_flags);
+#endif
tprints("}");
 }
 
-- 
1.7.8.3


-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

--
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


Re: [PATCH] ARM EABI: fix 64-bit syscall's arguments decoding

2011-05-25 Thread Andreas Schwab
"Kirill A. Shutemov" 
writes:

> ARM OABI and ARM EABI have different function parameters passing rules.
> With EABI, 64-bit function parameters passed in registers are aligned to
> an even-numbered register instead of using the next available pair. [1]
> This rule also applies to syscall's arguments.
>
> strace is not aware about this difference. This patch fixes it.
> Five syscalls affected.

Please take a look at printllval.

Andreas.

-- 
Andreas Schwab, sch...@redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84  5EC7 45C6 250E 6F00 984E
"And now for something completely different."

--
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery, 
you get blazing-fast, flexible, and affordable data protection.
Download your free trial now. 
http://p.sf.net/sfu/quest-d2dcopy1
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


Re: [PATCH] Try to use PTRACE_SETOPTIONS to handle non-ptrace SIGTRAP

2010-07-23 Thread Andreas Schwab
Please test your code and don't come back until you did.  It is your
duty to prove that your code works.

Andreas.

-- 
Andreas Schwab, sch...@redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84  5EC7 45C6 250E 6F00 984E
"And now for something completely different."

--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


Re: [PATCH] Try to use PTRACE_SETOPTIONS to handle non-ptrace SIGTRAP

2010-07-23 Thread Andreas Schwab
Roland McGrath  writes:

>> >> > if (exiting(tcp) && !syserror(tcp))
>> >> > tcp->flags |= TCB_WAITEXECVE;
>> >> 
>> >> This is of course wrong.
>> >
>> > Are you kidding?
>> 
>> Of course not!  How do you think does this bit get cleared again?
>
> How does it get cleared now?

By the post-execve trap, of course.

Andreas.

-- 
Andreas Schwab, sch...@redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84  5EC7 45C6 250E 6F00 984E
"And now for something completely different."

--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


Re: [PATCH] Try to use PTRACE_SETOPTIONS to handle non-ptrace SIGTRAP

2010-07-23 Thread Andreas Schwab
Roland McGrath  writes:

>> Roland McGrath  writes:
>> 
>> >if (exiting(tcp) && !syserror(tcp))
>> >tcp->flags |= TCB_WAITEXECVE;
>> 
>> This is of course wrong.
>
> Are you kidding?

Of course not!  How do you think does this bit get cleared again?

Andreas.

-- 
Andreas Schwab, sch...@redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84  5EC7 45C6 250E 6F00 984E
"And now for something completely different."

--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


Re: [PATCH] Try to use PTRACE_SETOPTIONS to handle non-ptrace SIGTRAP

2010-07-23 Thread Andreas Schwab
Roland McGrath  writes:

>   if (exiting(tcp) && !syserror(tcp))
>   tcp->flags |= TCB_WAITEXECVE;

This is of course wrong.

Andreas.

-- 
Andreas Schwab, sch...@redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84  5EC7 45C6 250E 6F00 984E
"And now for something completely different."

--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


Re: [PATCH] Try to use PTRACE_SETOPTIONS to handle non-ptrace SIGTRAP

2010-07-23 Thread Andreas Schwab
Roland McGrath  writes:

> Furthermore, the actual behavior of Linux kernels where TCB_WAITEXECVE
> is needed (i.e. PTRACE_O_TRACEEXEC not supported or not yet in force)
> is that a normal SIGTRAP signal is generated, so the normal ptrace
> signal stop for that comes only after the syscall-exit stop for the
> execve call completing.

This is irrelevant.  With the old code the flag is set in both cases
which is obviously wrong.

Andreas.

-- 
Andreas Schwab, sch...@redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84  5EC7 45C6 250E 6F00 984E
"And now for something completely different."

--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


[PATCH] Try to use PTRACE_SETOPTIONS to handle non-ptrace SIGTRAP

2010-07-20 Thread Andreas Schwab
, status)) {
if (WSTOPSIG(status) == SIGSTOP &&
(tcp->flags & TCB_SIGTRAPPED)) {
/*
@@ -2550,6 +2619,13 @@ Process %d attached (waiting for parent)\n",
/* we handled the STATUS, we are permitted to interrupt now. */
if (interrupted)
return 0;
+   /* Ignore post-execve trap. */
+   if (is_post_execve_trap(tcp, status)) {
+#ifdef TCB_WAITEXECVE
+   tcp->flags &= ~TCB_WAITEXECVE;
+#endif
+   goto tracing;
+   }
if (trace_syscall(tcp) < 0 && !tcp->ptrace_errno) {
            /* ptrace() failed in trace_syscall() with ESRCH.
 * Likely a result of process disappearing mid-flight.
-- 
1.7.1.1


-- 
Andreas Schwab, sch...@redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84  5EC7 45C6 250E 6F00 984E
"And now for something completely different."

--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


[PATCH] Handle biarch get/setrlimit

2010-07-17 Thread Andreas Schwab
* resource.c (print_rlimit32) [POWERPC64 || X86_64]: Define.
(sys_getrlimit, sys_setrlimit) [POWERPC64 || X86_64]: Use it.
---
 resource.c |   30 ++
 1 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/resource.c b/resource.c
index 8274f3e..147638b 100644
--- a/resource.c
+++ b/resource.c
@@ -122,6 +122,28 @@ sprintrlim(long lim)
return buf;
 }
 
+# if defined LINUX && (defined POWERPC64 || defined X86_64)
+static void
+print_rlimit32(struct tcb *tcp)
+{
+   struct rlimit32 {
+   unsigned int rlim_cur;
+   unsigned int rlim_max;
+   } rlim;
+
+   if (umove(tcp, tcp->u_arg[1], &rlim) < 0)
+   tprintf("{...}");
+   else {
+   tprintf("{rlim_cur=%s,",
+   sprintrlim(rlim.rlim_cur == -1 ? RLIM_INFINITY
+  : rlim.rlim_cur));
+   tprintf(" rlim_max=%s}",
+   sprintrlim(rlim.rlim_max == -1 ? RLIM_INFINITY
+  : rlim.rlim_max));
+   }
+}
+#endif
+
 int
 sys_getrlimit(struct tcb *tcp)
 {
@@ -134,6 +156,10 @@ sys_getrlimit(struct tcb *tcp)
else {
if (syserror(tcp) || !verbose(tcp))
tprintf("%#lx", tcp->u_arg[1]);
+# if defined LINUX && (defined POWERPC64 || defined X86_64)
+   else if (current_personality == 1)
+   print_rlimit32(tcp);
+# endif
else if (umove(tcp, tcp->u_arg[1], &rlim) < 0)
tprintf("{...}");
else {
@@ -154,6 +180,10 @@ sys_setrlimit(struct tcb *tcp)
tprintf(", ");
if (!verbose(tcp))
tprintf("%#lx", tcp->u_arg[1]);
+# if defined LINUX && (defined POWERPC64 || defined X86_64)
+   else if (current_personality == 1)
+   print_rlimit32(tcp);
+# endif
else if (umove(tcp, tcp->u_arg[1], &rlim) < 0)
tprintf("{...}");
else {
-- 
1.7.1.1


-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


[PATCH/v2] Add biarch support for powerpc64

2010-07-12 Thread Andreas Schwab
+   if (llarg % 2) llarg++;
+#  endif
tprintf(format, LONG_LONG(tcp->u_arg[llarg], tcp->u_arg[llarg + 
1]));
llarg += 2;
}
-# elif defined IA64 || defined ALPHA || (defined POWERPC && defined 
__powerpc64__)
+# elif defined IA64 || defined ALPHA
tprintf(format, tcp->u_arg[llarg]);
llarg++;
 # elif defined LINUX_MIPSN32
@@ -1110,10 +1114,14 @@ printcall(struct tcb *tcp)
long pc;
 
if (upeek(tcp, sizeof(unsigned long)*PT_NIP, &pc) < 0) {
-   tprintf ("[] ");
+   PRINTBADPC;
return;
}
+#  ifdef POWERPC64
+   tprintf("[%016lx] ", pc);
+#  else
tprintf("[%08lx] ", pc);
+#  endif
 # elif defined(M68K)
long pc;
 
-- 
1.7.1.1


-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


Re: [PATCH] Add biarch support for powerpc64

2010-07-06 Thread Andreas Schwab
There is actually one case where the names differ: newfstatat
vs. fstatat64.  But that's the only one.

Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


Re: [PATCH] Add biarch support for powerpc64

2010-07-06 Thread Andreas Schwab
Roland McGrath  writes:

> The kernel shares a single table in the source file.  So the correlation of
> numbers to names is really not going to vary (just a few of them are only
> used on ppc32).  IMHO it is better to print the names in case these
> ppc32-only syscalls are used in ppc64.

They are only used by ppc32 processes which are decoded with the other
personality's table anyway. (A few old ppc32 syscalls don't have compat
support in the ppc64 kernel, but that's not a problem.)

> It's all the struct decoding that would really be a lot of tedious work.

You have the struct decoding issues either way.

Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


Re: [PATCH] Add biarch support for powerpc64

2010-07-06 Thread Andreas Schwab
Roland McGrath  writes:

> Is there any actual benefit to arch=powerpc64 and the separate directory of
> files that all just #include the powerpc files?  I think we'd do as well
> just to leave arch=powerpc for the powerpc64 configuration.  It doesn't
> seem likely that these lists will diverge for ppc32/ppc64 in the future.

Actually I originally planned to make the ppc64 syscall table different
from the ppc32 table, leaving out the unimplemented and 32-bit only
syscalls.

> To support those systems more smoothly, we could also make ppc32
> strace use PTRACE_GETREGS64 to support ppc64 tracees, but that would
> require much more work in the inverse biarch decoding support.

There are a lot of places that assume you can read sizeof(long) worth of
data from the u-area to read a register's contents.  That won't work on
ppc32 targeting ppc64 whereas it works fine the other way round.

Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


[PATCH] Add biarch support for powerpc64

2010-07-03 Thread Andreas Schwab
return -1;
if (!(tcp->flags & TCB_INSYSCALL)) {
@@ -883,6 +883,28 @@ get_scno(struct tcb *tcp)
return 0;
}
}
+
+#  ifdef POWERPC64
+   if (!(tcp->flags & TCB_INSYSCALL)) {
+   static int currpers = -1;
+   long val;
+   int pid = tcp->pid;
+
+   /* Check for 64/32 bit mode. */
+   if (upeek(tcp, sizeof (unsigned long)*PT_MSR, &val) < 0)
+   return -1;
+   if (val < 0)
+   currpers = 0;
+   else
+   currpers = 1;
+   if (currpers != current_personality) {
+   static const char *const names[] = {"64 bit", "32 bit"};
+   set_personality(currpers);
+   printf("[ Process PID=%d runs in %s mode. ]\n",
+   pid, names[current_personality]);
+   }
+#  endif
+   }
 # elif defined(AVR32)
/*
 * Read complete register set in one go.
@@ -1460,7 +1482,7 @@ syscall_fixup(struct tcb *tcp)
 */
gpr2 = 0;
}
-#elif defined (POWERPC)
+#elif defined (POWERPC) || defined (POWERPC64)
 # define SO_MASK 0x1000
if (upeek(tcp, sizeof(unsigned long)*PT_CCR, &flags) < 0)
return -1;
@@ -1588,7 +1610,7 @@ get_error(struct tcb *tcp)
tcp->u_rval = r2;
u_error = 0;
}
-# elif defined(POWERPC)
+# elif defined(POWERPC) || defined(POWERPC64)
if (is_negated_errno(result)) {
tcp->u_rval = -1;
u_error = -result;
@@ -1842,7 +1864,7 @@ force_result(tcp, error, rval)
if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(REG_A3), a3) < 0 ||
ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(REG_V0), r2) < 0)
return -1;
-# elif defined(POWERPC)
+# elif defined(POWERPC) || defined(POWERPC64)
if (upeek(tcp, sizeof(unsigned long)*PT_CCR, &flags) < 0)
return -1;
if (error) {
@@ -2092,7 +2114,7 @@ syscall_enter(struct tcb *tcp)
}
}
}
-#elif defined (POWERPC)
+#elif defined (POWERPC) || defined (POWERPC64)
 # ifndef PT_ORIG_R3
 #  define PT_ORIG_R3 34
 # endif
diff --git a/util.c b/util.c
index bd12c0f..69d1e44 100644
--- a/util.c
+++ b/util.c
@@ -251,20 +251,24 @@ int
 printllval(struct tcb *tcp, const char *format, int llarg)
 {
 # if defined(FREEBSD) \
- || (defined(LINUX) && defined(POWERPC) && !defined(__powerpc64__)) \
+ || (defined(LINUX) && defined(POWERPC)) \
  || defined (LINUX_MIPSO32)
/* Align 64bit argument to 64bit boundary.  */
if (llarg % 2) llarg++;
 # endif
-# if defined LINUX && defined X86_64
+# if defined LINUX && (defined X86_64 || defined POWERPC64)
if (current_personality == 0) {
tprintf(format, tcp->u_arg[llarg]);
llarg++;
} else {
+#  ifdef POWERPC64
+   /* Align 64bit argument to 64bit boundary.  */
+   if (llarg % 2) llarg++;
+#  endif
tprintf(format, LONG_LONG(tcp->u_arg[llarg], tcp->u_arg[llarg + 
1]));
llarg += 2;
}
-# elif defined IA64 || defined ALPHA || (defined POWERPC && defined 
__powerpc64__)
+# elif defined IA64 || defined ALPHA
tprintf(format, tcp->u_arg[llarg]);
llarg++;
 # elif defined LINUX_MIPSN32
@@ -1106,14 +1110,18 @@ printcall(struct tcb *tcp)
return;
}
tprintf("[%08lx] ", ip);
-# elif defined(POWERPC)
+# elif defined(POWERPC) || defined(POWERPC64)
    long pc;
 
if (upeek(tcp, sizeof(unsigned long)*PT_NIP, &pc) < 0) {
-   tprintf ("[] ");
+   PRINTBADPC;
return;
}
+#  ifdef POWERPC64
+   tprintf("[%016lx] ", pc);
+#  else
tprintf("[%08lx] ", pc);
+#  endif
 # elif defined(M68K)
long pc;
 
@@ -1402,7 +1410,7 @@ typedef struct pt_regs arg_setup_state;
 #   elif defined (AVR32)
 #define arg0_offset(REG_R12)
 #define arg1_offset(REG_R11)
-#   elif defined (POWERPC)
+#   elif defined (POWERPC) || defined (POWERPC64)
 #define arg0_offset(sizeof(unsigned long)*PT_R3)
 #define arg1_offset(sizeof(unsigned long)*PT_R4)
 #define restore_arg0(tcp, state, val) ((void) (state), 0)
-- 
1.7.1.1


-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


[PATCH] Remove extern declaration at file scope

2010-07-03 Thread Andreas Schwab
* defs.h (force_result): Declare.
* process.c (internal_wait): Don't declare force_result.
---
 defs.h|1 +
 process.c |1 -
 2 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/defs.h b/defs.h
index 62b3719..a7e8793 100644
--- a/defs.h
+++ b/defs.h
@@ -490,6 +490,7 @@ extern int get_scno(struct tcb *);
 extern long known_scno(struct tcb *);
 extern long do_ptrace(int request, struct tcb *tcp, void *addr, void *data);
 extern int ptrace_restart(int request, struct tcb *tcp, int sig);
+extern int force_result(struct tcb *, int, long);
 extern int trace_syscall(struct tcb *);
 extern int count_syscall(struct tcb *, struct timeval *);
 extern void printxval(const struct xlat *, int, const char *);
diff --git a/process.c b/process.c
index c69e45e..dadf830 100644
--- a/process.c
+++ b/process.c
@@ -1981,7 +1981,6 @@ int flagarg;
if (tcp->u_arg[flagarg] & WNOHANG) {
/* We must force a fake result of 0 instead of
   the ECHILD error.  */
-   extern int force_result();
return force_result(tcp, 0, 0);
}
}
-- 
1.7.1.1


-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


Re: [PATCH] Document -C/-D

2010-06-23 Thread Andreas Schwab
* strace.c (usage): Document -C.
* strace.1: Document -D.
---
 strace.1 |   12 +++-
 strace.c |6 +++---
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/strace.1 b/strace.1
index a98b9f9..95fee64 100644
--- a/strace.1
+++ b/strace.1
@@ -43,7 +43,7 @@ strace \- trace system calls and signals
 .SH SYNOPSIS
 .B strace
 [
-.B \-CdffhiqrtttTvxx
+.B \-CdDffhiqrtttTvxx
 ]
 [
 .BI \-a column
@@ -84,6 +84,9 @@ strace \- trace system calls and signals
 .B strace
 .B \-c
 [
+.B \-D
+]
+[
 .BI \-e expr
 ]
 \&...
@@ -255,6 +258,13 @@ Like
 .B \-c
 but also print regular output while processes are running.
 .TP
+.B \-D
+(Not available on SVR4 and FreeBSD.)
+Run tracer process as a detached grandchild, not as parent of the
+tracee.  This reduces the visible effect of
+.B strace
+by keeping the tracee a direct child of the calling process.
+.TP
 .B \-d
 Show some debugging output of
 .B strace
diff --git a/strace.c b/strace.c
index 10d8e5c..64a7344 100644
--- a/strace.c
+++ b/strace.c
@@ -168,12 +168,13 @@ FILE *ofp;
 int exitval;
 {
fprintf(ofp, "\
-usage: strace [-dffhiqrtttTvVxx] [-a column] [-e expr] ... [-o file]\n\
+usage: strace [-CdDffhiqrtttTvVxx] [-a column] [-e expr] ... [-o file]\n\
   [-p pid] ... [-s strsize] [-u username] [-E var=val] ...\n\
   [command [arg ...]]\n\
-   or: strace -c -D [-e expr] ... [-O overhead] [-S sortby] [-E var=val] ...\n\
+   or: strace -c [-D] [-e expr] ... [-O overhead] [-S sortby] [-E var=val] 
...\n\
   [command [arg ...]]\n\
 -c -- count time, calls, and errors for each syscall and report summary\n\
+-C -- like -c but also print regular output while processes are running\n\
 -f -- follow forks, -ff -- with output into separate files\n\
 -F -- attempt to follow vforks, -h -- print help message\n\
 -i -- print instruction pointer at time of syscall\n\
@@ -746,7 +747,6 @@ main(int argc, char *argv[])
debug++;
break;
 #ifndef USE_PROCFS
-   /* Experimental, not documented in manpage yet. */
case 'D':
daemonized_tracer = 1;
break;
-- 
1.7.1


-- 
Andreas Schwab, sch...@redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84  5EC7 45C6 250E 6F00 984E
"And now for something completely different."

--
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


[PATCH] Document -C/-D

2010-06-11 Thread Andreas Schwab
* strace.c (usage): Document -C.
* strace.1: Document -D.
---
 strace.1 |8 +++-
 strace.c |5 +++--
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/strace.1 b/strace.1
index a98b9f9..c3d82af 100644
--- a/strace.1
+++ b/strace.1
@@ -43,7 +43,7 @@ strace \- trace system calls and signals
 .SH SYNOPSIS
 .B strace
 [
-.B \-CdffhiqrtttTvxx
+.B \-CdDffhiqrtttTvxx
 ]
 [
 .BI \-a column
@@ -84,6 +84,9 @@ strace \- trace system calls and signals
 .B strace
 .B \-c
 [
+.B \-D
+]
+[
 .BI \-e expr
 ]
 \&...
@@ -255,6 +258,9 @@ Like
 .B \-c
 but also print regular output while processes are running.
 .TP
+.B -D
+run tracer process as a detached grandchild, not as parent.
+.TP
 .B \-d
 Show some debugging output of
 .B strace
diff --git a/strace.c b/strace.c
index 10d8e5c..3f67670 100644
--- a/strace.c
+++ b/strace.c
@@ -168,12 +168,13 @@ FILE *ofp;
 int exitval;
 {
fprintf(ofp, "\
-usage: strace [-dffhiqrtttTvVxx] [-a column] [-e expr] ... [-o file]\n\
+usage: strace [-CdDffhiqrtttTvVxx] [-a column] [-e expr] ... [-o file]\n\
   [-p pid] ... [-s strsize] [-u username] [-E var=val] ...\n\
   [command [arg ...]]\n\
-   or: strace -c -D [-e expr] ... [-O overhead] [-S sortby] [-E var=val] ...\n\
+   or: strace -c [-D] [-e expr] ... [-O overhead] [-S sortby] [-E var=val] 
...\n\
   [command [arg ...]]\n\
 -c -- count time, calls, and errors for each syscall and report summary\n\
+-C -- like -c but also print regular output while processes are running\n\
 -f -- follow forks, -ff -- with output into separate files\n\
 -F -- attempt to follow vforks, -h -- print help message\n\
 -i -- print instruction pointer at time of syscall\n\
-- 
1.7.1


-- 
Andreas Schwab, sch...@redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84  5EC7 45C6 250E 6F00 984E
"And now for something completely different."

--
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


[PATCH] Collect processes in batches

2010-05-31 Thread Andreas Schwab
  errno = wait_errno;
perror("strace: wait");
-   return -1;
+   return (struct tcb *) -1;
}
}
if (pid == popen_pid) {
@@ -2442,9 +2474,6 @@ Process %d attached (waiting for parent)\n",
exit(1);
}
}
-   /* set current output file */
-   outf = tcp->outf;
-   curcol = tcp->curcol;
if (cflag) {
 #ifdef LINUX
tv_sub(&tcp->dtime, &ru.ru_stime, &tcp->stime);
@@ -2463,6 +2492,58 @@ Process %d attached (waiting for parent)\n",
 */
continue;
}
+#ifdef LINUX
+   /* If we waited and got a stopped task notification,
+* subsequent wait may return the same pid again, for example,
+* with SIGKILL notification. SIGKILL kills even stopped tasks.
+* We must not add it to the list
+* (one task can't be inserted twice in the list).
+*/
+   {
+   struct tcb *f = found_tcps;
+   while (f) {
+   if (f == tcp) {
+   remembered_pid = pid;
+   remembered_status = status;
+   return found_tcps;
+   }
+   f = f->next_need_service;
+   }
+   }
+
+   /* It is important to not invert the order of tasks
+* to process. For one, alloc_tcb() above picks newly forked
+* threads in some order, processing of them and their parent
+* should be in the same order, otherwise bad things happen
+* (misinterpreted SIGSTOPs and such).
+*/
+   tcp->wait_status = status;
+   *nextp = tcp;
+   nextp = &tcp->next_need_service;
+   *nextp = NULL;
+   wnohang = WNOHANG;
+#endif
+#ifdef SUNOS4
+   tcp->wait_status = status;
+   tcp->next_need_service = NULL;
+   return tcp;
+#endif
+   }
+   return found_tcps;
+}
+
+static int
+handle_stopped_tcbs(struct tcb *tcp)
+{
+   for (; tcp; tcp = tcp->next_need_service) {
+   int pid;
+   int status;
+
+   outf = tcp->outf;
+   curcol = tcp->curcol;
+   status = tcp->wait_status;
+   pid = tcp->pid;
+
if (WIFSIGNALED(status)) {
if (pid == strace_child)
exit_code = 0x100 | WTERMSIG(status);
@@ -2678,6 +2759,28 @@ Process %d attached (waiting for parent)\n",
return -1;
}
}
+
+   return 0;
+}
+
+static int
+trace()
+{
+   int rc;
+   struct tcb *tcbs;
+
+   while (nprocs != 0) {
+   if (interrupted)
+   return 0;
+   tcbs = collect_stopped_tcbs();
+   if (!tcbs)
+       break;
+   if (tcbs == (struct tcb *) -1)
+   return -1;
+   rc = handle_stopped_tcbs(tcbs);
+   if (rc)
+   return rc;
+   }
return 0;
 }
 
-- 
1.7.1

-- 
Andreas Schwab, sch...@redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84  5EC7 45C6 250E 6F00 984E
"And now for something completely different."

--

___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


M68K updates

2010-05-28 Thread Andreas Schwab
I've pushed these two patches to update the M68K port.

Andreas.

>From ffca9e30d6228532e84adc2cfe18f0ea72d199c5 Mon Sep 17 00:00:00 2001
From: Andreas Schwab 
Date: Fri, 28 May 2010 20:53:14 +0200
Subject: [PATCH 1/2] Fix warning when compiling for m68k

* syscall.c (d0): Define as long.
---
 syscall.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/syscall.c b/syscall.c
index b7bb733..40eee3a 100644
--- a/syscall.c
+++ b/syscall.c
@@ -727,7 +727,7 @@ internal_syscall(struct tcb *tcp)
 #elif defined (POWERPC)
static long result,flags;
 #elif defined (M68K)
-   static int d0;
+   static long d0;
 #elif defined(BFIN)
static long r0;
 #elif defined (ARM)
-- 
1.7.1


>From 587432273982c136809a6e9182e8ecf674648706 Mon Sep 17 00:00:00 2001
From: Andreas Schwab 
Date: Fri, 28 May 2010 22:28:51 +0200
Subject: [PATCH 2/2] Decode TLS syscalls on m68k

* linux/m68k/syscallent.h: Add entries for get_thread_area,
set_thread_area, atomic_comxchg_32, atomic_barrier.
* linux/dummy.h (sys_get_thread_area, sys_set_thread_area) [M68K]:
Don't redefine.
* mem.c (sys_get_thread_area, sys_set_thread_area) [LINUX && M68K]: New.
---
 linux/dummy.h   |2 ++
 linux/m68k/syscallent.h |8 
 mem.c   |   20 
 3 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/linux/dummy.h b/linux/dummy.h
index 92e6886..ce81649 100644
--- a/linux/dummy.h
+++ b/linux/dummy.h
@@ -41,9 +41,11 @@
 /* machine-specific */
 #ifndef I386
 #definesys_modify_ldt  printargs
+#ifndef M68K
 #define sys_get_thread_areaprintargs
 #define sys_set_thread_areaprintargs
 #endif
+#endif
 
 #define sys_sched_yieldprintargs
 #define sys_sched_get_priority_max sys_sched_get_priority_min
diff --git a/linux/m68k/syscallent.h b/linux/m68k/syscallent.h
index eba2f7f..ab11be3 100644
--- a/linux/m68k/syscallent.h
+++ b/linux/m68k/syscallent.h
@@ -361,10 +361,10 @@
{ 5,TD, printargs,  "pwritev"   }, /* 330 */
{ 4,TP|TS,  printargs,  "rt_tgsigqueueinfo"}, /* 331 */
{ 5,TD, printargs,  "perf_event_open"}, /* 332 */
-   { 5,0,  printargs,  "SYS_333"   }, /* 333 */
-   { 5,0,  printargs,  "SYS_334"   }, /* 334 */
-   { 5,0,  printargs,  "SYS_335"   }, /* 335 */
-   { 5,0,  printargs,  "SYS_336"   }, /* 336 */
+   { 0,0,  sys_get_thread_area,"get_thread_area"}, /* 333 */
+   { 1,0,  sys_set_thread_area,"set_thread_area"}, /* 334 */
+   { 6,0,  printargs,  "atomic_comxchg_32"}, /* 335 */
+   { 0,0,  printargs,  "atomic_barrier"}, /* 336 */
{ 5,0,  printargs,  "SYS_337"   }, /* 337 */
{ 5,0,  printargs,  "SYS_338"   }, /* 338 */
{ 5,0,  printargs,  "SYS_339"   }, /* 339 */
diff --git a/mem.c b/mem.c
index d55cd69..ec5707a 100644
--- a/mem.c
+++ b/mem.c
@@ -710,6 +710,26 @@ struct tcb *tcp;
 }
 #endif /* LINUX && __i386__ */
 
+#if defined(LINUX) && defined(M68K)
+
+int
+sys_set_thread_area(tcp)
+struct tcb *tcp;
+{
+   if (entering(tcp))
+   tprintf("%#lx", tcp->u_arg[0]);
+   return 0;
+
+}
+
+int
+sys_get_thread_area(tcp)
+struct tcb *tcp;
+{
+   return RVAL_HEX;
+}
+#endif
+
 #if defined(LINUX)
 int
 sys_remap_file_pages(tcp)
-- 
1.7.1


-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

--

___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


Re: [PATCH] fix build on systems that do not implement statfs64

2010-03-30 Thread Andreas Schwab
Adrien Kunysz  writes:

> the build system cannot find statfs64

That's what needs to be addressed, not doctoring the symptoms.

Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


Re: [PATCH] fix build on systems that do not implement statfs64

2010-03-29 Thread Andreas Schwab
Adrien Kunysz  writes:

> On Mon, Mar 29, 2010 at 05:00:46PM +0200, Andreas Schwab wrote:
>> Adrien Kunysz  writes:
>> 
>> > Initially it was because I didn't have -D__USE_LARGEFILE64 in the
>> 
>> You must not define __USE_LARGEFILE64, this is an internal glibc macro.
>> 
>> > CFLAGS. But even after using it, it fails to build. However the problem
>> > seems to actually be with the AC_STAT64 macro:
>> 
>> This is about stat*fs*64, not stat64.
>
> I know but "fixing" the STAT64 macro fixes the statfs64 problem for me.

You didn't fix anything, because AC_STAT64 is working as designed.

Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


Re: [PATCH] fix build on systems that do not implement statfs64

2010-03-29 Thread Andreas Schwab
Adrien Kunysz  writes:

> Initially it was because I didn't have -D__USE_LARGEFILE64 in the

You must not define __USE_LARGEFILE64, this is an internal glibc macro.

> CFLAGS. But even after using it, it fails to build. However the problem
> seems to actually be with the AC_STAT64 macro:

This is about stat*fs*64, not stat64.

Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


Re: [PATCH] Try to use PTRACE_SETOPTIONS to handle non-ptrace SIGTRAP

2010-03-09 Thread Andreas Schwab
Roland McGrath  writes:

> Sorry, this answer is wholly inadequate.

I have shown you how reality looks like.  This is perfectly adequate.

> I wrote a small test program and posted it.

It does not matter.  What matters is how strace has to handle reality.

Andreas.

-- 
Andreas Schwab, sch...@redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84  5EC7 45C6 250E 6F00 984E
"And now for something completely different."

--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


[PATCH] Avoid spurious error when checking for linux/netlink.h

2010-03-08 Thread Andreas Schwab
* configure.ac: Include  when checking for
linux/netlink.h.
---
 configure.ac |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/configure.ac b/configure.ac
index a935272..f16daa4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -263,7 +263,8 @@ AC_CHECK_HEADERS([ \
 ], [], [])
 AC_CHECK_HEADERS([linux/icmp.h linux/in6.h linux/netlink.h linux/if_packet.h],
  [], [], [#include 
-#include ])
+#include 
+#include ])
 AC_CHECK_HEADERS([asm/sigcontext.h], [], [], [#include ])
 AC_CHECK_TYPES([struct sigcontext_struct,
struct sigcontext],,, [#include ])
-- 
1.7.0.1


-- 
Andreas Schwab, sch...@redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84  5EC7 45C6 250E 6F00 984E
"And now for something completely different."

--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


Re: [PATCH] Try to use PTRACE_SETOPTIONS to handle non-ptrace SIGTRAP

2010-03-08 Thread Andreas Schwab
Roland McGrath  writes:

>> > If you trace an execve, you're going to get its syscall exit stop
>> > before you get its old-style traced-exec SIGTRAP.
>> 
>> No, you don't.
>
> How did you come to that conclusion?

Reality check.

Breakpoint 1, is_ptrace_stop (tcp=0x661030, status=34175)
at ../strace/strace.c:2282
2282if (!(tcp->flags & TCB_PTRACE_OPTIONS))
(gdb) c
Continuing.
execve("/bin/echo", ["echo"], [/* 79 vars */]
Breakpoint 1, is_ptrace_stop (tcp=0x661030, status=263551)
at ../strace/strace.c:2282
2282if (!(tcp->flags & TCB_PTRACE_OPTIONS))
(gdb) 
Continuing.

Breakpoint 1, is_ptrace_stop (tcp=0x661030, status=34175)
at ../strace/strace.c:2282
2282if (!(tcp->flags & TCB_PTRACE_OPTIONS))
(gdb) 
Continuing.
) = 0

Andreas.

-- 
Andreas Schwab, sch...@redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84  5EC7 45C6 250E 6F00 984E
"And now for something completely different."

--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


Re: [PATCH] Try to use PTRACE_SETOPTIONS to handle non-ptrace SIGTRAP

2010-03-05 Thread Andreas Schwab
Roland McGrath  writes:

> If you trace an execve, you're going to get its syscall exit stop
> before you get its old-style traced-exec SIGTRAP.

No, you don't.

> But, for exec doesn't it make sense to call it a possible ptrace stop only
> if TCB_STARTUP?

What if PTRACE_O_TRACEEXEC doesn't work?  That contradicts your own
words.

Andreas.

-- 
Andreas Schwab, sch...@redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84  5EC7 45C6 250E 6F00 984E
"And now for something completely different."

--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


Re: [PATCH] Try to use PTRACE_SETOPTIONS to handle non-ptrace SIGTRAP

2010-03-04 Thread Andreas Schwab
  return -1;
}
}
+   set_ptrace_options(tcp);
goto tracing;
}
 
-   if (WSTOPSIG(status) != SIGTRAP) {
+   if (!is_ptrace_stop(tcp, status)) {
if (WSTOPSIG(status) == SIGSTOP &&
(tcp->flags & TCB_SIGTRAPPED)) {
/*
@@ -2533,6 +2603,13 @@ Process %d attached (waiting for parent)\n",
/* we handled the STATUS, we are permitted to interrupt now. */
if (interrupted)
return 0;
+   /* Ignore post-execve trap. */
+   if (is_post_execve_trap(tcp, status)) {
+#ifdef TCB_WAITEXECVE
+   tcp->flags &= ~TCB_WAITEXECVE;
+#endif
+   goto tracing;
+   }
if (trace_syscall(tcp) < 0 && !tcp->ptrace_errno) {
    /* ptrace() failed in trace_syscall() with ESRCH.
 * Likely a result of process disappearing mid-flight.
-- 
1.7.0.1


Andreas.

-- 
Andreas Schwab, sch...@redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84  5EC7 45C6 250E 6F00 984E
"And now for something completely different."

--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


Re: [PATCH] Try to use PTRACE_SETOPTIONS to handle non-ptrace SIGTRAP

2010-03-03 Thread Andreas Schwab
andled the STATUS, we are permitted to interrupt now. */
if (interrupted)
return 0;
+   /* Ignore post-execve trap. */
+   if (is_post_execve_trap(tcp, status)) {
+#ifdef TCB_WAITEXECVE
+   tcp->flags &= ~TCB_WAITEXECVE;
+#endif
+   goto tracing;
+   }
if (trace_syscall(tcp) < 0 && !tcp->ptrace_errno) {
/* ptrace() failed in trace_syscall() with ESRCH.
 * Likely a result of process disappearing mid-flight.
-- 
1.7.0.1


Andreas.

-- 
Andreas Schwab, sch...@redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84  5EC7 45C6 250E 6F00 984E
"And now for something completely different."

--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


[PATCH] Try to use PTRACE_SETOPTIONS to handle non-ptrace SIGTRAP

2010-02-24 Thread Andreas Schwab
   tcp->flags &= ~TCB_SUSPENDED;
continue;
}
+   /* Ignore post-execve trap. */
+   if (is_post_execve_trap(tcp, status))
+   goto tracing;
        /* we handled the STATUS, we are permitted to interrupt now. */
if (interrupted)
return 0;
-- 
1.7.0


-- 
Andreas Schwab, sch...@redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84  5EC7 45C6 250E 6F00 984E
"And now for something completely different."

--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


[PATCH] Fix reporting signal mask by sigreturn on powerpc

2010-02-22 Thread Andreas Schwab
* signal.c (sys_sigreturn) [POWERPC]: Skip dummy stack frame when
locating signal context.
---
 signal.c |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/signal.c b/signal.c
index c1d6eb0..bf97e90 100644
--- a/signal.c
+++ b/signal.c
@@ -1329,6 +1329,12 @@ sys_sigreturn(struct tcb *tcp)
tcp->u_arg[0] = 0;
if (upeek(tcp, sizeof(unsigned long)*PT_R1, &esp) < 0)
return 0;
+   /* Skip dummy stack frame. */
+#ifdef __powerpc64__
+   esp += 128;
+#else
+   esp += 64;
+#endif
if (umove(tcp, esp, &sc) < 0)
return 0;
tcp->u_arg[0] = 1;
-- 
1.7.0


Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

--
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


[PATCH] Decode recvmmsg syscall

2010-02-12 Thread Andreas Schwab
   "semop" }, /* 373 */
-   { 4,TI, sys_semget, "semget"}, /* 374 */
-   { 4,TI, sys_semctl, "semctl"}, /* 375 */
-   { 5,TI, sys_semtimedop, "semtimedop"}, /* 376 */
-   { 4,0,  printargs,  "ipc_subcall"   }, /* 377 */
+   { 4,0,  printargs,  "ipc_subcall"   }, /* 373 */
+   { 4,TI, printargs,  "semop" }, /* 374 */
+   { 4,TI, sys_semget, "semget"}, /* 375 */
+   { 4,TI, sys_semctl, "semctl"}, /* 376 */
+   { 5,TI, sys_semtimedop, "semtimedop"}, /* 377 */
{ 4,0,  printargs,  "ipc_subcall"   }, /* 378 */
{ 4,0,  printargs,  "ipc_subcall"   }, /* 379 */
{ 4,0,  printargs,  "ipc_subcall"   }, /* 380 */
{ 4,0,  printargs,  "ipc_subcall"   }, /* 381 */
{ 4,0,  printargs,  "ipc_subcall"   }, /* 382 */
-   { 4,TI, sys_msgsnd, "msgsnd"}, /* 383 */
-   { 4,TI, sys_msgrcv, "msgrcv"}, /* 384 */
-   { 4,TI, sys_msgget, "msgget"}, /* 385 */
-   { 4,TI, sys_msgctl, "msgctl"}, /* 386 */
-   { 4,0,  printargs,  "ipc_subcall"   }, /* 387 */
+   { 4,0,  printargs,  "ipc_subcall"   }, /* 383 */
+   { 4,TI, sys_msgsnd, "msgsnd"}, /* 384 */
+   { 4,TI, sys_msgrcv, "msgrcv"}, /* 385 */
+   { 4,TI, sys_msgget, "msgget"}, /* 386 */
+   { 4,TI, sys_msgctl, "msgctl"}, /* 387 */
{ 4,0,  printargs,  "ipc_subcall"   }, /* 388 */
{ 4,0,  printargs,  "ipc_subcall"   }, /* 389 */
{ 4,0,  printargs,  "ipc_subcall"   }, /* 390 */
{ 4,0,  printargs,  "ipc_subcall"   }, /* 391 */
{ 4,0,  printargs,  "ipc_subcall"   }, /* 392 */
-   { 4,TI, sys_shmat,  "shmat" }, /* 393 */
-   { 4,TI, sys_shmdt,  "shmdt" }, /* 394 */
-   { 4,TI, sys_shmget, "shmget"}, /* 395 */
-   { 4,TI, sys_shmctl, "shmctl"}, /* 396 */
-   { 5,0,  printargs,  "SYS_397"   }, /* 397 */
-   { 5,0,  printargs,  "SYS_398"   }, /* 398 */
-   { 5,0,  printargs,  "SYS_399"   }, /* 399 */
-   { 5,0,  printargs,  "SYS_400"   }, /* 400 */
+   { 4,0,  printargs,  "ipc_subcall"   }, /* 393 */
+   { 4,TI, sys_shmat,  "shmat" }, /* 394 */
+   { 4,TI, sys_shmdt,  "shmdt" }, /* 395 */
+   { 4,TI, sys_shmget, "shmget"}, /* 396 */
+   { 4,TI, sys_shmctl, "shmctl"}, /* 397 */
+   { 5,0,  printargs,  "SYS_397"   }, /* 398 */
+   { 5,0,  printargs,  "SYS_398"   }, /* 399 */
+   { 5,0,  printargs,  "SYS_399"   }, /* 400 */
+   { 5,0,  printargs,  "SYS_400"   }, /* 401 */
diff --git a/linux/syscall.h b/linux/syscall.h
index 03c8b81..1ba3764 100644
--- a/linux/syscall.h
+++ b/linux/syscall.h
@@ -113,6 +113,7 @@ int sys_socket(), sys_bind(), sys_connect(), sys_listen(), 
sys_accept4();
 int sys_accept(), sys_getsockname(), sys_getpeername(), sys_socketpair();
 int sys_send(), sys_recv(), sys_sendto(), sys_recvfrom();
 int sys_shutdown(), sys_setsockopt(), sys_getsockopt();
+int sys_recvmmsg();
 
 /* *at syscalls */
 int sys_fchmodat();
@@ -227,8 +228,9 @@ int sys_osf_utimes();
 #define SYS_sub_sendmsg(SYS_socket_subcall + 16)
 #define SYS_sub_recvmsg(SYS_socket_subcall + 17)
 #define SYS_sub_accept4(SYS_socket_subcall + 18)
+#define SYS_sub_recvmmsg   (SYS_socket_subcall + 19)
 
-#define SYS_socket_nsubcalls   19
+#define SYS_socket_nsubcalls   20
 #endif /* !(ALPHA || MIPS || HPPA) */
 
 /* sys_ipc subcalls */
diff --git a/net.c b/net.c
index 511f720..ded21a3 100644
--- a/net.c
+++ b/net.c
@@ -1185,6 +1185,30 @@ printcmsghdr(struct tcb *tcp, unsigned long addr, 
unsigned long len)
 }
 
 static void
+do_msghdr(struct tcb *tcp, struct msghdr *msg)
+{
+   tprintf("{msg_name(%d)=", msg->msg_namelen);
+   printsock(tcp, (long)msg->msg_name, msg->msg_namelen);
+
+   tprintf(", msg_iov(%lu)=", (unsigned long)msg->msg_iovlen);
+   tprint_iov(tcp, (unsigned long)msg->msg_iovlen,
+  (unsigned long)msg->msg_iov);
+
+#ifdef HAVE_STRUCT_MSGHDR_MSG_CONTROL
+   tprintf(", msg_controllen=%lu", (unsigned long)msg->msg_controllen);
+   if (msg->msg_controllen)
+   printcmsghdr(tcp, (unsigned long) msg->msg_control,
+msg->msg_controllen);
+   tprintf(", msg_flags=");
+   printflags(msg_flags, msg->msg_flags, "MSG_???");
+#else /* !HAVE_STRUCT_MSGHDR_MSG_CONTROL */
+   tprintf("msg_accrights=%#lx, msg_accrightslen=%u",
+   (unsigned long) msg->msg_accrights, msg->msg_accrightslen);
+#endif /* !HAVE_STRUCT_MSGHDR_MSG_CONTROL */
+   tprintf("}");
+}
+
+static void
 printmsghdr(tcp, addr)
 struct tcb *tcp;
 long addr;
@@ -1195,26 +1219,27 @@ long addr;
tprintf("%#lx", addr);
return;
}
-   tprintf("{msg_name(%d)=", msg.msg_namelen);
-   printsock(tcp, (long)msg.msg_name, msg.msg_namelen);
+   do_msghdr(tcp, &msg);
+}
 
-   tprintf(", msg_iov(%lu)=", (unsigned long)msg.msg_iovlen);
-   tprint_iov(tcp, (unsigned long)msg.msg_iovlen,
-  (unsigned long)msg.msg_iov);
+#ifdef LINUX
+static void
+printmmsghdr(struct tcb *tcp, long addr)
+{
+   struct mmsghdr {
+   struct msghdr msg_hdr;
+   unsigned msg_len;
+   } mmsg;
 
-#ifdef HAVE_STRUCT_MSGHDR_MSG_CONTROL
-   tprintf(", msg_controllen=%lu", (unsigned long)msg.msg_controllen);
-   if (msg.msg_controllen)
-   printcmsghdr(tcp, (unsigned long) msg.msg_control,
-msg.msg_controllen);
-   tprintf(", msg_flags=");
-   printflags(msg_flags, msg.msg_flags, "MSG_???");
-#else /* !HAVE_STRUCT_MSGHDR_MSG_CONTROL */
-   tprintf("msg_accrights=%#lx, msg_accrightslen=%u",
-   (unsigned long) msg.msg_accrights, msg.msg_accrightslen);
-#endif /* !HAVE_STRUCT_MSGHDR_MSG_CONTROL */
-   tprintf("}");
+   if (umove(tcp, addr, &mmsg) < 0) {
+   tprintf("%#lx", addr);
+   return;
+   }
+   tprintf("{");
+   do_msghdr(tcp, &mmsg.msg_hdr);
+   tprintf(", %u}", mmsg.msg_len);
 }
+#endif
 
 #endif /* HAVE_SENDMSG */
 
@@ -1503,6 +1528,24 @@ struct tcb *tcp;
return 0;
 }
 
+#ifdef LINUX
+int
+sys_recvmmsg(struct tcb *tcp)
+{
+   if (entering(tcp)) {
+   tprintf("%ld, ", tcp->u_arg[0]);
+   printmmsghdr(tcp, tcp->u_arg[1]);
+   tprintf(", %ld, ", tcp->u_arg[2]);
+   /* flags */
+   printflags(msg_flags, tcp->u_arg[3], "MSG_???");
+   /* timeout */
+   tprintf(", ");
+   print_timespec(tcp, tcp->u_arg[4]);
+   }
+   return 0;
+}
+#endif
+
 #endif /* HAVE_SENDMSG */
 
 int
-- 
1.6.6.2


Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


[PATCH] Reliably detect post-execve trap on ia64

2010-02-01 Thread Andreas Schwab
* defs.h (TCB_WAITEXECVE) [IA64]: Don't define.
* syscall.c (get_scno) [IA64]: Don't check for TCB_WAITEXECVE.
(syscall_fixup) [IA64]: Check for post-execve signal.
---
 defs.h|2 +-
 syscall.c |   29 -
 2 files changed, 13 insertions(+), 18 deletions(-)

diff --git a/defs.h b/defs.h
index a869929..8802068 100644
--- a/defs.h
+++ b/defs.h
@@ -370,7 +370,7 @@ struct tcb {
  * See "stray syscall exit: eax = " message in syscall_fixup().
  */
 # if defined(ALPHA) || defined(AVR32) || defined(SPARC) || defined(SPARC64) \
-  || defined(POWERPC) || defined(IA64) || defined(HPPA) \
+  || defined(POWERPC) || defined(HPPA) \
   || defined(SH) || defined(SH64) || defined(S390) || defined(S390X) \
   || defined(ARM) || defined(MIPS) || defined(BFIN)
 #  define TCB_WAITEXECVE 02000 /* ignore SIGTRAP after exceve */
diff --git a/syscall.c b/syscall.c
index 3f551cd..1aba4da 100644
--- a/syscall.c
+++ b/syscall.c
@@ -980,24 +980,11 @@ get_scno(struct tcb *tcp)
 #  define IA64_PSR_IS  ((long)1 << 34)
if (upeek (tcp, PT_CR_IPSR, &psr) >= 0)
ia32 = (psr & IA64_PSR_IS) != 0;
-   if (!(tcp->flags & TCB_INSYSCALL)) {
-   if (ia32) {
-   if (upeek(tcp, PT_R1, &scno) < 0)   /* orig eax */
-   return -1;
-   } else {
-   if (upeek (tcp, PT_R15, &scno) < 0)
-   return -1;
-   }
-   /* Check if we return from execve. */
-   if (tcp->flags & TCB_WAITEXECVE) {
-   tcp->flags &= ~TCB_WAITEXECVE;
-   return 0;
-   }
-   } else {
-   /* syscall in progress */
-   if (upeek (tcp, PT_R8, &r8) < 0)
+   if (ia32) {
+   if (upeek(tcp, PT_R1, &scno) < 0)   /* orig eax */
return -1;
-   if (upeek (tcp, PT_R10, &r10) < 0)
+   } else {
+   if (upeek (tcp, PT_R15, &scno) < 0)
return -1;
}
 # elif defined (ARM)
@@ -1487,6 +1474,14 @@ syscall_fixup(struct tcb *tcp)
fprintf(stderr, "stray syscall exit: r8 = %ld\n", r8);
return 0;
}
+   if (!ia32 && !(tcp->flags & TCB_INSYSCALL) && tcp->scno == SYS_execve) {
+   siginfo_t si;
+
+   /* Check whether this is the execve post-exec signal.  */
+   if (ptrace(PTRACE_GETSIGINFO, tcp->pid, 0, (long)&si) == 0)
+   if (si.si_code == SI_USER)
+   return 0;
+   }
 #elif defined(CRISV10) || defined(CRISV32)
if (upeek(tcp, 4*PT_R10, &r10) < 0)
return -1;
-- 
1.6.6.1


Andreas.

-- 
Andreas Schwab, sch...@redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84  5EC7 45C6 250E 6F00 984E
"And now for something completely different."

--
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


Re: [PATCH] Fix spurious failure of AC_STAT64 test

2010-01-26 Thread Andreas Schwab
"Dmitry V. Levin"  writes:

> On Mon, Jan 25, 2010 at 11:38:09AM +0100, Andreas Schwab wrote:
>> Here is a better patch, pre-POSIX systems might need 
>> before .
>
> I suppose the proposed change fixes a real spurious failure I'm not
> aware of, but I'd like to know for sure.
> I'm sorry, but I have to repeat the same question I've already asked
> before: what is the kernel version and architecture where 
> isn't self-contained?

$ grep ino_t --include=stat.h -r arch
arch/mips/include/asm/stat.h:   ino_t   st_ino;
arch/parisc/include/asm/stat.h: ino_t   st_ino; /* 32 bits */
arch/parisc/include/asm/stat.h: ino_t   __unused3;  /* network */
arch/parisc/include/asm/stat.h: ino_t   st_ino; /* 32 bits */
arch/parisc/include/asm/stat.h: ino_t   __unused3;  /* network */
arch/powerpc/include/asm/stat.h:ino_t   st_ino;
arch/sparc/include/asm/stat.h:  ino_t   st_ino;
arch/sparc/include/asm/stat.h:  ino_t   st_ino;

Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

--
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


Re: [PATCH] Fix spurious failure of AC_STAT64 test

2010-01-25 Thread Andreas Schwab
Here is a better patch, pre-POSIX systems might need 
before .

Andreas.

>From 3de3d6bf5abdf410110aed1f844992304f6ae8b9 Mon Sep 17 00:00:00 2001
From: Andreas Schwab 
Date: Mon, 25 Jan 2010 11:32:48 +0100
Subject: [PATCH] Fix spurious failure of AC_STAT64 test

* acinclude.m4 (AC_STAT64): Include  first.
---
 acinclude.m4 |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/acinclude.m4 b/acinclude.m4
index 5473b69..da66c64 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -196,7 +196,8 @@ dnl ### A macro to determine whether stat64 is defined.
 AC_DEFUN([AC_STAT64],
 [AC_MSG_CHECKING(for stat64 in (asm|sys)/stat.h)
 AC_CACHE_VAL(ac_cv_type_stat64,
-[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#ifdef LINUX
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include 
+#ifdef LINUX
 #include 
 #include 
 #else
-- 
1.6.6


-- 
Andreas Schwab, sch...@redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84  5EC7 45C6 250E 6F00 984E
"And now for something completely different."

--
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


Re: [PATCH] Fix spurious failure of AC_STAT64 test

2010-01-24 Thread Andreas Schwab
"Dmitry V. Levin"  writes:

> $ echo '#include ' |gcc -xc -c - -o /dev/null 
In file included from :1:
/usr/include/asm/stat.h:31: error: expected specifier-qualifier-list before 
‘ino_t’

Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

--
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


[PATCH] Fix spurious failure of AC_STAT64 test

2010-01-23 Thread Andreas Schwab
>From c8fdc7ef4f8413fdb25ef6a6013d2bbf2e20 Mon Sep 17 00:00:00 2001
From: Andreas Schwab 
Date: Sun, 24 Jan 2010 00:09:15 +0100
Subject: [PATCH] Fix spurious failure of AC_STAT64 test

* acinclude.m4 (AC_STAT64): Include  instead of
.
---
 acinclude.m4 |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/acinclude.m4 b/acinclude.m4
index 5473b69..f174592 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -197,7 +197,7 @@ AC_DEFUN([AC_STAT64],
 [AC_MSG_CHECKING(for stat64 in (asm|sys)/stat.h)
 AC_CACHE_VAL(ac_cv_type_stat64,
 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#ifdef LINUX
-#include 
+#include 
 #include 
 #else
 #include 
-- 
1.6.6.1


Andreas.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

--
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


[PATCH] Don't kill the process when detaching

2010-01-11 Thread Andreas Schwab
>From 71ed53b3d56568e04c4ebeb487d6c92cbe20dc57 Mon Sep 17 00:00:00 2001
From: Andreas Schwab 
Date: Mon, 11 Jan 2010 17:51:48 +0100
Subject: [PATCH] Don't kill the process when detaching

* strace.c (detach): Call clearbpt when TCB_BPTSET is set.
---
 strace.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/strace.c b/strace.c
index d236516..23c3650 100644
--- a/strace.c
+++ b/strace.c
@@ -1540,7 +1540,7 @@ int sig;
 #endif
 
if (tcp->flags & TCB_BPTSET)
-   sig = SIGKILL;
+   clearbpt(tcp);
 
 #ifdef LINUX
/*
-- 
1.6.6


Andreas.

-- 
Andreas Schwab, sch...@redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84  5EC7 45C6 250E 6F00 984E
"And now for something completely different."

--
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


[PATCH] Make strace correctly handle SIGTRAP produced by e.g. kill(2) and by trapping instruction.

2009-12-14 Thread Andreas Schwab
  */
+   if (si.si_signo != SIGTRAP
+   || (si.si_code != SI_KERNEL && si.si_code 
!= SI_USER)) {
+   fprintf(stderr, "bogus SIGTRAP 
(si_code:%x), assuming old kernel\n", si.si_code);
+   ptrace_stop_sig = SIGTRAP;
+   }
+   }
+   }
+#endif
+
+   if (WSTOPSIG(status) != ptrace_stop_sig) {
+   /* This isn't a ptrace stop.  */
+
if (WSTOPSIG(status) == SIGSTOP &&
        (tcp->flags & TCB_SIGTRAPPED)) {
/*
-- 
1.6.5.5


Andreas.

-- 
Andreas Schwab, sch...@redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84  5EC7 45C6 250E 6F00 984E
"And now for something completely different."

--
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


[PATCH] Ignore errors if a thread is killed

2009-11-11 Thread Andreas Schwab
In general, if a thread is forcefully killed strace should not panic.

Andreas.

>From 46ed50d56909843420b0a0cb1360a500ce421d52 Mon Sep 17 00:00:00 2001
From: Andreas Schwab 
Date: Wed, 11 Nov 2009 13:54:04 +0100
Subject: [PATCH] Ignore errors if a thread is killed

* util.c (clearbpt): Ignore ESRCH error.
---
 util.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/util.c b/util.c
index a471590..78b1427 100644
--- a/util.c
+++ b/util.c
@@ -1710,7 +1710,7 @@ struct tcb *tcp;
|| restore_arg0 (tcp, &state, tcp->inst[0]) < 0
|| restore_arg1 (tcp, &state, tcp->inst[1]) < 0
|| arg_finish_change (tcp, &state))
-   return -1;
+   if (errno != ESRCH) return -1;
tcp->flags &= ~TCB_BPTSET;
    return 0;
 }
-- 
1.6.5.2


-- 
Andreas Schwab, sch...@redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84  5EC7 45C6 250E 6F00 984E
"And now for something completely different."

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


Re: Make strace correctly handle SIGTRAP produced by e.g.

2009-11-10 Thread Andreas Schwab
Which ones are missing?

Andreas.

-- 
Andreas Schwab, sch...@redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84  5EC7 45C6 250E 6F00 984E
"And now for something completely different."

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


Re: Make strace correctly handle SIGTRAP produced by e.g.

2009-11-09 Thread Andreas Schwab
USER)
+* si_pid:0si_pid:(>0?)
+* si_band:0   si_band:(?)
+* Ptrace stops have garbage there instead.
+*/
+   if (si.si_signo != SIGTRAP
+|| (si.si_code != SI_KERNEL && si.si_code != 
SI_USER)
+   ) {
+   fprintf(stderr, "bogus SIGTRAP 
(si_code:%x), assuming old kernel\n", si.si_code);
+   ptrace_stop_sig = SIGTRAP;
+   }
+   }
+   }
+#endif
+
+   if (WSTOPSIG(status) != ptrace_stop_sig) {
+   /* This isn't a ptrace stop.  */
+
if (WSTOPSIG(status) == SIGSTOP &&
    (tcp->flags & TCB_SIGTRAPPED)) {
/*
-- 
1.6.5.2



Andreas.

-- 
Andreas Schwab, sch...@redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84  5EC7 45C6 250E 6F00 984E
"And now for something completely different."

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


Re: [PATCH] Factor out printing of 64bit syscall argument

2009-11-04 Thread Andreas Schwab
Here is an updated patch.

Andreas.

>From b5600fc3df0453ba11f254a9b49add3ffbec9733 Mon Sep 17 00:00:00 2001
From: Andreas Schwab 
Date: Wed, 4 Nov 2009 17:08:34 +0100
Subject: [PATCH] Factor out printing of 64bit syscall argument

* defs.h (ALIGN64): Remove.
(printllval): Declare.
* util.c (printllval): Define.
* file.c (sys_readahead): Use printllval.
(sys_lseek64): Likewise.
(sys_truncate64): Likewise.
(sys_ftruncate64): Likewise.
(sys_fadvise64): Likewise.
(sys_fadvise64_64): Likewise.
(sys_fallocate): Likewise.
* io.c (sys_pread): Likewise.
(sys_pwrite): Likewise.
(sys_pread64): Likewise.
(sys_pwrite64): Likewise.
* mem.c (sys_mmap64): Likewise.
---
 defs.h |   16 +---
 file.c |   79 ---
 io.c   |   28 ++
 mem.c  |3 +-
 util.c |   36 +
 5 files changed, 77 insertions(+), 85 deletions(-)

diff --git a/defs.h b/defs.h
index 5bcaa07..dc0d91f 100644
--- a/defs.h
+++ b/defs.h
@@ -651,20 +651,6 @@ extern const char *const signalent2[];
 extern const int nsignals2;
 #endif /* SUPPORTED_PERSONALITIES >= 3 */
 
-#if defined(FREEBSD) || (defined(LINUX) \
-&& defined(POWERPC) && !defined(__powerpc64__)) \
-  || defined (LINUX_MIPSO32)
-/* ARRGH!  off_t args are aligned on 64 bit boundaries! */
-#define ALIGN64(tcp,arg)   \
-do {   \
-   if (arg % 2)\
-   memmove (&tcp->u_arg[arg], &tcp->u_arg[arg + 1],\
-(tcp->u_nargs - arg - 1) * sizeof tcp->u_arg[0]);  \
-} while (0)
-#else
-#define ALIGN64(tcp,arg) do { } while (0)
-#endif
-
 #if HAVE_LONG_LONG
 
 /* _l refers to the lower numbered u_arg,
@@ -678,6 +664,8 @@ do {
\
 #define LONG_LONG(_l,_h) \
 ((long long)((unsigned long long)(unsigned)(_h) | ((unsigned long 
long)(_l)<<32)))
 #endif
+
+extern int printllval(struct tcb *, const char *, int);
 #endif
 
 #ifdef IA64
diff --git a/file.c b/file.c
index 2e46284..14df971 100644
--- a/file.c
+++ b/file.c
@@ -610,16 +610,10 @@ int
 sys_readahead(struct tcb *tcp)
 {
if (entering(tcp)) {
-   ALIGN64 (tcp, 1);
-   tprintf("%ld, %lld, %ld", tcp->u_arg[0],
-# if defined LINUX_MIPSN32
-   tcp->ext_arg[1], tcp->u_arg[2]
-# elif defined IA64 || defined X86_64 || defined ALPHA || defined 
LINUX_MIPSN64 || (defined POWERPC && defined __powerpc64__)
-   (long long int) tcp->u_arg[1], tcp->u_arg[2]
-# else
-   LONG_LONG(tcp->u_arg[1], tcp->u_arg[2]), tcp->u_arg[3]
-# endif
-   );
+   int argn;
+   tprintf("%ld, ", tcp->u_arg[0]);
+   argn = printllval(tcp, "%lld", 1);
+   tprintf(", %ld", tcp->u_arg[argn]);
}
return 0;
 }
@@ -630,14 +624,13 @@ int
 sys_lseek64(struct tcb *tcp)
 {
if (entering(tcp)) {
-   long long offset;
-   ALIGN64 (tcp, 1);   /* FreeBSD aligns off_t args */
-   offset = LONG_LONG(tcp->u_arg [1], tcp->u_arg[2]);
+   int argn;
+   tprintf("%ld, ", tcp->u_arg[0]);
if (tcp->u_arg[3] == SEEK_SET)
-   tprintf("%ld, %llu, ", tcp->u_arg[0], offset);
+   argn = printllval(tcp, "%llu, ", 1);
else
-   tprintf("%ld, %lld, ", tcp->u_arg[0], offset);
-   printxval(whence, tcp->u_arg[3], "SEEK_???");
+   argn = printllval(tcp, "%lld, ", 1);
+   printxval(whence, tcp->u_arg[argn], "SEEK_???");
}
return RVAL_LUDECIMAL;
 }
@@ -660,9 +653,8 @@ int
 sys_truncate64(struct tcb *tcp)
 {
if (entering(tcp)) {
-   ALIGN64 (tcp, 1);
printpath(tcp, tcp->u_arg[0]);
-   tprintf(", %llu", LONG_LONG(tcp->u_arg[1],tcp->u_arg[2]));
+   printllval(tcp, ", %llu", 1);
}
return 0;
 }
@@ -684,9 +676,8 @@ int
 sys_ftruncate64(struct tcb *tcp)
 {
if (entering(tcp)) {
-   ALIGN64 (tcp, 1);
-   tprintf("%ld, %llu", tcp->u_arg[0],
-   LONG_LONG(tcp->u_arg[1] ,tcp->u_arg[2]));
+   tprintf("%ld, ", tcp->u_arg[0]);
+   printllval(tcp, "%llu", 1);
}
return 0;
 }
@@ -2816,16 +2807,11 @@ int
 sys_fadvise64(struct tcb *tcp)
 {
if (entering(tcp)) {
-   ALIGN64(tcp, 1);
- 

Re: [PATCH] Factor out printing of 64bit syscall argument

2009-11-04 Thread Andreas Schwab
"Dmitry V. Levin"  writes:

> On Wed, Nov 04, 2009 at 12:55:46PM +0100, Andreas Schwab wrote:
>> This patch refactors the printing of 64bit syscall arguments.
>
> I like the change, but I have two questions about particular hunks of
> the patch.
>
>> @@ -631,7 +625,6 @@ sys_lseek64(struct tcb *tcp)
>>  {
>>  if (entering(tcp)) {
>>  long long offset;
>> -ALIGN64 (tcp, 1);   /* FreeBSD aligns off_t args */
>>  offset = LONG_LONG(tcp->u_arg [1], tcp->u_arg[2]);
>>  if (tcp->u_arg[3] == SEEK_SET)
>>  tprintf("%ld, %llu, ", tcp->u_arg[0], offset);
>
> Why printllval() is not used here?

Accidentally dropped the ball here.

>> @@ -2836,22 +2822,14 @@ int
>>  sys_fadvise64_64(struct tcb *tcp)
>>  {
>>  if (entering(tcp)) {
>> -tprintf("%ld, %lld, %lld, ",
>> -tcp->u_arg[0],
>> -#if defined LINUX_MIPSN32
>> -tcp->ext_arg[1], tcp->ext_arg[2]);
>> -printxval(advise, tcp->u_arg[3], "POSIX_FADV_???");
>> -#elif defined IA64 || defined X86_64 || defined ALPHA || defined 
>> LINUX_MIPSN64
>> -(long long int) tcp->u_arg[1], (long long int) 
>> tcp->u_arg[2]);
>> -printxval(advise, tcp->u_arg[3], "POSIX_FADV_???");
>> -#elif defined ARM || defined POWERPC
>> -LONG_LONG(tcp->u_arg[2], tcp->u_arg[3]),
>> -LONG_LONG(tcp->u_arg[4], tcp->u_arg[5]));
>> +int argn;
>> +tprintf("%ld, ", tcp->u_arg[0]);
>> +argn = printllval(tcp, "%lld, ", 1);
>> +argn = printllval(tcp, "%lld, ", argn);
>> +#if defined ARM || defined POWERPC
>>  printxval(advise, tcp->u_arg[1], "POSIX_FADV_???");
>>  #else
>> -LONG_LONG(tcp->u_arg[1], tcp->u_arg[2]),
>> -LONG_LONG(tcp->u_arg[3], tcp->u_arg[4]));
>> -printxval(advise, tcp->u_arg[5], "POSIX_FADV_???");
>> +printxval(advise, tcp->u_arg[argn], "POSIX_FADV_???");
>>  #endif
>>  }
>>  return 0;
>
> I'm afraid that this change breaks ARM because printxval() does no
> special handling for ARM.

I guess you mean printllval?  Yes, that breaks ARM.

Andreas.

-- 
Andreas Schwab, sch...@redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84  5EC7 45C6 250E 6F00 984E
"And now for something completely different."

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


[PATCH] Factor out printing of 64bit syscall argument

2009-11-04 Thread Andreas Schwab
This patch refactors the printing of 64bit syscall arguments.  It has
been tested on x86/x86-64/ppc/ppc64, and should also improve the
situation on mips.

The second patch just adds the decoding of fallocate to the ppc strace.

Andreas.

>From 64c4335fc86e42a6e33819fa763d845017f1ad16 Mon Sep 17 00:00:00 2001
From: Andreas Schwab 
Date: Wed, 4 Nov 2009 12:26:17 +0100
Subject: [PATCH 1/2] Factor out printing of 64bit syscall argument

* defs.h (ALIGN64): Remove.
(printllval): Declare.
* util.c (printllval): Define.
* file.c (sys_readahead): Use printllval.
(sys_truncate64): Likewise.
(sys_ftruncate64): Likewise.
(sys_fadvise64): Likewise.
(sys_fadvise64_64): Likewise.
(sys_fallocate): Likewise.
* io.c (sys_pread): Likewise.
(sys_pwrite): Likewise.
(sys_pread64): Likewise.
(sys_pwrite64): Likewise.
* mem.c (sys_mmap64): Likewise.
---
 defs.h |   16 +-
 file.c |   65 ---
 io.c   |   28 +++---
 mem.c  |3 +-
 util.c |   36 +++
 5 files changed, 68 insertions(+), 80 deletions(-)

diff --git a/defs.h b/defs.h
index 5bcaa07..dc0d91f 100644
--- a/defs.h
+++ b/defs.h
@@ -651,20 +651,6 @@ extern const char *const signalent2[];
 extern const int nsignals2;
 #endif /* SUPPORTED_PERSONALITIES >= 3 */
 
-#if defined(FREEBSD) || (defined(LINUX) \
-&& defined(POWERPC) && !defined(__powerpc64__)) \
-  || defined (LINUX_MIPSO32)
-/* ARRGH!  off_t args are aligned on 64 bit boundaries! */
-#define ALIGN64(tcp,arg)   \
-do {   \
-   if (arg % 2)\
-   memmove (&tcp->u_arg[arg], &tcp->u_arg[arg + 1],\
-(tcp->u_nargs - arg - 1) * sizeof tcp->u_arg[0]);  \
-} while (0)
-#else
-#define ALIGN64(tcp,arg) do { } while (0)
-#endif
-
 #if HAVE_LONG_LONG
 
 /* _l refers to the lower numbered u_arg,
@@ -678,6 +664,8 @@ do {
\
 #define LONG_LONG(_l,_h) \
 ((long long)((unsigned long long)(unsigned)(_h) | ((unsigned long 
long)(_l)<<32)))
 #endif
+
+extern int printllval(struct tcb *, const char *, int);
 #endif
 
 #ifdef IA64
diff --git a/file.c b/file.c
index 2e46284..dcdf4a9 100644
--- a/file.c
+++ b/file.c
@@ -610,16 +610,10 @@ int
 sys_readahead(struct tcb *tcp)
 {
if (entering(tcp)) {
-   ALIGN64 (tcp, 1);
-   tprintf("%ld, %lld, %ld", tcp->u_arg[0],
-# if defined LINUX_MIPSN32
-   tcp->ext_arg[1], tcp->u_arg[2]
-# elif defined IA64 || defined X86_64 || defined ALPHA || defined 
LINUX_MIPSN64 || (defined POWERPC && defined __powerpc64__)
-   (long long int) tcp->u_arg[1], tcp->u_arg[2]
-# else
-   LONG_LONG(tcp->u_arg[1], tcp->u_arg[2]), tcp->u_arg[3]
-# endif
-   );
+   int argn;
+   tprintf("%ld, ", tcp->u_arg[0]);
+   argn = printllval(tcp, "%lld", 1);
+   tprintf(", %ld", tcp->u_arg[argn]);
}
return 0;
 }
@@ -631,7 +625,6 @@ sys_lseek64(struct tcb *tcp)
 {
if (entering(tcp)) {
long long offset;
-   ALIGN64 (tcp, 1);   /* FreeBSD aligns off_t args */
offset = LONG_LONG(tcp->u_arg [1], tcp->u_arg[2]);
if (tcp->u_arg[3] == SEEK_SET)
tprintf("%ld, %llu, ", tcp->u_arg[0], offset);
@@ -660,9 +653,8 @@ int
 sys_truncate64(struct tcb *tcp)
 {
if (entering(tcp)) {
-   ALIGN64 (tcp, 1);
printpath(tcp, tcp->u_arg[0]);
-   tprintf(", %llu", LONG_LONG(tcp->u_arg[1],tcp->u_arg[2]));
+   printllval(tcp, ", %llu", 1);
}
return 0;
 }
@@ -684,9 +676,8 @@ int
 sys_ftruncate64(struct tcb *tcp)
 {
if (entering(tcp)) {
-   ALIGN64 (tcp, 1);
-   tprintf("%ld, %llu", tcp->u_arg[0],
-   LONG_LONG(tcp->u_arg[1] ,tcp->u_arg[2]));
+   tprintf("%ld, ", tcp->u_arg[0]);
+   printllval(tcp, "%llu", 1);
}
return 0;
 }
@@ -2816,16 +2807,11 @@ int
 sys_fadvise64(struct tcb *tcp)
 {
if (entering(tcp)) {
-   ALIGN64(tcp, 1);
-   tprintf("%ld, %lld, %ld, ",
-   tcp->u_arg[0],
-# if defined IA64 || defined X86_64 || defined ALPHA || (defined POWERPC && 
defined __powerpc64__)
-   (long long int) tcp->u_arg[1], tcp->u_arg[2]);
-   printxval(advise, tcp->u_arg[3], "POSIX_FADV_???");

Re: [PATCH] Correct decoding of readahead on powerpc32

2009-11-03 Thread Andreas Schwab
"Dmitry V. Levin"  writes:

> On Tue, Nov 03, 2009 at 01:56:46PM +0100, Andreas Schwab wrote:
>> * linux/powerpc/syscallent.h (sys_readahead): Account for 64bit
>> alignment on powerpc32.
>> * file.c (sys_readahead): Align 64bit arg.
>
> Looks OK.  By the way, do sys_fadvise64() and sys_fadvise64_64() need the
> same fix?

Good catch.  Also, PowerPC64 needs the same treatment as the other 64bit
architectures.

Andreas.

>From 5ece400d716bf1741b97c32128391e3d65d2d6b6 Mon Sep 17 00:00:00 2001
From: Andreas Schwab 
Date: Tue, 3 Nov 2009 15:21:14 +0100
Subject: [PATCH] Correct decoding of readahead and fadvice64(_64) on PowerPC

* file.c (sys_readahead): Align 64bit argument.  Handle PowerPC64
like other 64bit architectures.
(sys_fadvise64): Likewise.
(sys_fadvise64_64): Handle PowerPC like ARM.
* linux/powerpc/syscallent.h (sys_readahead): Account for 64bit
argument alignment on PowerPC32.
---
 file.c |8 +---
 linux/powerpc/syscallent.h |2 +-
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/file.c b/file.c
index 2197cdc..2e46284 100644
--- a/file.c
+++ b/file.c
@@ -610,10 +610,11 @@ int
 sys_readahead(struct tcb *tcp)
 {
if (entering(tcp)) {
+   ALIGN64 (tcp, 1);
tprintf("%ld, %lld, %ld", tcp->u_arg[0],
 # if defined LINUX_MIPSN32
tcp->ext_arg[1], tcp->u_arg[2]
-# elif defined IA64 || defined X86_64 || defined ALPHA || defined LINUX_MIPSN64
+# elif defined IA64 || defined X86_64 || defined ALPHA || defined 
LINUX_MIPSN64 || (defined POWERPC && defined __powerpc64__)
(long long int) tcp->u_arg[1], tcp->u_arg[2]
 # else
LONG_LONG(tcp->u_arg[1], tcp->u_arg[2]), tcp->u_arg[3]
@@ -2815,9 +2816,10 @@ int
 sys_fadvise64(struct tcb *tcp)
 {
if (entering(tcp)) {
+   ALIGN64(tcp, 1);
tprintf("%ld, %lld, %ld, ",
tcp->u_arg[0],
-# if defined IA64 || defined X86_64 || defined ALPHA
+# if defined IA64 || defined X86_64 || defined ALPHA || (defined POWERPC && 
defined __powerpc64__)
(long long int) tcp->u_arg[1], tcp->u_arg[2]);
printxval(advise, tcp->u_arg[3], "POSIX_FADV_???");
 #else
@@ -2842,7 +2844,7 @@ sys_fadvise64_64(struct tcb *tcp)
 #elif defined IA64 || defined X86_64 || defined ALPHA || defined LINUX_MIPSN64
(long long int) tcp->u_arg[1], (long long int) 
tcp->u_arg[2]);
printxval(advise, tcp->u_arg[3], "POSIX_FADV_???");
-#elif defined ARM
+#elif defined ARM || defined POWERPC
LONG_LONG(tcp->u_arg[2], tcp->u_arg[3]),
LONG_LONG(tcp->u_arg[4], tcp->u_arg[5]));
printxval(advise, tcp->u_arg[1], "POSIX_FADV_???");
diff --git a/linux/powerpc/syscallent.h b/linux/powerpc/syscallent.h
index 116edc8..ecf7245 100644
--- a/linux/powerpc/syscallent.h
+++ b/linux/powerpc/syscallent.h
@@ -219,7 +219,7 @@
{ 5,0,  sys_putpmsg,"putpmsg"   }, /* 
188 */
{ 0,TP, sys_vfork,  "vfork" }, /* 
189 */
{ 2,0,  sys_getrlimit,  "getrlimit" }, /* 
190 */
-   { 4,TD, sys_readahead,  "readahead" }, /* 
190 */
+   { 5,TD, sys_readahead,  "readahead" }, /* 
190 */
{ 6,0,  sys_mmap,   "mmap2"     }, /* 
192 */
{ 4,TF, sys_truncate64, "truncate64"}, /* 
193 */
{ 4,TD, sys_ftruncate64,"ftruncate64"   }, /* 
194 */
-- 
1.6.5.1


-- 
Andreas Schwab, sch...@redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84  5EC7 45C6 250E 6F00 984E
"And now for something completely different."

--
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
___
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel


  1   2   >