summaryrefslogtreecommitdiff
path: root/scripts/objdump-func
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2022-06-15 08:47:44 +0300
committerTakashi Iwai <tiwai@suse.de>2022-06-15 08:47:44 +0300
commitf777316e52e14059a6a1df45cbf39a93ac49a593 (patch)
treef9bd76323abdea96d89bf573affd587006a0475f /scripts/objdump-func
parent56ec3e755bd1041d35bdec020a99b327697ee470 (diff)
parentf5e829f92a494a0b66d309497bab4e9d10d4ce3e (diff)
downloadlinux-f777316e52e14059a6a1df45cbf39a93ac49a593.tar.xz
Merge branch 'topic/ctl-enhancements' into for-next
Pull ALSA control enhancement patches. One is the faster lookup of control elements, and another is to introduce the input data validation. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'scripts/objdump-func')
-rwxr-xr-xscripts/objdump-func29
1 files changed, 29 insertions, 0 deletions
diff --git a/scripts/objdump-func b/scripts/objdump-func
new file mode 100755
index 000000000000..4eb463dd9f52
--- /dev/null
+++ b/scripts/objdump-func
@@ -0,0 +1,29 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+#
+# Disassemble a single function.
+#
+# usage: objdump-func <file> <func>
+
+set -o errexit
+set -o nounset
+
+OBJDUMP="${CROSS_COMPILE:-}objdump"
+
+command -v gawk >/dev/null 2>&1 || die "gawk isn't installed"
+
+usage() {
+ echo "usage: objdump-func <file> <func>" >&2
+ exit 1
+}
+
+[[ $# -lt 2 ]] && usage
+
+OBJ=$1; shift
+FUNC=$1; shift
+
+# Secret feature to allow adding extra objdump args at the end
+EXTRA_ARGS=$@
+
+# Note this also matches compiler-added suffixes like ".cold", etc
+${OBJDUMP} -wdr $EXTRA_ARGS $OBJ | gawk -M -v f=$FUNC '/^$/ { P=0; } $0 ~ "<" f "(\\..*)?>:" { P=1; O=strtonum("0x" $1); } { if (P) { o=strtonum("0x" $1); printf("%04x ", o-O); print $0; } }'