Mercurial > hg > toybox
annotate scripts/showasm @ 206:a14921912ebc
Delete testdir after use.
author | Rob Landley <rob@landley.net> |
---|---|
date | Sun, 16 Dec 2007 18:02:05 -0600 |
parents | a43bdc6f53af |
children |
rev | line source |
---|---|
41
a43bdc6f53af
Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
1 #!/bin/sh |
a43bdc6f53af
Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
2 |
a43bdc6f53af
Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
3 # Copyright 2006 Rob Landley <rob@landley.net> |
a43bdc6f53af
Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
4 |
a43bdc6f53af
Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
5 # Dumb little utility function to print out the assembly dump of a single |
a43bdc6f53af
Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
6 # function, or list the functions so dumpable in an executable. You'd think |
a43bdc6f53af
Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
7 # there would be a way to get objdump to do this, but I can't find it. |
a43bdc6f53af
Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
8 |
a43bdc6f53af
Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
9 [ $# -lt 1 ] || [ $# -gt 2 ] && { echo "usage: showasm file function"; exit 1; } |
a43bdc6f53af
Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
10 |
a43bdc6f53af
Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
11 [ ! -f $1 ] && { echo "File $1 not found"; exit 1; } |
a43bdc6f53af
Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
12 |
a43bdc6f53af
Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
13 if [ $# -eq 1 ] |
a43bdc6f53af
Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
14 then |
a43bdc6f53af
Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
15 objdump -d $1 | sed -n -e 's/^[0-9a-fA-F]* <\(.*\)>:$/\1/p' |
a43bdc6f53af
Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
16 exit 0 |
a43bdc6f53af
Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
17 fi |
a43bdc6f53af
Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
18 |
a43bdc6f53af
Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
19 objdump -d $1 | sed -n -e '/./{H;$!d}' -e "x;/^.[0-9a-fA-F]* <$2>:/p" |
a43bdc6f53af
Add bloat-o-meter, make bloatcheck, and scripts/showasm.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
20 |