C ++ Python trace library equivalent

I need to get some debug libraries / tools to trace the printout of stack information in stdout.

Python traceback may be an example.

What could be the C ++ equivalent for the Python trace library?

+8
c ++ python traceback
source share
5 answers

It depends on the platform, and also depends on how you compile the code. If you compile code with gcc using -fomit-frame-pointer , it is very difficult to get useful backtracking, which usually requires heuristics. If you use any libraries that use this flag, you will also encounter problems - it is often used for highly optimized libraries (for example, the nVidia OpenGL libraries).

This is not a standalone solution, as it is part of a larger engine, but the code is useful:

This includes backtracing with a frame pointer with gcc when it is available, and heuristic backtracking when it is not; this may tend to give false entries in the trace, but to get a countdown for a crash report, this is much better than losing the entire trace.

In other directories that you would like to pay attention to use a different code (character search, signal processing); these links are a good starting point.

+2
source share

Try google core dumper , this will give you a core dump when you need it.

+1
source share

Now cpp-traceback now , this is definitely Python-style tracing for C ++.

+1
source share

I have had success with libunwind in the past. I know that it works well with Linux, but I'm not sure how Windows works, although it claims to be portable.

0
source share

If you are looking to get a "stack trace" in the event of a failure, try google breakpad '

0
source share

All Articles