libinstrumentation Code
A simple library for stack traces via instrumentation
Brought to you by:
bjoern_ganster
Use libinstrumentation to add stack traces to your code. Usage: - Add libinstrumentation to your project (details depend on the compiler used) - Define a list of file numbers in a central location - Add include: #include "libinstrumentation.h" - Below the include, add a line like #define FILE_NUMBER FILE_NO_ARCHIVE_ACCESS_CPP - Before any other call to the library, place a call to stInitialize() - At the start of a function, add the macro SET_SCOPE; - Before dangerous/long/critical operations, add a call to SET_OP; - Replace any return statements with the RETURN macro - Since RETURN is a macro, return statements after if need braces: if (condition) return value; becomes if (condition) { RETURN value; } - Any time you need a stacktrace, call stGetCurrentThreadStackTrace. This will get you a string composed of pairs a:b, where a is a file number you defined and b is a line number for that file Please check out the latest version from git and please check the code samples.