Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@snoe925
snoe925 / gist:b32beb6e6cf89ae3fa4368bc3fc271b3
Created November 8, 2018 15:10
Using -finstrument-functions to trace function calls with call-trace
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.
#!/bin/sh
git config core.repositoryformatversion >/dev/null
if [ $? -ne 0 ]; then
echo "Not a git repository" >&2
exit 1
fi
if [ "$1" = "enable" ]; then
sudo apt install -y build-essential debhelper dh-systemd librtlsdr-dev libusb-1.0-0-dev
sudo apt install -y git pkg-config libncurses5-dev lighttpd libbladerf-dev
cd ~/
git clone https://github.com/flightaware/dump1090.git --depth 1
cd dump1090
dpkg-buildpackage -b -rfakeroot -us -uc
sudo dpkg -i ../dump1090-fa_3.7.1_armhf.deb
FROM balenalib/armv7hf-debian
# setup all the stuff to build dump1090
RUN apt update -qq && \
apt-get install -y git git-core cmake usbutils libusb-1.0-0-dev build-essential \
debhelper dh-systemd librtlsdr-dev libbladerf-dev \
pkg-config libncurses5-dev lighttpd vim
CMD ["/bin/bash"]