Skip to content

Instantly share code, notes, and snippets.

@wsvn53
Last active March 21, 2016 13:19
Show Gist options
  • Save wsvn53/0443801baf37be6ff6a6 to your computer and use it in GitHub Desktop.
Save wsvn53/0443801baf37be6ff6a6 to your computer and use it in GitHub Desktop.
Dump all called functions using gdb.
program=$1;
tmp=$(mktemp);
readelf -s $program | awk '
{
if($4 == "FUNC" && $2 != 0) {
print "# code for " $NF;
print "b *0x" $2;
print "commands";
print "silent";
print "bt 1";
print "c";
print "end";
print "";
}
}' > $tmp;
# usage
echo "usage:"
echo "> gdb --command=$tmp ./$program";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment