[4/5] linux-user: fix clone() strace
diff mbox

Message ID 1465417472-11359-5-git-send-email-laurent@vivier.eu
State New
Headers show

Commit Message

Laurent Vivier June 8, 2016, 8:24 p.m. UTC
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 linux-user/strace.c | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

Comments

Peter Maydell June 10, 2016, 1:13 p.m. UTC | #1
On 8 June 2016 at 21:24, Laurent Vivier <laurent@vivier.eu> wrote:
> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
> ---
>  linux-user/strace.c | 25 ++++++++++++++-----------
>  1 file changed, 14 insertions(+), 11 deletions(-)

I think this change is correct, but it would be clearer to read
if we defined a do_print_clone() that did the actual printing and
took arguments in the same order as the do_fork() function in
syscall.c. Then it would be easy to compare the syscall.c and
this code to check they pass the arguments in the same order
to the function that does the work.
(Also, naming the arguments here arg1..arg6 rather than arg0..arg5
would make them match syscall.c.)

thanks
-- PMM

Patch
diff mbox

diff --git a/linux-user/strace.c b/linux-user/strace.c
index 0c3675c..ec39750 100644
--- a/linux-user/strace.c
+++ b/linux-user/strace.c
@@ -964,27 +964,30 @@  print_clone(const struct syscallname *name,
     abi_long arg3, abi_long arg4, abi_long arg5)
 {
     print_syscall_prologue(name);
-#if defined(TARGET_M68K)
+#if defined(TARGET_MICROBLAZE)
     print_flags(clone_flags, arg0, 0);
-    print_raw_param("newsp=0x" TARGET_ABI_FMT_lx, arg1, 1);
-#elif defined(TARGET_SH4) || defined(TARGET_ALPHA)
+    print_raw_param("child_stack=0x" TARGET_ABI_FMT_lx, arg1, 0);
+    print_raw_param("parent_tidptr=0x" TARGET_ABI_FMT_lx, arg3, 0);
+    print_raw_param("tls=0x" TARGET_ABI_FMT_lx, arg5, 0);
+    print_raw_param("child_tidptr=0x" TARGET_ABI_FMT_lx, arg4, 1);
+#elif defined(TARGET_CLONE_BACKWARDS)
     print_flags(clone_flags, arg0, 0);
     print_raw_param("child_stack=0x" TARGET_ABI_FMT_lx, arg1, 0);
     print_raw_param("parent_tidptr=0x" TARGET_ABI_FMT_lx, arg2, 0);
-    print_raw_param("child_tidptr=0x" TARGET_ABI_FMT_lx, arg3, 0);
-    print_raw_param("tls=0x" TARGET_ABI_FMT_lx, arg4, 1);
-#elif defined(TARGET_CRIS)
-    print_raw_param("child_stack=0x" TARGET_ABI_FMT_lx, arg0, 0);
+    print_raw_param("tls=0x" TARGET_ABI_FMT_lx, arg3, 0);
+    print_raw_param("child_tidptr=0x" TARGET_ABI_FMT_lx, arg4, 1);
+#elif defined(TARGET_CLONE_BACKWARDS2)
     print_flags(clone_flags, arg1, 0);
+    print_raw_param("child_stack=0x" TARGET_ABI_FMT_lx, arg0, 0);
     print_raw_param("parent_tidptr=0x" TARGET_ABI_FMT_lx, arg2, 0);
-    print_raw_param("tls=0x" TARGET_ABI_FMT_lx, arg3, 0);
-    print_raw_param("child_tidptr=0x" TARGET_ABI_FMT_lx, arg4, 1);
+    print_raw_param("tls=0x" TARGET_ABI_FMT_lx, arg4, 0);
+    print_raw_param("child_tidptr=0x" TARGET_ABI_FMT_lx, arg3, 1);
 #else
     print_flags(clone_flags, arg0, 0);
     print_raw_param("child_stack=0x" TARGET_ABI_FMT_lx, arg1, 0);
     print_raw_param("parent_tidptr=0x" TARGET_ABI_FMT_lx, arg2, 0);
-    print_raw_param("tls=0x" TARGET_ABI_FMT_lx, arg3, 0);
-    print_raw_param("child_tidptr=0x" TARGET_ABI_FMT_lx, arg4, 1);
+    print_raw_param("tls=0x" TARGET_ABI_FMT_lx, arg4, 0);
+    print_raw_param("child_tidptr=0x" TARGET_ABI_FMT_lx, arg3, 1);
 #endif
     print_syscall_epilogue(name);
 }