Last active
March 21, 2016 13:19
-
-
Save wsvn53/0443801baf37be6ff6a6 to your computer and use it in GitHub Desktop.
Dump all called functions using gdb.
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
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