Created
April 14, 2014 08:52
-
-
Save matthijskooijman/10629220 to your computer and use it in GitHub Desktop.
avr-objdump -t output diff script
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/bash | |
# Diff avr-objdump -t output. | |
# Compares the presence and size of any non-debug symbols in the given | |
# section (or all sections if none given). | |
if [ "$#" = 3 ]; then | |
SECTION=$1 | |
shift; | |
else | |
SECTION='[^ ]*' | |
fi | |
if [ "$#" != 2 ]; then | |
echo "Usage: $0 [section] file1 file2" | |
exit 1 | |
fi | |
filter() { | |
# Drop anything but the request section | |
grep -E "^[0-9a-f]+ ....... $SECTION " | | |
# Drop debugging symbols | |
grep -Ev '^[0-9a-f]+ .....d. ' | | |
# Strip the address and flags, but keep the section, size and | |
# symbol name. Make them separated by tabs, so awk can split on | |
# that (without also splitting on any spaces inside the symbol | |
# name). | |
sed -r 's/^[0-9a-f]+ ....... ([^ ]*) ([0-9a-f]+) (.*)$/\1 \2 \3/' | | |
# Shuffle the order of fields (for sorting and easy reading) | |
awk -F'\t' '{ printf("%60s %s %s\n", $3, $2, $1); }' | | |
sort | |
} | |
grc diff <(cat $1 | filter) <(cat $2 | filter) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment