Hi All,
I am working on QED-RM7000, a MIPS processor. My idea is
to get the stack trace of a task which has generated an exception.
( As shown by "tt")
I am able to capture the details ( WIND_TCB etc. ) of the task
by adding a hook to the default vxWorks exception handler.
But how do I generate the stack trace ( basically, details of
nested subroutine calls.) of the task ?
As per the WIND_TCB and other data structures, frame pointer,
stack pointer, and stack size are available for a task as a whole.
I believe that a way must be there to unwind the stack. But i am
unable to find it immediately.
If anyone has any inputs regarding this, please reply. Your help
will be very useful for me.
regards,
Abhijit
> I am working on QED-RM7000, a MIPS processor. My idea is
> to get the stack trace of a task which has generated an exception.
> ( As shown by "tt")
>
> I am able to capture the details ( WIND_TCB etc. ) of the task
> by adding a hook to the default vxWorks exception handler.
> But how do I generate the stack trace ( basically, details of
> nested subroutine calls.) of the task ?
>
> As per the WIND_TCB and other data structures, frame pointer,
> stack pointer, and stack size are available for a task as a whole.
>
> I believe that a way must be there to unwind the stack. But i am
> unable to find it immediately.
Abhijit, You say you want the output provided by the "tt" function. It
just prints it's information to stderr. How about capturing the output
to stderr while calling "tt"? I remember trying to figure out how tt
worked and finding that most of the work was done by the trcStack
function. This function is "architecture specific" and can get pretty
hairy. Your using a MIPS which I think has the architecture where
not all procedure calls have explicit stack frames. I don't think I
would want to have to write the code to unwind the stack myself.
There is no man page for the trcStack function but there is an include
file (trcLib.h) that indicates the routine can be passed a custom
print function. Maybe you could ask WRS support if there is any way
of finding out how that routine works so you can pass it your own
routine to capture the info you want.
Just a suggestion. Fred
| Fred J Roeber, BBN Systems & Technologies |
| 4 John Clarke Road Middletown, RI 02842-5202 |
| fro...@bbn.com 401-848-3548 |
| Division Scientist, High Performance Computing |
abhijit lahiri <abhijit...@wipro.com> wrote in message
news:8ghkco$jd...@overload.lbl.gov...
>
>
> Hi All,
> I am working on QED-RM7000, a MIPS processor. My idea is
> to get the stack trace of a task which has generated an exception.
> ( As shown by "tt")
>
> I am able to capture the details ( WIND_TCB etc. ) of the task
> by adding a hook to the default vxWorks exception handler.
> But how do I generate the stack trace ( basically, details of
> nested subroutine calls.) of the task ?
>
> As per the WIND_TCB and other data structures, frame pointer,
> stack pointer, and stack size are available for a task as a whole.
>
> I believe that a way must be there to unwind the stack. But i am
> unable to find it immediately.
>
Thanks Fred,
your info may be useful for me. I will have a look at
the trcStack function. I don't want to use the o/p of "tt" and want to
do it myself because that is the best way to do it in a a system which
does'nt have any filesystem to redirect the o/p of "tt" to. ( You may
say memDrv, but I want to avoid any file I/O when a task has
crashed/has generated exception )
It is true that MIPS specific architecture does not have explicit
stack frames for every procedure call, and stack exists for a task as
a whole. But I believe there is a catch, because "tt" does it.
Thank you for your help. I will have a look into trcStack
immediately.
Thanking you,
Abhijit
> >There is no man page for the trcStack function but there is an include
> >file (trcLib.h) that indicates the routine can be passed a custom
> Thanks Fred,
> your info may be useful for me. I will have a look at
> the trcStack function. I don't want to use the o/p of "tt" and want to
Here is all you need. You can even call xxxTrace(tid) from interrupt level...
though logMsg() is far from ideal.
Geoff
/*******************************************************************************
*
* xxxTracePrint - stack trace print function
*
* RETURNS: OK or ERROR
*/
static void xxxTracePrint
(
INSTR *caller,
int func,
int nargs,
int *args
)
{
char buf [250];
int ix;
int len = 0;
len += sprintf (&buf [len], "%#10x: %#10x (", (int)caller, func);
for (ix = 0; ix < nargs; ix++)
{
if (ix != 0)
len += sprintf (&buf [len], ", ");
len += sprintf (&buf [len], "%#x", args [ix]);
}
len += sprintf (&buf [len], ")\n");
logMsg (buf);
}
/*******************************************************************************
*
* xxxTrace - stack trace
*
* RETURNS: OK or ERROR
*/
int xxxTrace
(
WIND_TCB *pTcb
)
{
REG_SET regs;
if (pTcb == NULL)
return (ERROR);
taskRegsGet ((int)pTcb, ®s);
trcStack (®s, (FUNCPTR) xxxTracePrint, (int)pTcb);
return (OK);
}
--
Geoffrey Espin es...@idiom.com