Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting stacktrace in running program without a debugger

Status
Not open for further replies.

randy4126

Programmer
Jun 2, 2001
62
US
I am looking for some help help getting a stack trace in program that is executing. In our new logging routines we want to include that stacktrace so we are able to tell what program that called the one of library functions is having the the problem. We are running on a system using AIX 5.1. I able to walk the prpgram stack and get all the return addresses and I also have had sucess reading in the symbol table but the problem I am having is how to map the symbol to the return adresss to get the function name. Any help you can give would be appreciated. Also the software package I work is written in C so how to do this in C is what i am looking for. I know some other languages have this functionality builtin but this version of AIX and language does not so I have to implement it myself.

Thanks,

Randy.

Randy
smiletiniest.gif
 
1) Are you using XLC or gcc?

2) Do you have strace or truss? You can use them to attach to the process.

3) You could also try /sbin/pstack.
 
1) Are you using XLC or gcc?
gcc
2) Do you have strace or truss? You can use them to attach to the process.
strace - Yes
truss - Yes
3) You could also try /sbin/pstack.
doesn't exist ont the system.


So how would I use truss or strace from withinside my program?


Randy
smiletiniest.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top