Created
January 20, 2022 04:48
-
-
Save hsqStephenZhang/5620b89314c49b22b3d8dc402af54229 to your computer and use it in GitHub Desktop.
linux objdump certain function
This file contains hidden or 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
| #!/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