blob: 75a6efd70cca792944a1dbc4871437c64b18bf98 [file] [log] [blame]
Rob Landleycd2edfd2006-11-26 18:47:14 -05001#!/bin/sh
2
3# Copyright 2006 Rob Landley <rob@landley.net>
4
5# Dumb little utility function to print out the assembly dump of a single
6# function, or list the functions so dumpable in an executable. You'd think
7# there would be a way to get objdump to do this, but I can't find it.
8
9[ $# -lt 1 ] || [ $# -gt 2 ] && { echo "usage: showasm file function"; exit 1; }
10
11[ ! -f $1 ] && { echo "File $1 not found"; exit 1; }
12
13if [ $# -eq 1 ]
14then
15 objdump -d $1 | sed -n -e 's/^[0-9a-fA-F]* <\(.*\)>:$/\1/p'
16 exit 0
17fi
18
19objdump -d $1 | sed -n -e '/./{H;$!d}' -e "x;/^.[0-9a-fA-F]* <$2>:/p"
20