* Thread IDs
@ 1999-10-07 4:00 karthik
1999-10-11 4:00 ` Jeff Denham
0 siblings, 1 reply; 2+ messages in thread
From: karthik @ 1999-10-07 4:00 UTC (permalink / raw)
Hi,
I've written a C++ program which contains 5 threads. I am using g++
(version 2.95.1). When I execute the program I got 'Memory fault(core
dumped). Since gdb does not support multithreaded program debuggingI am
not able to debug it. Then I saw that in the header of the core file
there is member variable called 'tid' which denotes the 'Thread causing
fault'. This can be found in /usr/include/sys/core.h in the structure
'core_filehdr'. Then I used
pthread_getsequence_np(pthread_self())
in all my threads to print their identities. The identities printed by
this statement was always between 1 and 5 (both inclusive). But the
value in the structure member 'tid' in the header of the core file was
not consistent. It was either 11, or 9 or 3. I used 'od -x' to dump the
contents of the core file. When I tried using 'odump' I got something
like
Bad object file core
There is another member in the structure 'core_filehdr' called
'nthreads' which had the correct number of threads always. The member
'signo' (Signal) always contained 11. (must be SIGSEGV)
I need to know the following
1. Why is the value in 'tid' different from the value returned by
pthread_getsequence_np()? Is there any diff between the two?
2. Is there any way to interpret the core file and find out the
location where it dumps core. In HP-UX, I start the debugger and pass
the name of the core file as a extra parameter. It automatically reaches
the location when the core dump occured. I tried the same ploy using
dxladebug. It did a $load and stopped. Didn't proceed ahead.
Can anybody help?
Sent via Deja.com http://www.deja.com/
Before you buy.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Thread IDs
1999-10-07 4:00 Thread IDs karthik
@ 1999-10-11 4:00 ` Jeff Denham
0 siblings, 0 replies; 2+ messages in thread
From: Jeff Denham @ 1999-10-11 4:00 UTC (permalink / raw)
karthik@cdotd.ernet.in wrote:
> I need to know the following
>
> 1. Why is the value in 'tid' different from the value returned by
> pthread_getsequence_np()? Is there any diff between the two?
The 'tid' in the core file header is kernel thread ID of the faulting
thread. Those values you're getting back from getsequence are
IDs internal to the threads library. There's no connection between
the two kinds of IDs.
> 2. Is there any way to interpret the core file and find out the
> location where it dumps core. In HP-UX, I start the debugger and pass
> the name of the core file as a extra parameter. It automatically reaches
> the location when the core dump occured. I tried the same ploy using
> dxladebug. It did a $load and stopped. Didn't proceed ahead.
That's not a 'ploy' -- it's how you debug core files with gdb, ladebug,
and dbx. Both ladebug and dbx (assuming you have up-to-date versions
that are know to work with the versions of the kernel and pthreads
library that created the core file), are thread-smart to greater or
lesser extents. Dbx only really knows about kernel threads (i.e.,
that TID in the file header), but will should a good stack trace
for the faulting thread. But it won't know anything about the
other user threads in the program that we're running at the
time of the core dump.
Ladebug, on the other hand, is much smarter about those other
threads. It is fully integrated with the pthreads library can
show you stack traces for every thread in existence at the
time of the core dump.
All, that said as way of background, it's impossible to
say why ladebug isn't showing you *anything*. Was the
program built with any debug symbols enabled, say -g3
at the least? Can you runt he program "live" under ladebug?
__________________________________________________
Jeff Denham (jdenham@allaire.com)
Allaire Corp: Resource-management software
for building and managing fast, reliable web sites
See us at http://www.allaire.com and http://www.brighttiger.com
125 Nagog Park
Acton, MA 01720
Phone: (978) 263-5455 x177
Fax: (978) 263-5547
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1999-10-11 4:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1999-10-07 4:00 Thread IDs karthik
1999-10-11 4:00 ` Jeff Denham
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox