1
0
Fork
You've already forked stack_trace
0
Simple stack trace for C programs
C 98.2%
Batchfile 1.2%
Shell 0.6%
Find a file
2023年11月25日 04:44:01 +05:30
.gitignore Removed unecessary gitignore 2023年11月14日 01:02:03 +05:30
LICENSE Basic linux backtrace 2023年11月13日 17:01:42 +05:30
README.md Show stack traces from library calls in linux 2023年11月15日 04:12:50 +05:30
test.bat Convert to header only file 2023年11月14日 00:37:39 +05:30
test.c Intermediate trace 2023年11月25日 04:44:01 +05:30
test.sh Convert to header only file 2023年11月14日 00:37:39 +05:30
trace.h Intermediate trace 2023年11月25日 04:44:01 +05:30

Trace

Simple stack trace for C programs

Prerequisites:

  1. Make sure you have addr2line installed on linux

Usage:

  1. #define DR42_TRACE_IMPLEMENTATION before including this file STB style include
#define DR42_TRACE_IMPLEMENTATION
#include "trace.h"
  1. Call print_trace() to print the stack trace
  2. Call fprint_trace(fp) to print the stack trace to a file
  3. Call sprint_trace(buffer) to print the stack trace to a buffer

Compilation stuff:

  1. Compile with -g
  2. Link with -ldl -rdynamic on linux
  3. Compile with -g -gcodeview on windows
  4. Link with "-l dbghelp -fuse-ld=lld -Wl,--pdb="

Note: I have only tested this with the clang compiler