Unix Programming - Getting real instruction pointer in pthreads?

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > January 2004 > Getting real instruction pointer in pthreads?





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]

Author Getting real instruction pointer in pthreads?
David Frascone

2004-01-23, 5:22 pm

I'm currently trying to track down some memory corruption in a heavily
multi-threaded application. So, when a corruption occurs, I'd like to
take a snapshot of all threads, to see what they're doing.

I've looked at proc(5), and at kstkeip, but it's value is outside of
the range [startcode-endcode], and outside of my program's address
space. I'm assuming I'm having some virtual-vs-physical memory
address problems.

So, perhaps I'm approaching this incorrectly. Is there a way for one
thread to spin through the other threads and grab current instruction
pointers?

And, would it also be possible to grab stack pointers *and* walk the
stacks of the other threads?

Or, am I stuck with having to signal each thread to dump it's own
pointers/stack?

Please respond by e-mail,


-Dave
=?iso-8859-1?q?M=E5ns_Rullg=E5rd?=

2004-01-23, 5:22 pm

chaos@mindspring.com (David Frascone) writes:
quote:

> I'm currently trying to track down some memory corruption in a heavily
> multi-threaded application. So, when a corruption occurs, I'd like to
> take a snapshot of all threads, to see what they're doing.



valgrind is usually helpful with finding that sort of bugs.
quote:

> I've looked at proc(5), and at kstkeip, but it's value is outside of
> the range [startcode-endcode], and outside of my program's address
> space. I'm assuming I'm having some virtual-vs-physical memory
> address problems.
>
> So, perhaps I'm approaching this incorrectly. Is there a way for one
> thread to spin through the other threads and grab current instruction
> pointers?
>
> And, would it also be possible to grab stack pointers *and* walk the
> stacks of the other threads?
>
> Or, am I stuck with having to signal each thread to dump it's own
> pointers/stack?



GDB can do all that for you. Run "gdb program pid-of-program" to
attach to a running instance of the program.

--
Måns Rullgård
mru@kth.se
David Frascone

2004-01-23, 5:22 pm

mru@kth.se (Måns Rullgård) wrote in message news:<yw1xptduh5t5.fsf@kth.se>...
quote:

> chaos@mindspring.com (David Frascone) writes:
>
>
> valgrind is usually helpful with finding that sort of bugs.



Sorry, forgot to mention: the architecture is PPC.
quote:

>
> GDB can do all that for you. Run "gdb program pid-of-program" to
> attach to a running instance of the program.



I need this for a crash file, for post-mortem debugging.

-Dave
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com