开发者

Using libunwind on HP-UX and getting stacktrace

开发者 https://www.devze.com 2023-04-06 13:23 出处:网络
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 pri

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().

0

精彩评论

暂无评论...
验证码 换一张
取 消