Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save hsqStephenZhang/5620b89314c49b22b3d8dc402af54229 to your computer and use it in GitHub Desktop.

Select an option

Save hsqStephenZhang/5620b89314c49b22b3d8dc402af54229 to your computer and use it in GitHub Desktop.
linux objdump certain function
#!/bin/sh
routine=$1
func=$2
if [ -z "$routine" ]; then
exit
fi
start=$(nm -n $routine | grep "\w\s$func" | awk '{print "0x"$1;exit}')
end=$(nm -n $routine | grep -A1 "\w\s$func" | awk '{getline; print "0x"$1;exit}')
if [ -z "$func" ]; then
objdump -d $routine
else
echo "start-address: $start, end-address: $end"
objdump -d $routine --start-address=$start --stop-address=$end
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment