Stack trace from a program (130 Views)
Reply
Occasional Visitor
Canedo_1
Posts: 1
Registered: ‎10-20-2004
Message 1 of 3 (130 Views)

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
Honored Contributor
Sanjay_6
Posts: 5,942
Registered: ‎04-15-2001
Message 2 of 3 (130 Views)

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
Dennis Handly
Posts: 25,074
Registered: ‎03-06-2006
Message 3 of 3 (128 Views)

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.

The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.