Skip to content
Navigation Menu
Toggle navigation
Sign in
In this repository
All GitHub Enterprise
↵
Jump to
↵
No suggested jump to results
In this repository
All GitHub Enterprise
↵
Jump to
↵
In this organization
All GitHub Enterprise
↵
Jump to
↵
In this repository
All GitHub Enterprise
↵
Jump to
↵
Sign in
Reseting focus
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
mariux64
/
linux
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
2
Pull requests
0
Actions
Projects
0
Wiki
Security
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security
Insights
Files
fa69416
Documentation
LICENSES
arch
block
certs
crypto
drivers
firmware
fs
include
init
ipc
kernel
lib
mm
net
samples
scripts
security
sound
tools
accounting
arch
bpf
build
cgroup
firewire
gpio
hv
iio
include
kvm
laptop
leds
lib
memory-model
nfsd
objtool
pci
pcmcia
perf
Documentation
arch
alpha
arm
arm64
mips
parisc
powerpc
annotate
entry
include
tests
util
Build
book3s_hcalls.h
book3s_hv_exits.h
dwarf-regs.c
header.c
kvm-stat.c
perf_regs.c
skip-callchain-idx.c
sym-handling.c
unwind-libdw.c
unwind-libunwind.c
Build
Makefile
s390
sh
sparc
x86
xtensa
Build
common.c
common.h
bench
examples
include
jvmti
pmu-events
python
scripts
tests
trace
ui
util
.gitignore
Build
CREDITS
MANIFEST
Makefile
Makefile.config
Makefile.perf
builtin-annotate.c
builtin-bench.c
builtin-buildid-cache.c
builtin-buildid-list.c
builtin-c2c.c
builtin-config.c
builtin-data.c
builtin-diff.c
builtin-evlist.c
builtin-ftrace.c
builtin-help.c
builtin-inject.c
builtin-kallsyms.c
builtin-kmem.c
builtin-kvm.c
builtin-list.c
builtin-lock.c
builtin-mem.c
builtin-probe.c
builtin-record.c
builtin-report.c
builtin-sched.c
builtin-script.c
builtin-stat.c
builtin-timechart.c
builtin-top.c
builtin-trace.c
builtin-version.c
builtin.h
check-headers.sh
command-list.txt
design.txt
perf-archive.sh
perf-completion.sh
perf-read-vdso.c
perf-sys.h
perf-with-kcore.sh
perf.c
perf.h
power
scripts
spi
testing
thermal
time
usb
virtio
vm
wmi
Makefile
usr
virt
.clang-format
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS
Makefile
README
Breadcrumbs
linux
/
tools
/
perf
/
arch
/
powerpc
/
util
/
sym-handling.c
Blame
Blame
Latest commit
History
History
155 lines (131 loc) · 3.53 KB
Breadcrumbs
linux
/
tools
/
perf
/
arch
/
powerpc
/
util
/
sym-handling.c
Top
File metadata and controls
Code
Blame
155 lines (131 loc) · 3.53 KB
Raw
/* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, as * published by the Free Software Foundation. * * Copyright (C) 2015 Naveen N. Rao, IBM Corporation */ #include "debug.h" #include "symbol.h" #include "map.h" #include "probe-event.h" #include "probe-file.h" #ifdef HAVE_LIBELF_SUPPORT bool elf__needs_adjust_symbols(GElf_Ehdr ehdr) { return ehdr.e_type == ET_EXEC || ehdr.e_type == ET_REL || ehdr.e_type == ET_DYN; } #endif int arch__choose_best_symbol(struct symbol *syma, struct symbol *symb __maybe_unused) { char *sym = syma->name; #if !defined(_CALL_ELF) || _CALL_ELF != 2 /* Skip over any initial dot */ if (*sym == '.') sym++; #endif /* Avoid "SyS" kernel syscall aliases */ if (strlen(sym) >= 3 && !strncmp(sym, "SyS", 3)) return SYMBOL_B; if (strlen(sym) >= 10 && !strncmp(sym, "compat_SyS", 10)) return SYMBOL_B; return SYMBOL_A; } #if !defined(_CALL_ELF) || _CALL_ELF != 2 /* Allow matching against dot variants */ int arch__compare_symbol_names(const char *namea, const char *nameb) { /* Skip over initial dot */ if (*namea == '.') namea++; if (*nameb == '.') nameb++; return strcmp(namea, nameb); } int arch__compare_symbol_names_n(const char *namea, const char *nameb, unsigned int n) { /* Skip over initial dot */ if (*namea == '.') namea++; if (*nameb == '.') nameb++; return strncmp(namea, nameb, n); } const char *arch__normalize_symbol_name(const char *name) { /* Skip over initial dot */ if (name && *name == '.') name++; return name; } #endif #if defined(_CALL_ELF) && _CALL_ELF == 2 #ifdef HAVE_LIBELF_SUPPORT void arch__sym_update(struct symbol *s, GElf_Sym *sym) { s->arch_sym = sym->st_other; } #endif #define PPC64LE_LEP_OFFSET 8 void arch__fix_tev_from_maps(struct perf_probe_event *pev, struct probe_trace_event *tev, struct map *map, struct symbol *sym) { int lep_offset; /* * When probing at a function entry point, we normally always want the * LEP since that catches calls to the function through both the GEP and * the LEP. Hence, we would like to probe at an offset of 8 bytes if * the user only specified the function entry. * * However, if the user specifies an offset, we fall back to using the * GEP since all userspace applications (objdump/readelf) show function * disassembly with offsets from the GEP. */ if (pev->point.offset || !map || !sym) return; /* For kretprobes, add an offset only if the kernel supports it */ if (!pev->uprobes && pev->point.retprobe) { #ifdef HAVE_LIBELF_SUPPORT if (!kretprobe_offset_is_supported()) #endif return; } lep_offset = PPC64_LOCAL_ENTRY_OFFSET(sym->arch_sym); if (map->dso->symtab_type == DSO_BINARY_TYPE__KALLSYMS) tev->point.offset += PPC64LE_LEP_OFFSET; else if (lep_offset) { if (pev->uprobes) tev->point.address += lep_offset; else tev->point.offset += lep_offset; } } #ifdef HAVE_LIBELF_SUPPORT void arch__post_process_probe_trace_events(struct perf_probe_event *pev, int ntevs) { struct probe_trace_event *tev; struct map *map; struct symbol *sym = NULL; struct rb_node *tmp; int i = 0; map = get_target_map(pev->target, pev->nsi, pev->uprobes); if (!map || map__load(map) < 0) return; for (i = 0; i < ntevs; i++) { tev = &pev->tevs[i]; map__for_each_symbol(map, sym, tmp) { if (map->unmap_ip(map, sym->start) == tev->point.address) { arch__fix_tev_from_maps(pev, tev, map, sym); break; } } } } #endif /* HAVE_LIBELF_SUPPORT */ #endif
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
You can’t perform that action at this time.