(Please copy dw...@janestreet.com on reply, as I am not subscribed to the list.)
I'd like to strace a multi-threaded program which calls fcntl sometimes, but the combination of threads and fcntl causes strace to segfault. Here's a small reproduction: cd /tmp cat > foo.c <<'EOF' #include <fcntl.h> #include <unistd.h> #include <pthread.h> void * thread_start(void * unused) { sleep(1); } int main (int argc, char **argv) { pthread_t thread; /* ordering of these two lines does not matter */ fcntl(1, F_GETFD, 0); pthread_create(&thread, NULL, thread_start, NULL); return 0; } EOF gcc -l pthread foo.c strace -f -c ./a.out Looks like omitting any one of -f, or -c, or the pthread_create, or the fcntl is enough to avoid the segfault, but unfortunately I need all four of them. What's going wrong? Is there any workaround? If not, is this something you would fix? (No urgency on my end, but I think this is a reasonable thing to support eventually.) Thanks for writing strace. Wang Random system info, not sure what would be helpful to you: $ strace -V strace -- version 4.5.19 $ uname -a Linux tot-qws-u12112a 2.6.32-431.1.2.0.1.el6.x86_64 #1 SMP Fri Dec 13 13:06:13 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux $ rpm -q --whatprovides /usr/lib64/libpthread.so glibc-devel-2.12-1.132.el6.x86_64 $ rpm -q --whatprovides /usr/include/fcntl.h glibc-headers-2.12-1.132.el6.x86_64 ------------------------------------------------------------------------------ Want fast and easy access to all the code in your enterprise? Index and search up to 200,000 lines of code with a free copy of Black Duck Code Sight - the same software that powers the world's largest code search on Ohloh, the Black Duck Open Hub! Try it now. http://p.sf.net/sfu/bds _______________________________________________ Strace-devel mailing list Strace-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/strace-devel