strace fails to trace call stack of clone from pthread_create

Zhouyang Jia jiazhouyang09 at
Sat Oct 27 05:23:31 UTC 2018

Hi everyone,

I find strace fails to trace call stack of clone syscall (called by
pthread_create) in both main thread and child thread.

How to reproduce:

Get a simple pthread_create example:
Compile: gcc -pthread test_pthread.c -o test_pthread
Trace: strace -k -ff -o test_pthread ./test_pthread

In main thread:
parent_tidptr=0x7f56c52b29d0, tls=0x7f56c52b2700,
child_tidptr=0x7f56c52b29d0) = 69700
     > /lib/x86_64-linux-gnu/ [0x1073e1]

In child thread:
    set_robust_list(0x7f56c52b29e0, 24) = 0
     > /lib/x86_64-linux-gnu/ [0x7654]
     > /lib/x86_64-linux-gnu/ [0x10741d]

We can see the call stacks of both main thread and child thread start from
libc. Is there any way to get the call stack from the main function? I'm
not sure whether this is a bug or not.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Strace-devel mailing list