10f66f451Sopenharmony_ci#!/bin/sh 20f66f451Sopenharmony_ci 30f66f451Sopenharmony_ci# Copyright 2006 Rob Landley <rob@landley.net> 40f66f451Sopenharmony_ci 50f66f451Sopenharmony_ci# Dumb little utility function to print out the assembly dump of a single 60f66f451Sopenharmony_ci# function, or list the functions so dumpable in an executable. You'd think 70f66f451Sopenharmony_ci# there would be a way to get objdump to do this, but I can't find it. 80f66f451Sopenharmony_ci 90f66f451Sopenharmony_ci[ $# -lt 1 ] || [ $# -gt 2 ] && { echo "usage: showasm file function"; exit 1; } 100f66f451Sopenharmony_ci 110f66f451Sopenharmony_ci[ ! -f $1 ] && { echo "File $1 not found"; exit 1; } 120f66f451Sopenharmony_ci 130f66f451Sopenharmony_ciif [ $# -eq 1 ] 140f66f451Sopenharmony_cithen 150f66f451Sopenharmony_ci objdump -d $1 | sed -n -e 's/^[0-9a-fA-F]* <\(.*\)>:$/\1/p' 160f66f451Sopenharmony_ci exit 0 170f66f451Sopenharmony_cifi 180f66f451Sopenharmony_ci 190f66f451Sopenharmony_ciobjdump -d $1 | sed -n -e '/./{H;$!d}' -e "x;/^.[0-9a-fA-F]* <$2>:/p" 200f66f451Sopenharmony_ci 21