Skip to content

Commit

Permalink
support gcc 8's cold subfunctions (iovisor#2228)
Browse files Browse the repository at this point in the history
* support gcc 8's cold subfunctions

GCC 8 can split functions bodies into hot and cold regions, causing
extra symbols with a ".cold.N" suffix to be emitted. Exclude these
extra symbols and only allow the parent function to be traced.

Signed-off-by: Andrea Righi <[email protected]>

* use byte string with function names read from /proc/kallsyms

Function names are read from /proc/kallsyms, that is opened in binary
mode. Regex pattern must be bytes as well.

Signed-off-by: Andrea Righi <[email protected]>
  • Loading branch information
arighi authored and yonghong-song committed Feb 25, 2019
1 parent eba6beb commit e8ece56
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/python/bcc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,9 @@ def get_kprobe_functions(event_re):
# non-attachable.
elif fn.startswith(b'__perf') or fn.startswith(b'perf_'):
continue
# Exclude all gcc 8's extra .cold functions
elif re.match(b'^.*\.cold\.\d+$', fn):
continue
if (t.lower() in [b't', b'w']) and re.match(event_re, fn) \
and fn not in blacklist:
fns.append(fn)
Expand Down

0 comments on commit e8ece56

Please sign in to comment.