Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22093

C/C++: How to print a stack trace? [duplicate]

$
0
0

when gcc/g++ encounters an ICE (internal compiler error), then recent versions of the compiler will print a neat stack trace before exiting.

Questions: What technology is used to implement that? GCC is written in C++, afaik some conservative revision like C++03.

Does it require exceptions, signals or even interpretation of debug-info? Is there host/OS dependence?

Playing around with own C/C++ code, all I found is __builtin_return_address which allows to print code address that can be used to display locations by piping them through an external tool like addr2line...

Note:

Unfortunately, this question has been prematurely closed... In particular, the linked thread does not address the following points:

  • GCC does not use Boost.

  • GCC does not use external libraries like linunwind or libexcept to all of my knowledge.

  • GCC does not necessarily use glibc. For example I can cross-compile GCC on linux for host mingw32, and stack traces work just fine.


Viewing all articles
Browse latest Browse all 22093

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>