From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21230 invoked by alias); 26 Apr 2005 11:53:33 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 20784 invoked from network); 26 Apr 2005 11:53:10 -0000 Received: from unknown (HELO david.siemens.de) (192.35.17.14) by sourceware.org with SMTP; 26 Apr 2005 11:53:10 -0000 Received: from mail2.siemens.de (mail2.siemens.de [139.25.208.11]) by david.siemens.de (8.12.6/8.12.6) with ESMTP id j3QBr7HY030329 for ; Tue, 26 Apr 2005 13:53:07 +0200 Received: from [139.25.109.72] ([139.25.109.72]) by mail2.siemens.de (8.12.6/8.12.6) with ESMTP id j3QBr76J031017 for ; Tue, 26 Apr 2005 13:53:07 +0200 Message-ID: <426E2C4F.2090500@siemens.com> Date: Tue, 26 Apr 2005 13:21:00 -0000 From: Marion Deveaud User-Agent: Debian Thunderbird 1.0.2 (X11/20050331) MIME-Version: 1.0 To: gdb@sources.redhat.com Subject: Threads variable relocation on x86_64 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-SW-Source: 2005-04/txt/msg00192.txt.bz2 Dear GDB users, I'm trying to debug a multithreaded programm on x86_64 platform and have the following problem: wenn trying to switch between threads, it looks like variable relocation is broken. This only appens when I use some optimization (O1, O2, O3, Os) to build my test programm and the behavior isn't always reproductible within GDB. However when debugging the same program using DDD and switching between threads, DDD hangs every time. Here some infos: ---------------- opteron:~ # uname -a Linux opteron 2.6.5-7.97-smp #4 SMP Tue Mar 15 13:41:12 CET 2005 x86_64 x86_64 x86_64 GNU/Linux opteron:~ # gcc -v Reading specs from /usr/lib64/gcc-lib/x86_64-suse-linux/3.3.3/specs Configured with: ../configure --enable-threads=posix --prefix=/usr --with-local-prefix=/usr/local --infodir=/usr/share/info --mandir=/usr/share/man --enable-languages=c,c++,f77,objc,java,ada --disable-checking --libdir=/usr/lib64 --enable-libgcj --with-gxx-include-dir=/usr/include/g++ --with-slibdir=/lib64 --with-system-zlib --enable-shared --enable-__cxa_atexit x86_64-suse-linux Thread model: posix gcc version 3.3.3 (SuSE Linux) opteron:~ # gdb -v GNU gdb 6.3 ... This GDB was configured as "x86_64-unknown-linux-gnu". My test program: ---------------- #include #include #include void* MyThreadFunc1(void *arg); int main(){ pthread_t aThread1; pthread_t aThread2; pthread_create(&aThread1, NULL, MyThreadFunc1, NULL); pthread_create(&aThread2, NULL, MyThreadFunc1, NULL); pthread_join(aThread1, NULL); pthread_join(aThread2, NULL); printf("Exiting main\n"); return 0; } void* MyThreadFunc1(void* arg){ printf("Hello World from inside thread1!\n"); while(1); return NULL; } Compilation command: -------------------- gcc -g -Os -o hello_world hello_world.c -lpthread >From GDB: --------- (gdb) file hello_world Reading symbols from /root/hello_world...done. Using host libthread_db library "/lib64/tls/libthread_db.so.1". (gdb) break 13 Breakpoint 1 at 0x40061f: file hello_world.c, line 13. (gdb) run Starting program: /root/hello_world [Thread debugging using libthread_db enabled] [New Thread 182898536608 (LWP 5597)] [New Thread 1075837280 (LWP 5600)] Hello World from inside thread1! [New Thread 1077934432 (LWP 5601)] Hello World from inside thread1! [Switching to Thread 182898536608 (LWP 5597)] Breakpoint 1, main () at hello_world.c:13 13 pthread_join(aThread1, NULL); (gdb) thread 2 [Switching to thread 2 (Thread 1075837280 (LWP 5600))]#0 MyThreadFunc1 (arg=Variable "arg" is not available. ) at hello_world.c:22 22 while(1); Did someone already face similar problem ? The major issue comes when using DDD and switching between threads. Should I use different compiler options ? I tried dwarf2 related flags, no success. The same tests are running well on a I32 platform. Thanks in advance for any hints you could give me. Best regards, Marion