comp.lang.ada
 help / color / mirror / Atom feed
* Re: Plea for help
       [not found] <9701231552.AA07941@most>
@ 1997-01-26  0:00 ` Corey Minyard
  1997-01-27  0:00   ` Richard Kenner
  1997-01-27  0:00 ` Fergus Henderson
  1 sibling, 1 reply; 3+ messages in thread
From: Corey Minyard @ 1997-01-26  0:00 UTC (permalink / raw)



"W. Wesley Groleau (Wes)" <wwgrol@PSESERV3.FW.HAC.COM> writes:

> I'm looking for C or Ada code to give the addresses of all
> the stack frames above its call site, on SPARC/Solaris,
> Pentium/SCO Unix and/or PowerMac/MachTen.

This cannot directly be done by user code on the SPARC.  To do a
RELIABLE stack traceback on the SPARC requires interrupts to be turned
off.  It can be done without it, but it will occasionally crash.  I
wrote one of these for VxWorks on SPARC, but I could not use it on
Solaris because it would occasionally crash.  Perhaps there is a
system call to do it, but that would be the only way.

On Pentium, it is easy, just get the frame pointer and follow it back
(assuming frame pointers are not turned off.

> 
> We have Ada code on HP RISC boxes that contains a C routine--I'll shorten
> the routine name to Trace.  When called, trace generates a string of the
> form "<TRACE|xxxx|xxxx|xxxx|xxxx|xxxx|xxxxxx|...> where each xxxx is the
> address of a stack frame.  An "offline" tool uses linker and debug info
> to translate each trace into a symbolic stack dump similar to what one
> gets from a debugger.  (Thanks very much to an anonymous comp.lang.ada
> reader for the HP RISC version!)
> 

According to the HPUX documentation, you have to look at the symbol
table to determine the procedure type to get a reliable traceback, so
I gave up.  Is this on HPUX?  I'd like to see a good HPPA traceback
routine.

-- 
Corey Minyard               Internet:  minyard@acm.org
  Work: minyard@nortel.ca       UUCP:  minyard@wf-rch.cirr.com





^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Plea for help
  1997-01-26  0:00 ` Plea for help Corey Minyard
@ 1997-01-27  0:00   ` Richard Kenner
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Kenner @ 1997-01-27  0:00 UTC (permalink / raw)



In article <m2ybdgvyfz.fsf@acm.org> Corey Minyard <minyard@acm.org> writes:
>This cannot directly be done by user code on the SPARC.  To do a
>RELIABLE stack traceback on the SPARC requires interrupts to be turned
>off.  It can be done without it, but it will occasionally crash.  I
>wrote one of these for VxWorks on SPARC, but I could not use it on
>Solaris because it would occasionally crash.  Perhaps there is a
>system call to do it, but that would be the only way.

There is indeed a system call that dumps all register window information
into memory.




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Plea for help
       [not found] <9701231552.AA07941@most>
  1997-01-26  0:00 ` Plea for help Corey Minyard
@ 1997-01-27  0:00 ` Fergus Henderson
  1 sibling, 0 replies; 3+ messages in thread
From: Fergus Henderson @ 1997-01-27  0:00 UTC (permalink / raw)



"W. Wesley Groleau (Wes)" <wwgrol@PSESERV3.FW.HAC.COM> writes:

>I'm looking for C or Ada code to give the addresses of all
>the stack frames above its call site, on SPARC/Solaris,
>Pentium/SCO Unix and/or PowerMac/MachTen.

One relatively portable approach is to fork(), in the child call
abort() to dump core, and in the parent invoke a debugger on the core
file to get a stack trace.

--
Fergus Henderson <fjh@cs.mu.oz.au>   |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
PGP: finger fjh@128.250.37.3         |     -- the last words of T. S. Garp.




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1997-01-27  0:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <9701231552.AA07941@most>
1997-01-26  0:00 ` Plea for help Corey Minyard
1997-01-27  0:00   ` Richard Kenner
1997-01-27  0:00 ` Fergus Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox