Using libunwind on HP-UX and getting stacktrace
I have a C application that is executing in an HP-UX environment and I need to get the stacktrace.
I am attempting to use U_STACK_TRACE, but output to stderr is going somewhere else and I need it printed to a string.
开发者_StackOverflow中文版How can I do this?
I.E. How can I take the output from U_STACK_TRACE and put it in a string instead of it being written to stderr.
U_STACK_TRACE() prints a formatted stack trace to standard error. _UNW_STACK_TRACE() produces a formatted stack trace on the output stream indicated by parameter out_file. The stream must be a writable stream for output to be produced.
So, open a file using fopen() and call _UNW_STACK_TRACE() instead of U_STACK_TRACE().
精彩评论