---Problem Description--- Gdb cant singlestep over pthread function ---uname output--- Linux devel 2.6.18-8.1.1.el5 #1 SMP Mon Feb 26 20:42:34 EST 2007 ppc64 ppc64 ppc64 GNU/Linux ---Steps to Reproduce--- [root@devel gdb]# cat test.c #include <stdio.h> #include <stdlib.h> #include <pthread.h> void *tf( void *ptr ) { char *ptr1; ptr1 = (char *) ptr; printf("%s \\n", ptr1); } main() { pthread_t thread; char *ptr = "Thread"; int iret; iret = pthread_create( &thread, NULL, tf, (void*)ptr); pthread_join( thread, NULL); printf("Thread returns: %d\\n",iret); exit(0); } === 32bit === [root@devel gdb]# gcc -g -o test.32 test.c -lpthread [root@devel gdb]# gdb -q test.32 Using host libthread_db library "/lib64/libthread_db.so.1". (gdb) b main Breakpoint 1 at 0x100005ac: file test.c, line 15. (gdb) b tf Breakpoint 2 at 0x10000564: file test.c, line 8. (gdb) r Starting program: /home/public/test-tools/gdb/test.32 [Thread debugging using libthread_db enabled] [New Thread 268377056 (LWP 32324)] [Switching to Thread 268377056 (LWP 32324)] Breakpoint 1, main () at test.c:15 15 char *ptr = "Thread"; (gdb) n 18 iret = pthread_create( &thread, NULL, tf, (void*)ptr); (gdb) n [New Thread 4160681152 (LWP 32327)] 20 pthread_join( thread, NULL); (gdb) n [Switching to Thread 4160681152 (LWP 32327)] Breakpoint 2, tf (ptr=0x10000a68) at test.c:8 8 ptr1 = (char *) ptr; (gdb) n 9 printf("%s \\n", ptr1); (gdb) n Thread 10 } (gdb) n 0x0fcf66d4 in start_thread () from /lib/libpthread.so.0 (gdb) n Single stepping until exit from function start_thread, which has no line number information. 0x0fd02860 in call___do_global_ctors_aux () from /lib/libpthread.so.0 (gdb) n Single stepping until exit from function call___do_global_ctors_aux, which has no line number information. 0x0ffd4e1c in _dl_runtime_resolve () from /lib/ld.so.1 (gdb) n Single stepping until exit from function _dl_runtime_resolve, which has no line number information. 0x0ff7b5a0 in __libc_thread_freeres () from /lib/libc.so.6 (gdb) n Single stepping until exit from function __libc_thread_freeres, which has no line number information. 0x0fcf66e0 in start_thread () from /lib/libpthread.so.0 (gdb) n Single stepping until exit from function start_thread, which has no line number information. ----------> hangs here === 64bit === [root@devel gdb]# gcc -g -m64 -o test.64 test.c -lpthread [root@devel gdb]# gdb -q test.64 Using host libthread_db library "/lib64/libthread_db.so.1". (gdb) b main Breakpoint 1 at 0x100006e8: file test.c, line 15. (gdb) b tf Breakpoint 2 at 0x1000069c: file test.c, line 8. (gdb) r Starting program: /home/public/test-tools/gdb/test.64 [Thread debugging using libthread_db enabled] [New Thread 553248246304 (LWP 32351)] [Switching to Thread 553248246304 (LWP 32351)] Breakpoint 1, main () at test.c:15 15 char *ptr = "Thread"; (gdb) n 18 iret = pthread_create( &thread, NULL, tf, (void*)ptr); (gdb) n [New Thread 4398057189936 (LWP 32356)] 20 pthread_join( thread, NULL); (gdb) n [Switching to Thread 4398057189936 (LWP 32356)] Breakpoint 2, tf (ptr=0x10000958) at test.c:8 8 ptr1 = (char *) ptr; (gdb) n 9 printf("%s \\n", ptr1); (gdb) n Thread 10 } (gdb) n 0x00000080d057b808 in .start_thread () from /lib64/libpthread.so.0 (gdb) n Single stepping until exit from function .start_thread, which has no line number information. ----------> hangs here ---GDB - Power Component Data--- Userspace tool common name: gdb The userspace tool has the following bit modes: both 32 and 64-bit modes Userspace rpm: gdb-6.5-16.el5 -- Additional comment on 2007-04-04 08:32 EST -- Sending up... This is reproducible. If a box on which this can be reproduced is required, I can provide the details.
Fix of the implementation + testcase posted upstream: http://sources.redhat.com/ml/gdb-patches/2007-04/msg00374.html This version would be applicable to Rawhide.
Committed to Rawhide CVS: * Thu Jun 21 2007 Jan Kratochvil <jan.kratochvil> - 6.6-17 - Support for stepping over PPC atomic instruction sequences (BZ 237572). - `set scheduler-locking step' is no longer enforced but it is now default.
Reopened, some cases were unreliable.
CVS-Rawhide-committed fix of the fix: * Tue Jun 26 2007 Jan Kratochvil <jan.kratochvil> - 6.6-18 - Fix PPC software watchpoints active while stepping atomic instr. (BZ 237572).
Posted upstream: http://sources.redhat.com/ml/gdb-patches/2007-06/msg00455.html