Simple stack trace for C programs
| .gitignore | Removed unecessary gitignore | |
| LICENSE | Basic linux backtrace | |
| README.md | Show stack traces from library calls in linux | |
| test.bat | Convert to header only file | |
| test.c | Intermediate trace | |
| test.sh | Convert to header only file | |
| trace.h | Intermediate trace | |
Trace
Simple stack trace for C programs
Prerequisites:
- Make sure you have addr2line installed on linux
Usage:
- #define DR42_TRACE_IMPLEMENTATION before including this file STB style include
#define DR42_TRACE_IMPLEMENTATION
#include "trace.h"- Call print_trace() to print the stack trace
- Call fprint_trace(fp) to print the stack trace to a file
- Call sprint_trace(buffer) to print the stack trace to a buffer
Compilation stuff:
- Compile with -g
- Link with -ldl -rdynamic on linux
- Compile with -g -gcodeview on windows
- Link with "-l dbghelp -fuse-ld=lld -Wl,--pdb="
Note: I have only tested this with the clang compiler