Can I examine the PCs stored on the call stack?

Can I examine the PCs stored on the call stack?

Post by JPE » Thu, 30 Nov 2000 04:00:00



I'm trying to write memory allocation/deallocation routine that keeps
track of where memory is allocated/freed.  Is there any way for me to
retreive the program counters that are stored on the stack?

Thanks,
John Engstrom

Sent via Deja.com http://www.deja.com/
Before you buy.

 
 
 

Can I examine the PCs stored on the call stack?

Post by Andrew Gabri » Thu, 30 Nov 2000 04:00:00




Quote:> I'm trying to write memory allocation/deallocation routine that keeps
> track of where memory is allocated/freed.  Is there any way for me to
> retreive the program counters that are stored on the stack?

man getcontext

Also, depending on exactly what you are trying to do, you might find this
useful:
         http://www.deja.com/getdoc.xp?AN=508578081&fmt=text

--
Andrew Gabriel

 
 
 

1. Examining the calling stack in C

In Solaris 2.x, a signal handler is passed a pointer to a ucontext_t(5)
structure which includes the stack of the thread where the signal was
received.  This should be sufficient to "walk" up the stack and
examine each frame to find out which functions were called.

Is there a simple way of doing this walk when we only care to know which of
N known functions of the program have been called?

--
Nicolas Rouquette                      Artificial Intelligence Group

Phone: (818) 306-6196                  4800 Oak Grove Dr.
  Fax: (818) 306-6912                  Pasadena, CA 91109

2. PERL & *.ph files under linux

3. Store signals up and Examine them later...

4. CAN'T SEE PAST THE PPP SERVER

5. Store Signals up then examine them

6. Nis Question

7. Calling TkMan connaisseurs: please examine v2.0

8. Network card

9. PC-to-phone/PC calls with LINUX??

10. SOLUTION: unix host call from java stored procedure.

11. Everything you EVER DID is STILL STORED IN YOUR PC (s74uwj)

12. Everything you EVER DID is STILL STORED IN YOUR PC - y y07 ksu17 8y gp06dqe9

13. Everything you EVER DID is STILL STORED IN YOUR PC - xs6 3s ci839 f4 172wj