From: Marion Deveaud <marion.deveaud@siemens.com>
To: gdb@sources.redhat.com
Subject: Threads variable relocation on x86_64
Date: Tue, 26 Apr 2005 13:21:00 -0000 [thread overview]
Message-ID: <426E2C4F.2090500@siemens.com> (raw)
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
next reply other threads:[~2005-04-26 11:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-26 13:21 Marion Deveaud [this message]
2005-04-26 13:50 ` Daniel Jacobowitz
2005-04-26 16:54 ` Marion Deveaud
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=426E2C4F.2090500@siemens.com \
--to=marion.deveaud@siemens.com \
--cc=gdb@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox