From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26836 invoked by alias); 5 Oct 2005 20:10:59 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 26803 invoked by uid 22791); 5 Oct 2005 20:10:51 -0000 Received: from zproxy.gmail.com (HELO zproxy.gmail.com) (64.233.162.205) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Wed, 05 Oct 2005 20:10:51 +0000 Received: by zproxy.gmail.com with SMTP id m7so331087nzf for ; Wed, 05 Oct 2005 13:10:47 -0700 (PDT) Received: by 10.36.48.12 with SMTP id v12mr974855nzv; Wed, 05 Oct 2005 13:10:47 -0700 (PDT) Received: by 10.36.103.3 with HTTP; Wed, 5 Oct 2005 13:10:47 -0700 (PDT) Message-ID: <4ebb21ed0510051310r200db910l734b6f170c3b6925@mail.gmail.com> Date: Wed, 05 Oct 2005 20:10:00 -0000 From: daniel he Reply-To: daniel he To: gdb-patches@sources.redhat.com Subject: SIGTRAP, SIGILL/SIGSEGV reported in cross debugging Cc: drow@false.org MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-SW-Source: 2005-10/txt/msg00044.txt.bz2 Hi, While cross-debugging , I found the cross-gdb reported SIGTRAP, SIGILL or SIGSEGV if I set the breakpoint at the thread function. I did preliminary investiagtion and provided two compact test cases to reproduce this bug. I think this bug should be reported here. I have tested both cases. This bug seems to be x86 specific. 1) The difference between test01.c and test02.c is "func" with or without "printf". 2) Both test cases work well for native GDB on Intel, AMD, PPC. 3) Both test cases reproduced the bug for cross GDB on Intel and AMD=20 with single CPU or SMP. test01.c reported SIGTRAP/SIGILL; test02.c reproted SIGRAP/SIGSEGV 4) Both work fine for PowerPC native or cross GDB 5) The bug can be reproduced for Host/Target with Linux kernel 2.4.* and 2.6.*, whether Bebian or RedHat. To simplify the description, I provide the test log on the same machine with GDB/GDBSERVER. Any idea? Daniel Suyou He =3D=3D=3D=3D=3D=3D=3D=3D=3D TEST CASE 01 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D $ cat test01.c #include #include void* func(void *unused) { while (1); } /* The main program. */ int main() { pthread_t thread_id; pthread_create (&thread_id, NULL, func, NULL); while (1); return 0; } $ gcc -g test01.c -o test01 -lpthread >>>> GDB $ gdb test01 GNU gdb 6.3-debian Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain condition= s. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-linux"...Using host libthread_db library "/lib/tls/libthread_db.so.1". (gdb) b main Breakpoint 1 at 0x80483ea: file test01.c, line 14. (gdb) b func Breakpoint 2 at 0x80483d8: file test01.c, line 6. (gdb) target remote ce2.engr.sjsu.edu:8888 Remote debugging using ce2.engr.sjsu.edu:8888 0x40000c20 in ?? () (gdb) c Continuing. [New Thread 1075226144] [Switching to Thread 1075226144] Breakpoint 1, main () at test01.c:14 14 pthread_create (&thread_id, NULL, func, NULL); (gdb) n 15 while (1); (gdb) n [New Thread 1083616176] Program received signal SIGTRAP, Trace/breakpoint trap. [Switching to Thread 1083616176] 0x080483d9 in func (unused=3D0x0) at test01.c:6 6 while (1); (gdb) n Program received signal SIGILL, Illegal instruction. 0x080483d9 in func (unused=3D0x0) at test01.c:6 6 while (1); (gdb) >>>> GDBSERVER $ gdbserver :8888 test01 Process test01 created; pid =3D 6314 Listening on port 8888 Remote debugging from host 130.65.178.11 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D TEST CASE 02 =3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D $ cat test02.c #include #include void* func(void *unused) { printf("hello"); while (1); } /* The main program. */ int main() { pthread_t thread_id; pthread_create (&thread_id, NULL, func, NULL); while (1); return 0; } $ gcc -g test01.c -o test01 -lpthread >>>>GDB $ gdb test02 GNU gdb 6.3-debian Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain condition= s. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-linux"...Using host libthread_db library "/lib/tls/libthread_db.so.1". (gdb) b main Breakpoint 1 at 0x8048428: file test02.c, line 15. (gdb) b func Breakpoint 2 at 0x804840a: file test02.c, line 6. (gdb) target remote ce2.engr.sjsu.edu:8888 Remote debugging using ce2.engr.sjsu.edu:8888 0x40000c20 in ?? () (gdb) c Continuing. [New Thread 1075226144] [Switching to Thread 1075226144] Breakpoint 1, main () at test02.c:15 15 pthread_create (&thread_id, NULL, func, NULL); (gdb) n 16 while (1); (gdb) n [New Thread 1083616176] Program received signal SIGTRAP, Trace/breakpoint trap. [Switching to Thread 1083616176] 0x0804840b in func (unused=3D0x0) at test02.c:6 6 printf("hello"); (gdb) n Program received signal SIGSEGV, Segmentation fault. 0x0804840d in func (unused=3D0x0) at test02.c:6 6 printf("hello"); (gdb) >>>>GDBSERVER $ gdbserver :8888 test02 Process test02 created; pid =3D 6322 Listening on port 8888 Remote debugging from host 130.65.178.11 >>>> Here is the information of the machine on which I produced the bug. But the bug reported here should have nothing to do with the machine. $ cat /proc/cpuinfo processor : 0 vendor_id : GenuineIntel cpu family : 15 model : 4 model name : Intel(R) Pentium(R) 4 CPU 2.80GHz stepping : 1 cpu MHz : 2793.338 cache size : 1024 KB physical id : 0 siblings : 2 fdiv_bug : no hlt_bug : no f00f_bug : no coma_bug : no fpu : yes fpu_exception : yes cpuid level : 3 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe pni monitor ds_cpl cid bogomips : 5537.79 processor : 1 vendor_id : GenuineIntel cpu family : 15 model : 4 model name : Intel(R) Pentium(R) 4 CPU 2.80GHz stepping : 1 cpu MHz : 2793.338 cache size : 1024 KB physical id : 0 siblings : 2 fdiv_bug : no hlt_bug : no f00f_bug : no coma_bug : no fpu : yes fpu_exception : yes cpuid level : 3 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe pni monitor ds_cpl cid bogomips : 5586.94 $ cat /proc/version Linux version 2.6.8-2-686-smp (horms@tabatha.lab.ultramonkey.org) (gcc version 3.3.5 (Debian 1:3.3.5-12)) #1 SMP Thu May 19 17:27:55 JST 2005 $ gcc -v Reading specs from /usr/lib/gcc-lib/i486-linux/3.3.5/specs Configured with: ../src/configure -v --enable-languages=3Dc,c++,java,f77,pascal,objc,ada,treelang --prefix=3D/usr --mandir=3D/usr/share/man --infodir=3D/usr/share/info --with-gxx-include-dir=3D/usr/include/c++/3.3 --enable-shared --enable-__cxa_atexit --with-system-zlib --enable-nls --without-included-gettext --enable-clocale=3Dgnu --enable-debug --enable-java-gc=3Dboehm --enable-java-awt=3Dxlib --enable-objc-gc i486-linux Thread model: posix gcc version 3.3.5 (Debian 1:3.3.5-13)