Languages and Scripting
Showing results for 
Search instead for 
Do you mean 

Stack trace from a program

Highlighted
Occasional Visitor

Stack trace from a program

Hello all,

Do not know if someone already asked this before.
I would like to print a stack trace (function + source file + source line) in a program to give information on where an exception was thrown, where a signal was caught etc... I tried to use U_STACK_TRACE() function but it does not give the source file and source line (even using -g option). Is there an example of code to do such trace ?
We run HP-UX on PA-RISC and we compile 64 bits applications using aCC 3.52.

uname -r
B.11.11

Thanks for any feedback

Best regards

Joseph Canedo
2 REPLIES
Honored Contributor Honored Contributor

Re: Stack trace from a program

Hi Joseph,

Maybe this link from itrc would help,

http://www2.itrc.hp.com/service/cki/docDisplay.do?docLocale=en_US&docId=200000062966592

the itrc doc id is UNX1000205.

Hope this helps.

Regds
Acclaimed Contributor Acclaimed Contributor

Re: Stack trace from a program

>would like to print a stack trace (function + source file + source line).  I tried to use U_STACK_TRACE() but it does not give the source file and source line (even using -g option).

 

The Integrity version of U_STACK_TRACE() will print the source and line info, even without -g.

For PA, you will have to use -g and gdb to map hex addresses to source positions.