-
Notifications
You must be signed in to change notification settings - Fork 0
/
perfobjdump
executable file
·60 lines (55 loc) · 1.21 KB
/
perfobjdump
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
51
52
53
54
55
56
57
58
59
60
#!/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:
# $ perf top -p $pid --objdump perfobjdump
# Largely inspired by perf-disassemble.sh from Dolphin-emu Tools/
# by Tillmann Karras <[email protected]>.
function is_aot_dump() {
for a in "$@"; do
case "$a" in
/tmp/perf-*.map)
return 1
;;
esac
done
return 0
}
if is_aot_dump "$@" ; then
exec objdump "$@"
fi
pid=0
start=0
stop=0
for a in "$@"; do
case "$a" in
/tmp/perf-*.map)
pid="${a#/tmp/perf-}"
pid="${pid%.map}"
shift
;;
-M | --no-show-raw | -S | -C | -l | -d)
shift
;;
--start-address=*)
start="${a##--start-address=}"
shift
;;
--stop-address=*)
stop="${a##--stop-address=}"
shift
;;
-*)
echo "Unknown parameter '$1'" >&2
exit 1
;;
esac
done
exec unjit -p "$pid" --start "$start" --stop "$stop"