0

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.

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.

4

1 回答 1

1

U_STACK_TRACE() 将格式化的堆栈跟踪打印到标准错误。_UNW_STACK_TRACE() 在参数 out_file 指示的输出流上生成格式化的堆栈跟踪。流必须是可写流才能生成输出。

因此,使用 fopen() 打开一个文件并调用 _UNW_STACK_TRACE() 而不是 U_STACK_TRACE()。

于 2011-09-22T14:37:52.007 回答