-3

フローを確認する必要があるため、実行中のプログラム (C) のログ ファイルにコール スタックを出力する必要があります。他の環境にトレースを送信する必要があり、デバッグできません。C でそれを行う方法はありますか? .

4

1 に答える 1

1

If the platform is linux (and I believe in OSX too), you could use backtrace and backtrace_symbols to achieve what you want.

As per the notes section of backtrace

The symbol names may be unavailable without the use of special linker options. For systems using the GNU linker, it is necessary to use the -rdynamic linker option. Note that names of "static" functions are not exposed, and won't be available in the backtrace.

于 2013-03-01T03:35:55.283 に答える