* Threads variable relocation on x86_64
@ 2005-04-26 13:21 Marion Deveaud
2005-04-26 13:50 ` Daniel Jacobowitz
0 siblings, 1 reply; 3+ messages in thread
From: Marion Deveaud @ 2005-04-26 13:21 UTC (permalink / raw)
To: gdb
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 <pthread.h>
#include <stdio.h>
#include <stdlib.h>
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
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: Threads variable relocation on x86_64
2005-04-26 13:21 Threads variable relocation on x86_64 Marion Deveaud
@ 2005-04-26 13:50 ` Daniel Jacobowitz
2005-04-26 16:54 ` Marion Deveaud
0 siblings, 1 reply; 3+ messages in thread
From: Daniel Jacobowitz @ 2005-04-26 13:50 UTC (permalink / raw)
To: Marion Deveaud; +Cc: gdb
On Tue, Apr 26, 2005 at 01:55:59PM +0200, Marion Deveaud wrote:
> (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.
This error is not related to threads. The variable isn't available, so
GDB can't display it.
CVS versions of GDB will show a more useful output.
--
Daniel Jacobowitz
CodeSourcery, LLC
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Threads variable relocation on x86_64
2005-04-26 13:50 ` Daniel Jacobowitz
@ 2005-04-26 16:54 ` Marion Deveaud
0 siblings, 0 replies; 3+ messages in thread
From: Marion Deveaud @ 2005-04-26 16:54 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: gdb
Daniel Jacobowitz wrote:
> On Tue, Apr 26, 2005 at 01:55:59PM +0200, Marion Deveaud wrote:
>
>>(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.
>
>
> This error is not related to threads. The variable isn't available, so
> GDB can't display it.
>
> CVS versions of GDB will show a more useful output.
>
Updating to CVS version helped ! Thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-04-26 13:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-26 13:21 Threads variable relocation on x86_64 Marion Deveaud
2005-04-26 13:50 ` Daniel Jacobowitz
2005-04-26 16:54 ` Marion Deveaud
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox