summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2015-02-11 23:23:47 -0500
committerLioncash <mathew1800@gmail.com>2015-02-11 23:23:47 -0500
commitf2f2d6195071e25cdcbc627efd00ff5d6d66b540 (patch)
treee547c8f065cf6debdf5b4dfaab9e9221b282c75e
parentc7c6bdbf5a8fa09852966cc46d78c62913c33962 (diff)
parentfd374a7989a642a3eafc441d738f72cf5fe2d47d (diff)
Merge pull request #2022 from Tilka/perf
Tools: add disassemble script for perf
-rwxr-xr-xTools/perf-disassemble.sh50
1 files changed, 50 insertions, 0 deletions
diff --git a/Tools/perf-disassemble.sh b/Tools/perf-disassemble.sh
new file mode 100755
index 0000000000..d338b7141e
--- /dev/null
+++ b/Tools/perf-disassemble.sh
@@ -0,0 +1,50 @@
+#!/bin/bash
+#
+# Using this script instead of objdump enables perf to disassemble
+# and annotate any JIT code (given a symbol file).
+#
+# To run perf without root:
+# kernel.perf_event_paranoid = -1
+# To trace a process without root:
+# kernel.yama.ptrace_scope = 0
+#
+# Example usage:
+# $ dolphin-emu -P /tmp -b -e $game
+# $ perf top -p $(pidof dolphin-emu) --objdump ./Tools/perf-disassemble.sh
+
+flavor=att
+raw=r
+src=
+
+[[ "${@: -1}" != /tmp/perf-*.map ]] && { objdump "$@"; exit; }
+
+while [ "$1" ]
+do
+ case "$1" in
+ -M)
+ flavor=$2
+ shift
+ ;;
+ --start-address=*)
+ start="${1##--start-address=}"
+ ;;
+ --stop-address=*)
+ stop="${1##--stop-address=}"
+ ;;
+ --no-show-raw)
+ raw=
+ ;;
+ -S)
+ src=m
+ ;;
+ -[ldC])
+ ;;
+ -*)
+ echo "Unknown parameter '$1'"
+ ;;
+ *)
+ ;;
+ esac
+ shift
+done
+gdb -q -p $(pidof dolphin-emu) -ex "set disassembly $flavor" -ex "disas /$raw$src $start,$stop" -ex q -batch