forked from dolphin-emu/dolphin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathperf-disassemble.sh
executable file
·50 lines (47 loc) · 1.09 KB
/
perf-disassemble.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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