This discussion is archived
1 Reply Latest reply: Mar 5, 2013 11:05 PM by 995017 RSS

stack trace

988801 Newbie
Currently Being Moderated
Hi guys, I will appreciate it if someone can explain to me what the stack trace of a running process is.

I have gone online but still do not understand it.

Thanks alot
  • 1. Re: stack trace
    995017 Newbie
    Currently Being Moderated
    Run the pstack command against a process, such as rpcbind. You will see a list of names and some hex data. The names are the names of functions called by the program, in the order or "who called me." In C, you would see something like "x=read(5,...)" where your current function has called read. It would be the next routine on the stack.
    pstack orders from most recent to oldest, so you can see pollsys was called by poll which was called by my_svc_run, etc. The data in parenthesis are the arguments passed to the function.
    Some processes are multi-threaded, meaning that they have multiple stacks, for example like picld. The principle is the same, it's just a bit more complex to develop and debug a multi-threaded process.
    Essentially, a stack trace is a list of which function was called by which function. It's very helpful in debugging, as it helps you to see how you got where you are. You can even trace the routine to specific module, using the pmap command, if you understand a little more.
    I hope this helps. It's a slippery slope on detail. No one is born knowing all this stuff, but no one learned it overnight, either.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points