|
Home > Archive > Unix Programming > November 2004 > threads and gdb
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| Kemal Oral CANSIZLAR 2004-11-14, 7:46 am |
| Hi all,
I am having the following error in gdb version 4.16 on Solaris 5.9, and when
I "continue" the gdb hangs,
preventing me to debug my code... I have searched through the net, however
found that this "might be" because of earlier versions of gdb lacking
multithreading support. Is there any way to fix this, or the "only" way is
to upgrade the gdb?
The gdb is not able to "handle" signals that is unknown to it, so it just
hangs, and I couldnot find any way to explicitly ignore the signal (e.g. by
"handle x noprint"), because it does not have any numeric value to
reference!
The error is:
Program received signal ?, Unknown signal.
0xff01d9c4 in _poll ()
(gdb) backtrace
#0 0xff01d9c4 in _poll ()
#1 0xfefd2238 in _select ()
#2 0xfef1e6b0 in select ()
I would appreciate if you have any workaround, if any.
Thank you very much,
-Kemal.
| |
| Måns Rullgård 2004-11-14, 7:46 am |
| "Kemal Oral CANSIZLAR" <ocansizlar@comcast.net> writes:
> Hi all,
>
> I am having the following error in gdb version 4.16
Get version 6.2.1, or whatever is the latest, and ask again if you
still have problems.
--
Måns Rullgård
mru@inprovide.com
| |
| Kemal Oral CANSIZLAR 2004-11-14, 5:56 pm |
| Hi Mans,
Thank you for the reply. Actually I was asking a workaround wothout updating
the gdb, however I later on discovered that the machine provided indeed had
gdb 6.0. However the problem is worse. Now even if I comment out *all* the
code from my main() method, the gdb fails to execute the code, it quits to
the shell with "Bus Error" - it does not execute at all!
All I get is:
(gdb) run
Starting program: /.../<executable>
Bus error
%_
Is this a bug with gdb? I also wrote a "Hello World" application. Only then
gdb executes the code without bailing out! Can there a problem with
libraries I am linking? I have also tried with gdb 4.18, it runs the code
successfully unlike 6.0, however I receive the same signalling error
(Unknown Signal ?) as before...
The command I am using:
gcc -o sv -g -I/usr/lsd/openssl/0.9.7c/include -D_REENTRANT \
<obj
files> -L/usr/lsd/openssl/0.9.7c/lib -lpthread -lposix4 -lsocket -lnsl -lm -lcrypto
Thank you,
-Kemal.
"Måns Rullgård" <mru@inprovide.com> wrote in message
news:yw1xsm7citdn.fsf@ford.inprovide.com...
> "Kemal Oral CANSIZLAR" <ocansizlar@comcast.net> writes:
>
>
> Get version 6.2.1, or whatever is the latest, and ask again if you
> still have problems.
>
> --
> Måns Rullgård
> mru@inprovide.com
| |
| Måns Rullgård 2004-11-14, 5:56 pm |
| "Kemal Oral CANSIZLAR" <ocansizlar@comcast.net> writes:
> Hi Mans,
>
> Thank you for the reply. Actually I was asking a workaround wothout
> updating the gdb, however I later on discovered that the machine
> provided indeed had gdb 6.0. However the problem is worse. Now even
> if I comment out *all* the code from my main() method, the gdb fails
> to execute the code, it quits to the shell with "Bus Error" - it
> does not execute at all!
>
> All I get is:
>
> (gdb) run
> Starting program: /.../<executable>
> Bus error
> %_
>
> Is this a bug with gdb? I also wrote a "Hello World" application. Only then
> gdb executes the code without bailing out! Can there a problem with
> libraries I am linking?
The "Bus error" (on SPARC) usually means there was an unaligned
access. Your quote looks like gdb dies with this message, suggesting
that there is indeed a bug in gdb, or it has been compiled
incorrectly.
> I have also tried with gdb 4.18, it runs the code
> successfully unlike 6.0, however I receive the same signalling error
> (Unknown Signal ?) as before...
That's probably because of the use of threads.
> The command I am using:
>
> gcc -o sv -g -I/usr/lsd/openssl/0.9.7c/include -D_REENTRANT \
> <obj files> -L/usr/lsd/openssl/0.9.7c/lib -lpthread -lposix4 -lsocket \
> -lnsl -lm -lcrypto
You should use "gcc -pthread ...", and not specify "-lpthread"
directly. This allows gcc to select reentrant versions of libraries,
in case this is needed (I'm not certain of the situation in Solaris),
and possibly take other actions required to use threads.
--
Måns Rullgård
mru@inprovide.com
| |
| Paul Pluzhnikov 2004-11-14, 5:56 pm |
| Måns Rullgård <mru@inprovide.com> writes:
> looks like gdb dies with this message, suggesting
> that there is indeed a bug in gdb, or it has been compiled
> incorrectly.
It may also be that there is a mismatch between /lib/libthread.so
and /lib/libthread_db.so (which gdb6 uses to "decode" libthread.so's
internal data).
Some Solaris patches update the former without updating the latter;
running 'what /lib/libthread.so /lib/libthread_db.so' will reveal
whether this is indeed the case.
> You should use "gcc -pthread ...", and not specify "-lpthread"
On Solaris (unlike Linux) 'gcc -pthread ...' results in:
gcc: unrecognized option `-pthread'
Use 'gcc -pthreads ...' instead.
Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
| |
| Måns Rullgård 2004-11-14, 5:56 pm |
| Paul Pluzhnikov <ppluzhnikov-nsp@charter.net> writes:
>
> On Solaris (unlike Linux) 'gcc -pthread ...' results in:
> gcc: unrecognized option `-pthread'
>
> Use 'gcc -pthreads ...' instead.
Thanks, I wasn't aware of that inconsistency. I thought gcc was
always the same, but apparently I was mistaken.
--
Måns Rullgård
mru@inprovide.com
| |
| Kemal Oral CANSIZLAR 2004-11-18, 2:48 am |
| Hi,
I did all what you wrote, however it is still not working... I am not able
to debug my programs, it is so frustrating, I wonder if anyone has any other
solution? At least if I were able to catch and suppress that "Unknown Signal
?" error, *everything* would be fine... It happens when I block on read or
select on some thread, and that thread receives a pthread_cancel() from
another thread...
Thank you,
-Kemal.
"Paul Pluzhnikov" <ppluzhnikov-nsp@charter.net> wrote in message
news:m33bzci5xz.fsf@salmon.parasoft.com...
> Måns Rullgård <mru@inprovide.com> writes:
>
>
> It may also be that there is a mismatch between /lib/libthread.so
> and /lib/libthread_db.so (which gdb6 uses to "decode" libthread.so's
> internal data).
>
> Some Solaris patches update the former without updating the latter;
> running 'what /lib/libthread.so /lib/libthread_db.so' will reveal
> whether this is indeed the case.
>
>
> On Solaris (unlike Linux) 'gcc -pthread ...' results in:
> gcc: unrecognized option `-pthread'
>
> Use 'gcc -pthreads ...' instead.
>
> Cheers,
> --
> In order to understand recursion you must first understand recursion.
> Remove /-nsp/ for email.
| |
| Paul Pluzhnikov 2004-11-18, 5:52 pm |
| "Kemal Oral CANSIZLAR" <ocansizlar@comcast.net> writes:
A. Because doing so makes the conversation harder to read.
Q. Why should I not top-post?
Please do not top post. Rest of the message re-ordered.
[vbcol=seagreen]
> I did all what you wrote, however it is still not working...
What exactly did you do? Rebuild with '-pthreads'? Verified that
libthread.so and libthread_db.so match? Something else?
> I am not able to debug my programs, it is so frustrating
Whining about it will not help.
Recent gdb versions *do* work with threads on other Solaris systems,
so there is something broken on yours.
If you want someone to help you identify what that is, you need to
ask smart questions: http://catb.org/%7Eesr/faqs/smart-questions.html
Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
| |
| Kemal Oral CANSIZLAR 2004-11-18, 5:52 pm |
|
"Paul Pluzhnikov" <ppluzhnikov-nsp@charter.net> wrote in message
news:m33bz7b2yt.fsf@salmon.parasoft.com...
> "Kemal Oral CANSIZLAR" <ocansizlar@comcast.net> writes:
>
> A. Because doing so makes the conversation harder to read.
> Q. Why should I not top-post?
>
> Please do not top post. Rest of the message re-ordered.
>
Thank you for the warning, I am rather new to Usenet style conversations...
>
>
> What exactly did you do? Rebuild with '-pthreads'? Verified that
> libthread.so and libthread_db.so match? Something else?
>
Yes, rebuilt with '-pthreads' and verified the versions of the libs you have
mentioned.
>
> Whining about it will not help.
>
> Recent gdb versions *do* work with threads on other Solaris systems,
> so there is something broken on yours.
>
> If you want someone to help you identify what that is, you need to
> ask smart questions: http://catb.org/%7Eesr/faqs/smart-questions.html
>
Actually, I am totally stuck, I hoped to find somebody that had experience
with the same "Unknown Signal ?" problem, and who found a workaround on how
to suppress/ignore it for earlier GDB versions - 4.16, 4.18 (I have
identified that pthread_cancel() is causing the problem - GDB cannot
identify the type of signal). I am not able to update the version of GDB,
because it is the machine school maintains, however I read GDB 6.0 do
support multi-threading, and the machine I am using indeed has it. However
in the case of my program it just breaks down and quits with a "Bus Error"
on the part of GDB itself (However a simple "Hello World" program does not
cause any problem and terminates successfully). It seems nobody else but me
who is only getting this error. I am re-posting the compiler options
(updated) I am using for other's reference:
gcc -pthreads -o sv -g -I/usr/lsd/openssl/0.9.7c/include -D_REENTRANT <obj
files> -L/usr/lsd/openssl/0.9.7c/lib -lpthread -lposix4 -lsocket -lnsl -lm -lcrypto
(I also tried to omit -lpthread and use various other options at no avail).
I am using gcc version 3.3.2.
At this point I really can't see what else to ask that could be identified
as "smart", since I even don't have a starting point, the GDB simply quits
without any information... I am just appealing to readers who might have had
the same error as I had, and I hope I am not alone in the whole planet.
Thank you very much,
-Kemal.
| |
| Paul Pluzhnikov 2004-11-18, 5:52 pm |
| "Kemal Oral CANSIZLAR" <ocansizlar@comcast.net> writes:
> At this point I really can't see what else to ask that could be identified
> as "smart", since I even don't have a starting point, the GDB simply quits
> without any information...
Ok, here is something to get you started:
- you should give up on gdb-4.16 and 4.18 -- these versions do
not work with threads, and don't read gcc-3.x debug info correctly
either.
- you should build gdb-6.3 (released just over a week ago).
Do it yourself -- you do not know whether gdb6 you already has
been properly built for your machine.
- Use the newly built gdb-6.3 on your program. If it still crashes
(which is very unlikely), post another question here, specifying
exactly what you did and what the observed results are, and
someone will tell you what to do next.
Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
|
|
|
|
|