Created
November 8, 2018 15:10
-
-
Save snoe925/b32beb6e6cf89ae3fa4368bc3fc271b3 to your computer and use it in GitHub Desktop.
Using -finstrument-functions to trace function calls with call-trace
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Using the debugger or profiler to trace function calls can be a bit tedious. | |
This repository https://github.com/EmilOhlsson/call-trace implements the call trace in the executable. | |
apt-get install -y binutils-dev libbfd-dev libiberty-dev | |
My install was missing the demangle.h header. I could not find the DMGL defines so I inlined them. | |
I was patching an existing C build. I just included the code in one of the C files. | |
Then compile and link with -finstrument-functions. | |
#define DMGL_PARAMS (1 << 0) /* Include function args */ | |
#define DMGL_ANSI (1 << 1) /* Include const, volatile, etc */ | |
#include "call-trace.c" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment